Skip to content

MCP Servers API Reference

This page documents the API endpoints for managing MCP servers.

Base URL

https://api.universalapi.co

Authentication

All management endpoints require authentication via headers:

X-Uni-UserId: your-user-id
X-Uni-SecretUniversalKey: your-secret-key

Endpoints

List MCP Servers

http
GET /mcp-server/list

Response:

json
{
  "success": true,
  "data": {
    "servers": [
      {
        "serverId": "my-server-id",
        "serverName": "My Tools",
        "description": "Custom tools for my workflow",
        "visibility": "private",
        "status": "active",
        "userId": "user-id",
        "version": "1.0.0",
        "endpointUrl": "https://api.universalapi.co/mcp/my-server-id",
        "createdAt": 1736734800000,
        "updatedAt": 1736734800000
      }
    ],
    "count": 1
  }
}

Get MCP Server

http
GET /mcp-server/{serverId}

Response:

json
{
  "success": true,
  "data": {
    "serverId": "my-server-id",
    "serverName": "My Tools",
    "description": "Custom tools for my workflow",
    "visibility": "private",
    "status": "active",
    "userId": "user-id",
    "userAlias": "username",
    "version": "1.0.0",
    "runtime": "nodejs20.x",
    "memoryMb": 512,
    "timeoutSec": 60,
    "endpointUrl": "https://api.universalapi.co/mcp/my-server-id",
    "sourceCode": "const { McpServer } = require(...)...",
    "createdAt": 1736734800000,
    "updatedAt": 1736734800000
  }
}

Create MCP Server

http
POST /mcp-server/create

Request Body:

json
{
  "serverName": "My Tools",
  "description": "Custom tools for my workflow",
  "visibility": "private",
  "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 };",
  "memoryMb": 512,
  "timeoutSec": 60
}

Required Fields:

FieldTypeDescription
serverNamestringDisplay name for the server
descriptionstringWhat the server does
sourceCodestringNode.js code with createMcpServer()

Optional Fields:

FieldTypeDefaultDescription
visibilitystringprivatepublic or private
memoryMbnumber512Memory allocation (128-1024)
timeoutSecnumber60Timeout in seconds (1-300)

Response:

json
{
  "success": true,
  "data": {
    "serverId": "generated-server-id",
    "serverName": "My Tools",
    "endpointUrl": "https://api.universalapi.co/mcp/generated-server-id",
    "message": "MCP server created successfully"
  }
}

Update MCP Server

http
PUT /mcp-server/update

Request Body:

json
{
  "serverId": "my-server-id",
  "serverName": "Updated Tools",
  "description": "Updated description",
  "sourceCode": "// updated code...",
  "visibility": "public"
}

Required Fields:

FieldTypeDescription
serverIdstringID of server to update

All other fields are optional and only update if provided.

Response:

json
{
  "success": true,
  "data": {
    "serverId": "my-server-id",
    "message": "MCP server updated successfully"
  }
}

Delete MCP Server

http
DELETE /mcp-server/delete

Request Body:

json
{
  "serverId": "my-server-id"
}

Response:

json
{
  "success": true,
  "data": {
    "serverId": "my-server-id",
    "message": "MCP server deleted successfully"
  }
}

MCP Protocol Endpoint

The MCP runtime endpoint handles JSON-RPC 2.0 requests:

http
POST /mcp/{serverId}

This endpoint does not require Universal API authentication - it handles MCP protocol messages directly.

Initialize

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2024-11-05",
    "capabilities": {},
    "clientInfo": {
      "name": "client-name",
      "version": "1.0.0"
    }
  }
}

List Tools

json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/list",
  "params": {}
}

Call Tool

json
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "tool_name",
    "arguments": {
      "param1": "value1"
    }
  }
}

Error Responses

json
{
  "success": false,
  "error": {
    "code": "MCP_SERVER_NOT_FOUND",
    "message": "The requested MCP server does not exist",
    "timestamp": "2025-01-13T12:00:00.000Z"
  }
}

Error Codes:

CodeDescription
MCP_SERVER_NOT_FOUNDServer ID doesn't exist
MCP_SERVER_EXECUTION_ERRORError executing server code
INVALID_SOURCE_CODESource code is malformed
AUTHENTICATION_REQUIREDMissing or invalid credentials
PERMISSION_DENIEDNot authorized to access server

Example: Full Workflow

bash
# 1. Create server
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": "weather-tools",
    "description": "Weather lookup tools",
    "sourceCode": "..."
  }'

# 2. Test the MCP endpoint
curl -X POST "https://api.universalapi.co/mcp/weather-tools-abc123" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

# 3. List your servers
curl "https://api.universalapi.co/mcp-server/list" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY"

# 4. Update server
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": "weather-tools-abc123",
    "description": "Updated weather tools"
  }'

# 5. Delete server
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": "weather-tools-abc123"}'

Universal API - The agentic entry point to the universe of APIs