tencent cloud

Cloud Native Intelligent Gateway

DokumentasiCloud Native Intelligent GatewayAI GatewayGetting StartedRapid Integration of Standard MCP Services via AI Gateway

Rapid Integration of Standard MCP Services via AI Gateway

Unduh
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-09-22 18:34:45
Diterjemahkan oleh AI

Scenario Overview

This document uses the "standard MCP service" as an example: a publicly accessible MCP backend already exists (this document uses uapis.cn as an example, which includes 109 free tools), and you expose its proxy to internal Agents for invocation through an AI Gateway. The gateway handles authentication and traffic control, while backend tools are transparently proxied.
Why do you need a reachable backend? All backend addresses in this document are real and available public services, and each step can be verified with curl.

Prerequisites

1. An AI Gateway instance has been created, and its status is Running. For detailed operations, see Creating an AI Gateway.
2. The gateway can communicate with the public network (this document uses a public MCP backend service).

Operation Steps

Step 1: Creating an MCP Service

1. Log in to the AI Gateway console and select the target AI Gateway instance to go to its details.
2. In the left sidebar, select MCP Management.
3. On the "MCP Service" page, click Create.
4. Configure the parameters by referring to the following table:
4.1 Basic Information
Parameter
Description
MCP Service Name
uapis-tools
Service Display Name
UAPI Public Toolset
Service type
Standard MCP Service
Request Protocol
Streamable HTTP (default)
Description
Public MCP toolset (including 109 tools: JSON formatting, timestamp conversion, daily word, IP address query, and more)
4.2 Backend Service Configuration
Parameter
Description
Backend Type
Domain Name/IP Address
Service Protocol
HTTPS
Service Address
uapis.cn
Service port
443
Service Path
/mcp
Timeout Time
60000 ms (default)
Number of retries
5 (default)
4.3 Session Management: Keep the default settings.
After the MCP service is created, click to go to the service details page and select the "Tools Management" tab to view the automatically synchronized Tools list.

Step 2: Backend Authentication Configuration (Choose One):

Mode
Scenario
Backend Authentication Configuration
Visitor mode (for quick experience, skip step 2)
Temporary demonstration and quick verification
Do not fill in any authentication information. Consumer Key authentication on the gateway side is sufficient, and it is not passed downstream.
API Key mode (verify the complete authentication chain)
Verify backend Key > gateway > consumer three-level authentication.
Add the request header Authorization: Bearer <your uapis.cn API Key>.
1. To create a "Consumer Key": On the details page of the target AI Gateway instance, choose Key Management > Consumer Keys > Create Consumer Key in the left menu.
Parameter
Description
Key Name
test
Key Credential Type
API Key
Generation Method
Custom
Credential Content
sk-5db73b83d1086f93dff72203312fae (for testing purposes only)
2. To create a "Consumer Group": On the details page of the target AI Gateway instance, choose Consumer Management > Consumer Group Management > Create a consumer group named test-group in the left menu.
3. To create a "Consumer": On the details page of the target AI Gateway instance, choose Consumer Management > Consumer Management > Create a consumer named test in the left menu.
Parameter
Description
Consumer name
test
Consumer group
test-group
Selecting a secret
test
4. To configure authentication: Click the MCP service you just created to go to the service details page, and then click the "Access Control" tab.
Authentication Configuration: Enable API Key authentication.
Server Access Control: Configure the "allowlist" access mode, select test-group for the consumer group, and select test for the consumer.

Step 3: Obtaining the Access Address and Initiating Calls

1. Obtaining the Access Address.
On the MCP service list page, click uapis-tools to go to the details page. The access address is displayed in the Access Method section, as shown below:
http://<gateway_IP>/mcpservers/uapis-tools/mcp
Note:
To enable public network access, enable the public network CLB in the instance's Basic Information > Network Configuration.
Note:
Before accessing, confirm that the backend MCP endpoint itself is available. You can directly make calls to uapis.cn:
These two commands require no gateway, no API Key, and no registration. The complete call chain of the MCP JSON-RPC 2.0 protocol can be verified within 5 seconds.

# Get the Tool List
curl -s -X POST https://uapis.cn/mcp \\
-H "Content-Type: application/json" \\
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}' \\
| python3 -c "import sys,json;d=json.load(sys.stdin);print(f'Tool count: {len(d[\\"result\\"][\\"tools\\"])}')"

# Expected Output: Tool Count
2. Verify tools/list.
curl -X POST http://<gateway_IP>/mcpservers/uapis-tools/mcp \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer <API_KEY>" \\
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
Expected response (about 109 tools):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{"name": "post_convert_json", "description": "JSON formatting tool..."},
{"name": "get_convert_unixtime", "description": "Unix timestamp conversion..."},
{"name": "get_daily_news_image", "description": "Daily news image..."},
{"name": "get_daily_word", "description": "Daily English word..."},
{"name": "get_dictionary_lookup", "description": "Dictionary lookup..."}
...
]
}
}
3. Verify tools/call.
curl -X POST http://<gateway_IP>/mcpservers/uapis-tools/mcp \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer <API_KEY>" \\
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"get_daily_word","arguments":{}},"id":2}'
Expected response (returns real data):
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [{
"type": "text",
"text": "{\\"date\\":\\"2026-08-10\\",\\"words\\":[{\\"word\\":\\"initiative\\",\\"translation\\":\\"n. initiative, pioneering spirit, right of initiative\\",\\"definition\\":\\"n readiness to embark on bold new ventures\\",\\"examples\\":[{\\"text\\":\\"Local businesses are teaming up for a charity initiative.\\",\\"translation\\":\\"Local businesses are teaming up for a charity initiative.\\"}]}]}"
}]
}
}




Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan