Skip to main content
POST
/
messages
POST /messages/
curl --request POST \
  --url https://api.example.com/messages/ \
  --header 'Authorization: Bearer <token>'

POST /messages/

Send JSON-RPC messages to the MCP server.

Endpoint

POST /messages/

Description

This endpoint receives JSON-RPC 2.0 messages for MCP protocol communication. Use it to list tools, call tools, and interact with the MCP server.

Request

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes

Body

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

Request Fields

FieldTypeRequiredDescription
jsonrpcstringYesMust be "2.0"
methodstringYesMCP method name
paramsobjectNoMethod parameters
idinteger/stringYesRequest ID

Supported Methods

MethodDescription
initializeInitialize MCP session
tools/listList available tools
tools/callExecute a tool

Response

Success Response (200 OK)

tools/list Response

{
  "jsonrpc": "2.0",
  "result": {
    "tools": [
      {
        "name": "search",
        "description": "Search for information",
        "inputSchema": {
          "type": "object",
          "properties": {
            "query": {
              "type": "string",
              "description": "Search query"
            }
          },
          "required": ["query"]
        }
      }
    ]
  },
  "id": 1
}

tools/call Response

{
  "jsonrpc": "2.0",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "Results for: AI news"
      }
    ]
  },
  "id": 2
}

Example

List Tools

curl -X POST http://localhost:8080/messages/ \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/list",
    "id": 1
  }'

Call a Tool

curl -X POST http://localhost:8080/messages/ \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "search",
      "arguments": {"query": "AI news"}
    },
    "id": 2
  }'

Python

import requests

# List tools
response = requests.post(
    "http://localhost:8080/messages/",
    json={
        "jsonrpc": "2.0",
        "method": "tools/list",
        "id": 1
    }
)
tools = response.json()["result"]["tools"]

# Call a tool
response = requests.post(
    "http://localhost:8080/messages/",
    json={
        "jsonrpc": "2.0",
        "method": "tools/call",
        "params": {
            "name": "search",
            "arguments": {"query": "AI news"}
        },
        "id": 2
    }
)
result = response.json()["result"]

Error Responses

JSON-RPC Error

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "Method not found"
  },
  "id": 1
}
CodeMessageDescription
-32700Parse errorInvalid JSON
-32600Invalid RequestInvalid JSON-RPC
-32601Method not foundUnknown method
-32602Invalid paramsInvalid parameters
-32603Internal errorServer error

See Also