API ReferenceMCP Endpoints

MCP Endpoints

Complete reference for all MCP protocol endpoints with multi-language SDK examples.

Endpoint URL

POST https://your-domain.com/api/platform/{serverId}/mcp

All MCP methods use the same POST endpoint with different method values in the request body.

Available SDKs

The Model Context Protocol provides official SDKs for multiple languages:

LanguagePackageRepository
cURLBuilt-inCommand line
TypeScript@modelcontextprotocol/sdkGitHub
PythonmcpGitHub
Gogo-sdkGitHub
Kotlinkotlin-sdkGitHub
Javajava-sdkGitHub
C#csharp-sdkGitHub
Rubyruby-sdkGitHub
Rustrust-sdkGitHub
PHPphp-sdkGitHub
Swiftswift-sdkGitHub

All examples below show how to call each endpoint using different languages and SDKs.

Initialize

Negotiate capabilities and protocol version with the server.

Request

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

Parameters:

FieldTypeRequiredDescription
protocolVersionstringYesMCP protocol version (e.g., “2024-11-05”)
clientInfoobjectYesClient identification
clientInfo.namestringYesClient name
clientInfo.versionstringYesClient version
capabilitiesobjectYesClient capabilities (can be empty)

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": "2024-11-05",
    "serverInfo": {
      "name": "My MCP Server",
      "version": "1.0.0"
    },
    "capabilities": {
      "tools": {},
      "resources": {},
      "prompts": {}
    }
  }
}

Result Fields:

FieldTypeDescription
protocolVersionstringProtocol version server supports
serverInfoobjectServer identification
serverInfo.namestringServer name (from MA²D config)
serverInfo.versionstringServer version (from MA²D config)
capabilitiesobjectWhat the server supports
capabilities.toolsobjectServer provides tools (if any exist)
capabilities.resourcesobjectServer provides resources (if any exist)
capabilities.promptsobjectServer provides prompts (if any exist)

Examples

curl -X POST https://ma2d.vercel.app/api/platform/abc123/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {
      "protocolVersion": "2024-11-05",
      "clientInfo": {
        "name": "test-client",
        "version": "1.0.0"
      },
      "capabilities": {}
    }
  }'

Tools/List

List all available tools provided by the server.

Request

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

Parameters: None required.

You can optionally include a params object with cursor for pagination (not currently implemented in MA²D).

Response

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "tools": [
      {
        "name": "get_weather",
        "description": "Get current weather for a city",
        "inputSchema": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string",
              "description": "City name"
            }
          },
          "required": ["city"]
        }
      }
    ]
  }
}

Result Fields:

FieldTypeDescription
toolsarrayList of available tools
tools[].namestringTool identifier (unique)
tools[].descriptionstringWhat the tool does
tools[].inputSchemaobjectJSON Schema for tool input

Input Schema: Standard JSON Schema (Draft 7) defining:

  • Parameter names and types
  • Descriptions for each parameter
  • Required vs optional parameters
  • Validation rules (min, max, pattern, etc.)

Examples

curl -X POST https://ma2d.vercel.app/api/platform/abc123/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/list"
  }'

Tools/Call

Execute a tool with the provided arguments.

Request

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "get_weather",
    "arguments": {
      "city": "San Francisco"
    }
  }
}

Parameters:

FieldTypeRequiredDescription
namestringYesTool name from tools/list
argumentsobjectNoTool-specific arguments (must match inputSchema)

Response

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"temperature\": 72, \"conditions\": \"Sunny\"}"
      }
    ]
  }
}

Result Fields:

FieldTypeDescription
contentarrayArray of content items
content[].typestringContent type (“text”, “image”, “resource”)
content[].textstringText content (for type=“text”)

Content Types:

MA²D currently supports text type. The text typically contains JSON-encoded data.

Error Response

If arguments are invalid:

{
  "jsonrpc": "2.0",
  "id": 3,
  "error": {
    "code": -32602,
    "message": "Invalid params: missing required field 'city'"
  }
}

If tool not found:

{
  "jsonrpc": "2.0",
  "id": 3,
  "error": {
    "code": -32601,
    "message": "Tool not found: get_weather"
  }
}

Mock Execution

MA²D executes mock scenarios based on condition matching:

Scenario Example:

{
  "condition": {
    "field": "city",
    "operator": "equals",
    "value": "San Francisco"
  },
  "response": {
    "temperature": 72,
    "conditions": "Sunny"
  }
}

Matching Logic:

  1. Find scenarios for the tool
  2. Evaluate conditions against arguments
  3. Return first matching scenario’s response
  4. If no match, return default response

Learn more about mock scenarios →

Examples

curl -X POST https://ma2d.vercel.app/api/platform/abc123/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "get_weather",
      "arguments": {
        "city": "San Francisco"
      }
    }
  }'

Resources/List

List all available resources provided by the server.

Request

{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "resources/list"
}

Parameters: None required.

Response

{
  "jsonrpc": "2.0",
  "id": 4,
  "result": {
    "resources": [
      {
        "uri": "weather://cities",
        "name": "Available Cities",
        "description": "List of cities with weather data",
        "mimeType": "application/json"
      }
    ]
  }
}

Result Fields:

FieldTypeDescription
resourcesarrayList of available resources
resources[].uristringUnique resource identifier
resources[].namestringHuman-readable name
resources[].descriptionstringWhat the resource contains
resources[].mimeTypestringContent type (optional)

Resource URIs: Follow custom scheme format:

  • weather://cities
  • docs://api/v1
  • data://users/{userId}

Examples

curl -X POST https://ma2d.vercel.app/api/platform/abc123/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 4,
    "method": "resources/list"
  }'

Resources/Read

Read the content of a specific resource.

Request

{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "resources/read",
  "params": {
    "uri": "weather://cities"
  }
}

Parameters:

FieldTypeRequiredDescription
uristringYesResource URI from resources/list

Response

{
  "jsonrpc": "2.0",
  "id": 5,
  "result": {
    "contents": [
      {
        "uri": "weather://cities",
        "mimeType": "application/json",
        "text": "[\"San Francisco\", \"New York\", \"London\"]"
      }
    ]
  }
}

Result Fields:

FieldTypeDescription
contentsarrayArray of content items
contents[].uristringResource URI
contents[].mimeTypestringContent type
contents[].textstringResource content (text/JSON)

Examples

curl -X POST https://ma2d.vercel.app/api/platform/abc123/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 5,
    "method": "resources/read",
    "params": {
      "uri": "weather://cities"
    }
  }'

Prompts/List

List all available prompt templates.

Request

{
  "jsonrpc": "2.0",
  "id": 6,
  "method": "prompts/list"
}

Parameters: None required.

Response

{
  "jsonrpc": "2.0",
  "id": 6,
  "result": {
    "prompts": [
      {
        "name": "weather_query",
        "description": "Template for weather queries",
        "arguments": [
          {
            "name": "location",
            "description": "Location to query",
            "required": true
          }
        ]
      }
    ]
  }
}

Result Fields:

FieldTypeDescription
promptsarrayList of available prompts
prompts[].namestringPrompt identifier
prompts[].descriptionstringWhat the prompt does
prompts[].argumentsarrayPrompt arguments
arguments[].namestringArgument name
arguments[].descriptionstringWhat the argument is for
arguments[].requiredbooleanWhether required

Examples

curl -X POST https://ma2d.vercel.app/api/platform/abc123/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 6,
    "method": "prompts/list"
  }'

Prompts/Get

Get a prompt template with arguments filled in.

Request

{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "prompts/get",
  "params": {
    "name": "weather_query",
    "arguments": {
      "location": "San Francisco"
    }
  }
}

Parameters:

FieldTypeRequiredDescription
namestringYesPrompt name from prompts/list
argumentsobjectNoArgument values

Response

{
  "jsonrpc": "2.0",
  "id": 7,
  "result": {
    "messages": [
      {
        "role": "user",
        "content": {
          "type": "text",
          "text": "What's the weather in San Francisco?"
        }
      }
    ]
  }
}

Result Fields:

FieldTypeDescription
messagesarrayArray of messages
messages[].rolestringMessage role (“user”, “assistant”)
messages[].contentobjectMessage content
content.typestringContent type (“text”)
content.textstringMessage text

Examples

curl -X POST https://ma2d.vercel.app/api/platform/abc123/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 7,
    "method": "prompts/get",
    "params": {
      "name": "weather_query",
      "arguments": {
        "location": "San Francisco"
      }
    }
  }'

Response Streaming

MA²D uses Server-Sent Events (SSE) for responses:

HTTP/1.1 200 OK
Content-Type: text/event-stream
Cache-Control: no-cache
Connection: keep-alive
 
data: {"jsonrpc":"2.0","id":1,"result":{...}}
 

Parsing SSE:

const response = await fetch(endpoint, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify(request)
})
 
const reader = response.body.getReader()
const decoder = new TextDecoder()
 
let buffer = ''
while (true) {
  const { done, value } = await reader.read()
  if (done) break
  
  buffer += decoder.decode(value, { stream: true })
  
  const lines = buffer.split('\n')
  buffer = lines.pop() // Keep incomplete line
  
  for (const line of lines) {
    if (line.startsWith('data: ')) {
      const data = JSON.parse(line.slice(6))
      console.log('Received:', data)
    }
  }
}

Next Steps


Protocol Version: 2024-11-05
Reference: MCP Specification