Creating an MCP server in MCP Hub from scratch
Note
This feature is at the Preview stage.
In MCP Hub, you can create new MCP servers from scratch containing tools such as an HTTPS request to an external API, a Yandex Cloud Functions function, or a workflow in Yandex Workflows.
Tip
To create a new MCP server:
-
In the management console
, select the folder for which your account has theserverless.mcpGateways.editorandiam.serviceAccounts.userroles or higher. -
Go to AI Studio.
-
In the left-hand panel, select MCP servers and click Create MCP server. In the window that opens:
-
Under Add method, select
Create. -
Under Tools, select the type of the tool you want to add to the MCP server:
HTTPS query,Cloud Functions, orWorkflows:HTTPS requestCloud FunctionsWorkflows-
In the Tool name field, enter a name for the new tool. Follow these naming requirements:
- It must be from 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
In the Instructions for agent field, enter the required text description for the tool. This description must define conditions for the AI agent to use this tool. Here is an example:
A tool for creating tickets in a corporate task processing system. Use this tool to log customer complaints, support requests, and error reports. When using this tool, set the `queue`, `type`, `priority`, and `summary` parameters. In the `queue` parameter (queue name), always provide the SUPPORT constant. In the `type` parameter (request type), provide one of the following values: bug (error report), complaint (customer complaint) or support-request (request for consultation). In the `priority` parameter, provide one of these values: low, medium, or high. In the `summary` parameter, provide a text describing the gist of the user request in their own words. -
In the URL field, specify the endpoint for the HTTPS request.
-
You can use jq templates
to add path parameters to the endpoint value. Here is an example:https://console.yandex.cloud/folders/\(.folder-id)In this example, the
folder-idfield must also be added to the Tool parameters section of the MCP server settings. -
To send query parameters of the endpoint request:
- Add relevantly named fields to the Tool parameters section of the new MCP server settings, e.g.,
country,city, andname. - Add relevant query parameters to the HTTPS method parameters section of the new MCP server settings. Specify jq templates with the names of the fields mentioned above as values for the new query parameters, e.g.,
\(.country),\(.city), and\(.name).
- Add relevantly named fields to the Tool parameters section of the new MCP server settings, e.g.,
-
-
In the Method field, select the HTTP request method:
GET,POST,DELETE,PATCH,OPTIONS, orHEAD. -
Expand the Additional parameters section and specify the authentication data to provide in HTTPS requests:
Service account: To provide the IAM token issued for the service account attached to the MCP server.Access token: To provide the specified access token.Without authorization: To skip authentication.
-
Under Tool parameters, specify the names, types, and text descriptions of the parameters the tool will use.
You can add the parameters you need on the layout-header-cells-large Form tab one by one by clicking
Add, or on the JSON schema tab, as a JSON structure.JSON schema:
{ properties?: { [key: string]: object }; required?: string[]; type: "object"; }JSON struture example
{ "type": "object", "properties": { "location": { "type": "string", "description": "City name or zip code" } }, "required": ["location"] } -
Under HTTPS method parameters, configure the HTTPS request parameters:
-
Under Request headers, specify the names and values of the headers to provide in requests.
-
Under Query parameters, specify the names and values of the parameters to provide in the request.
-
Under Request body, review an example of the request and modify it as needed.
By default, an empty request body is generated with a flat JSON
object consisting of pairs of tool parameters and their values. For example:{ "parameter-a": <parameter-a_value>, "parameter-b": <parameter-b_value>, "parameter-c": <parameter-c_value> }
All HTTPS request parameters support templating: their values can be generated dynamically in the
jqlanguage. For more information, see the jq guide .For example, the
\(.city)value of the HTTPS request parameter will be taken from thecitytool parameter. In addition, you can use the syntaxBearer \(.token)for theAuthorizationheader to set up authorization via a token provided in the tool parameter. -
-
In the Tool name field, enter a name for the new tool. Follow these naming requirements:
- It must be from 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
In the Instructions for agent field, enter the required text description for the tool. This description must define conditions for the AI agent to use this tool. Here is an example:
This tool recognizes text in an image transmitted in base64 encoding. In the recognized text, the tool extracts "article":"quantity" pairs and returns them in JSON structure format. -
In the Function field, select the Cloud Functions function to process the requests and its version.
-
Under Tool parameters, specify the names, types, and text descriptions of the parameters the tool will use.
You can add the parameters you need on the layout-header-cells-large Form tab one by one by clicking
Add, or on the JSON schema tab, as a JSON structure.JSON schema:
{ properties?: { [key: string]: object }; required?: string[]; type: "object"; }JSON struture example
{ "type": "object", "properties": { "location": { "type": "string", "description": "City name or zip code" } }, "required": ["location"] }
By default, an empty request body is generated with a flat JSON
object consisting of pairs of tool parameters and their values. For example:{ "parameter-a": <parameter-a_value>, "parameter-b": <parameter-b_value>, "parameter-c": <parameter-c_value> }-
In the Tool name field, enter a name for the new tool. Follow these naming requirements:
- It must be from 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
In the Instructions for agent field, enter the required text description for the tool. This description must define conditions for the AI agent to use this tool. Here is an example:
This tool invokes a workflow to automatically summarize long text. Provides the source text, maximum summation length, and language. -
In the Workflow field, select the Workflows workflow to process the requests.
-
Under Tool parameters, specify the names, types, and text descriptions of the parameters the tool will use.
You can add the parameters you need on the layout-header-cells-large Form tab one by one by clicking
Add, or on the JSON schema tab, as a JSON structure.JSON schema:
{ properties?: { [key: string]: object }; required?: string[]; type: "object"; }JSON struture example
{ "type": "object", "properties": { "location": { "type": "string", "description": "City name or zip code" } }, "required": ["location"] }
By default, an empty request body is generated with a flat JSON
object consisting of pairs of tool parameters and their values. For example:{ "parameter-a": <parameter-a_value>, "parameter-b": <parameter-b_value>, "parameter-c": <parameter-c_value> } -
-
To add an additional tool to the MCP server, click
Add tool.Note
One MCP server can contain up to 50 tools.
-
Under Server parameters:
-
In the Name field, enter a name for the new MCP server. Follow these naming requirements:
- It must be from 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
Optionally, add a description and labels for the server you are creating by using the corresponding buttons.
-
In the Access field, select the type of your new server:
- Private: To build a private MCP server with the authentication-based access.
- Public: To build a public MCP server that requires no authentication.
-
In the Service account field, select the service account your MCP server will use to access Yandex Cloud services and resources. The service account should get the roles sufficient to access these resources and services.
-
Optionally, enable Select network to specify a cloud network to host your MCP server instances.
-
Optionally, turn on the Enable logging option and configure the logging settings to keep a log of the MCP server you are creating.
-
-
Click Save.
-
Note
The example below demonstrates how to create a simple MCP server with a single tool, an HTTPS request. To set up an MCP server with multiple tools, add the descriptions of these tools as separate JSONtools list. For more information about the parameters used to create an MCP server, see McpGateway.Create in the API reference.
-
Get an IAM token, which is required for authentication.
-
Save the IAM token to an environment variable:
export IAM_TOKEN="<IAM_token_contents>" -
Create a file with the request body, e.g.,
body.json:body.json
{ "folderId": "<folder_ID>", "name": "<MCP_server_name>", "description": "<MCP_server_description>", "serviceAccountId": "<service_account_ID>", "public": "true|false", "tools": [ { "name": "<tool_name>", "description": "<tool_description>", "inputJsonSchema": "<tool_JSON_schema>", "action": { "httpCall": { "url": "<endpoint_URL>", "method": "<HTTP_method>", "body": "<request_body>", "headers": { "header1": "<header1_value>", "header2": "<header2_value>" }, "query": { "parameter1": "<parameter1_value>" }, "useServiceAccount": "true|false" } } } ] }Where:
-
folderId: ID of the folder the MCP server is created in. Make sure to assign theserverless.mcpGateways.editorandiam.serviceAccounts.userroles or higher for this folder to your account. -
name: Name of the new MCP server. Follow these naming requirements:- It must be from 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
description: Description of the new MCP server. -
serviceAccountId: ID of the service account your MCP server will use to access Yandex Cloud services and resources. The service account should get the roles sufficient to access these resources and services. -
public: Type of the new server. The possible values are:true: To create a public MCP server.false: To create a private MCP server.
-
tools: Description of the tools you add to the MCP server:-
name: Tool name. Follow these naming requirements:- It must be from 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
description: Tool description. -
inputJsonSchema: JSON schema describing the tool input parameters.JSON schema:
{ properties?: { [key: string]: object }; required?: string[]; type: "object"; }JSON struture example
{ "type": "object", "properties": { "location": { "type": "string", "description": "City name or zip code" } }, "required": ["location"] } -
action.httpCall: Description of configuration parameters for a tool of theHTTPS requesttype.url: URL to send the requests to, e.g.,https://example.com.method: Request method. The possible values areOPTIONS,GET,HEAD,POST,PUT,PATCH,DELETE,TRACE, andCONNECT.body: HTTP request body.headers: List ofname:valuepairs of the headers to provide in requests.query: List ofname:valuepairs of the query parameters to provide with requests.useServiceAccount: If set totrue, requests will be authenticated using an IAM token issued for the service account attached to the MCP server.
All HTTPS request parameters support templating: their values can be generated dynamically in the
jqlanguage. For more information, see the jq guide .For example, the
\(.city)value of the HTTPS request parameter will be taken from thecitytool parameter. In addition, you can use the syntaxBearer \(.token)for theAuthorizationheader to set up authorization via a token provided in the tool parameter.
Request body example
{ "folderId": "b1gt6g8ht345********", "name": "my-mcp-server", "description": "My sample MCP-server implementing an HTTPS tool", "serviceAccountId": "ajegtlf2q28a********", "public": "true", "tools": [ { "name": "the-https-tool", "description": "My HTTPS tool", "inputJsonSchema": "{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"City name or zip code\"},\"name\":{\"type\":\"string\",\"description\":\"Full name\"}},\"required\":[\"location\",\"name\"]}", "action": { "httpCall": { "url": "https://example.com", "method": "GET", "body": "\\( . )", "headers": { "location": "\\(.location)", "name": "\\(.name)" }, "query": { "name": "\\(.name)" }, "useServiceAccount": "false" } } } ] } -
-
-
Use the McpGateway.Create REST API method to create a new MCP server in the folder:
curl \ --request POST \ --header "Authorization: Bearer $IAM_TOKEN" \ --data "@body.json" \ "https://serverless-mcp-gateway.api.cloud.yandex.net/mcpgateway/v1/mcpGateways"Result:
{ "done": false, "metadata": { "@type": "type.googleapis.com/yandex.cloud.serverless.mcpgateway.v1.CreateMcpGatewayMetadata", "mcpGatewayId": "db8f3fgm7vq1********", "folderId": "b1gt6g8ht345********" }, "id": "db8h3djc7vjt********", "description": "Create MCP Gateway", "createdAt": "2025-12-24T06:38:31.834344392Z", "createdBy": "ajeol2afu1js********", "modifiedAt": "2025-12-24T06:38:31.834344392Z" }Save the new MCP server's ID (the
mcpGatewayIdfield value) for the next step. -
Wait until the MCP server is created, then view its details by specifying the ID you saved in the previous step:
curl \ --request GET \ --header "Authorization: Bearer $IAM_TOKEN" \ "https://serverless-mcp-gateway.api.cloud.yandex.net/mcpgateway/v1/mcpGateways/<MCP_server_ID>"Result
{ "tools": [ { "action": { "httpCall": { "headers": { "location": "\\(.location)", "name": "\\(.name)" }, "query": { "name": "\\(.name)" }, "useServiceAccount": false, "url": "https://example.com", "method": "GET", "body": "\\( . )" } }, "name": "the-https-tool", "description": "My HTTPS tool", "inputJsonSchema": "{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"City name or zip code\"},\"name\":{\"type\":\"string\",\"description\":\"Full name\"}},\"required\":[\"location\",\"name\"]}" } ], "logOptions": { "disabled": false }, "public": true, "id": "db8f3fgm7vq1********", "folderId": "b1gt6g8ht345********", "createdAt": "2025-12-24T06:38:31.884226Z", "name": "my-mcp-server", "description": "My sample MCP-server implementing an HTTPS tool", "status": "ACTIVE", "baseDomain": "https://db8f3fgm7vq1********.ibiatp37.mcpgw.serverless.yandexcloud.net", "serviceAccountId": "ajegtlf2q28a********", "cloudId": "b1gia87mbaom********" }
This will create an MCP server in MCP Hub, containing the added tools and accessible to AI agents.