Appearance
MCP Servers API
API endpoints for managing MCP (Model Context Protocol) servers.
List MCP Servers
Get a list of your MCP servers.
http
GET /mcp-server/listExample:
bash
curl "https://api.universalapi.co/mcp-server/list" \
-H "X-Uni-UserId: $USER_ID" \
-H "X-Uni-SecretUniversalKey: $SECRET_KEY"Response:
json
{
"success": true,
"data": {
"servers": [
{
"serverId": "my-tools-abc123",
"serverName": "My Tools",
"description": "Custom MCP tools",
"visibility": "private",
"status": "active",
"endpointUrl": "https://api.universalapi.co/mcp/my-tools-abc123",
"createdAt": 1736734800000,
"updatedAt": 1736734800000
}
],
"count": 1
}
}Get MCP Server
Get details of a specific MCP server.
http
GET /mcp-server/{serverId}Example:
bash
curl "https://api.universalapi.co/mcp-server/my-tools-abc123" \
-H "X-Uni-UserId: $USER_ID" \
-H "X-Uni-SecretUniversalKey: $SECRET_KEY"Response:
json
{
"success": true,
"data": {
"serverId": "my-tools-abc123",
"serverName": "My Tools",
"description": "Custom MCP tools",
"visibility": "private",
"status": "active",
"version": "1.0.0",
"runtime": "nodejs20.x",
"memoryMb": 512,
"timeoutSec": 60,
"endpointUrl": "https://api.universalapi.co/mcp/my-tools-abc123",
"sourceCode": "const { McpServer } = require(...)...",
"createdAt": 1736734800000,
"updatedAt": 1736734800000
}
}Create MCP Server
Create a new MCP server.
http
POST /mcp-server/createRequired Fields:
| Field | Type | Description |
|---|---|---|
serverName | string | Display name |
description | string | What it does |
sourceCode | string | Node.js code with createMcpServer() |
Optional Fields:
| Field | Type | Default |
|---|---|---|
visibility | string | private |
memoryMb | number | 512 |
timeoutSec | number | 60 |
Example:
bash
curl -X POST "https://api.universalapi.co/mcp-server/create" \
-H "Content-Type: application/json" \
-H "X-Uni-UserId: $USER_ID" \
-H "X-Uni-SecretUniversalKey: $SECRET_KEY" \
-d '{
"serverName": "My Tools",
"description": "Custom MCP tools",
"sourceCode": "const { McpServer } = require(\"@modelcontextprotocol/sdk/server/mcp.js\");\nconst { z } = require(\"zod\");\n\nfunction createMcpServer() {\n const mcpServer = new McpServer({ name: \"my-tools\", version: \"1.0.0\" });\n mcpServer.registerTool(\"hello\", {\n title: \"Hello\",\n description: \"Says hello\",\n inputSchema: {}\n }, async () => ({ content: [{ type: \"text\", text: \"Hello!\" }] }));\n return mcpServer;\n}\n\nmodule.exports = { createMcpServer };"
}'Response:
json
{
"success": true,
"data": {
"serverId": "my-tools-abc123",
"serverName": "My Tools",
"endpointUrl": "https://api.universalapi.co/mcp/my-tools-abc123",
"message": "MCP server created successfully"
}
}Update MCP Server
Update an existing MCP server.
http
PUT /mcp-server/updateRequired:
serverId- ID of server to update
All other fields are optional.
Example:
bash
curl -X PUT "https://api.universalapi.co/mcp-server/update" \
-H "Content-Type: application/json" \
-H "X-Uni-UserId: $USER_ID" \
-H "X-Uni-SecretUniversalKey: $SECRET_KEY" \
-d '{
"serverId": "my-tools-abc123",
"description": "Updated description",
"sourceCode": "// updated code..."
}'Delete MCP Server
Delete an MCP server.
http
DELETE /mcp-server/deleteExample:
bash
curl -X DELETE "https://api.universalapi.co/mcp-server/delete" \
-H "Content-Type: application/json" \
-H "X-Uni-UserId: $USER_ID" \
-H "X-Uni-SecretUniversalKey: $SECRET_KEY" \
-d '{"serverId": "my-tools-abc123"}'MCP Protocol Endpoint
The MCP runtime endpoint handles JSON-RPC 2.0 messages.
http
POST /mcp/{serverId}This endpoint does not require Universal API authentication - it handles MCP protocol messages directly.
Initialize
bash
curl -X POST "https://api.universalapi.co/mcp/my-tools-abc123" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {"name": "test", "version": "1.0.0"}
}
}'List Tools
bash
curl -X POST "https://api.universalapi.co/mcp/my-tools-abc123" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list",
"params": {}
}'Response:
json
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"tools": [
{
"name": "hello",
"description": "Says hello",
"inputSchema": {
"type": "object",
"properties": {}
}
}
]
}
}Call Tool
bash
curl -X POST "https://api.universalapi.co/mcp/my-tools-abc123" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "hello",
"arguments": {}
}
}'Response:
json
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"content": [
{"type": "text", "text": "Hello!"}
]
}
}Built-in MCP Servers
| Server ID | Endpoint | Description |
|---|---|---|
echo-mcp-server | /mcp/echo-mcp-server | Echo and reverse tools |
universalapi-mcp-server | /mcp/universalapi-mcp-server | Action listing tools |