Quickstart

Get started with MCPRouter.

MCPRouter provides cloud-based MCP Servers that can be used in any MCP Client application without installing.

For personal use

You can use any number of MCP Servers hosted on MCPRouter Cloud with only an API Key.

Create API Key

  1. Go to the API Keys page.
  2. Click the "Create API Key" button.
  3. Enter a name for the API key.
  4. Click the "Create" button.
  5. Copy the API Key you created.

Use MCP Server

  1. Go to the Servers page.
  2. Choose a MCP Server you want to use and get into the MCP Server page.
  3. Click the "Config" tab.
  4. Choose a MCP Client application you favorite.
  5. Copy the configuration and paste it into the MCP Client application.

for example, use Time MCP Server in Cursor, the configuration is as follows:

{
  "mcpServers": {
    "time": {
      "url": "https://mcprouter.to/time",
      "headers": {
        "Authorization": "Bearer <MCPROUTER_API_KEY>",
        "HTTP-Referer": "https://www.cursor.com/",
        "X-Title": "Cursor"
      }
    }
  }
}
  • replace <MCPROUTER_API_KEY> with the API Key you created.

For chatbots / agents development

You can quickly build a MCP marketplace into your chatbot / agent application, integrate massive tools provided by MCP servers with only an API Key.

Create API Key

  1. Go to the API Keys page.
  2. Click the "Create API Key" button.
  3. Enter a name for the API key.
  4. Click the "Create" button.
  5. Copy the API Key you created.

List MCP Servers

Request API to list MCP Servers hosted on MCPRouter Cloud.

curl -X POST https://api.mcprouter.to/v1/list-servers \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <MCPROUTER_API_KEY>" \
  -H "HTTP-Referer: <YOUR_APP_URL>" \
  -H "X-Title: <YOUR_APP_NAME>" \
  -d '{
    "page": 1,
    "limit": 10
  }'    
const response = await fetch("https://api.mcprouter.to/v1/list-servers', {
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <MCPROUTER_API_KEY>",
    "HTTP-Referer": "<YOUR_APP_URL>",
    "X-Title": "<YOUR_APP_NAME>"
  },
  body: JSON.stringify({
    page: 1,
    limit: 10
  })
})
if (!response.ok) {
  throw new Error("request failed with status " + response.status);
}

const { code, message, data } = await response.json();
if (code !== 0) {
  throw new Error(message);
}

const { servers } = data;
console.log("servers:", servers);
import requests
import json

response = requests.post("https://api.mcprouter.to/v1/list-servers", 
    headers={
        "Content-Type": "application/json",
        "Authorization": "Bearer <MCPROUTER_API_KEY>",
        "HTTP-Referer": "<YOUR_APP_URL>",
        "X-Title": "<YOUR_APP_NAME>"
    }, 
    json={
        "page": 1, 
        "limit": 10
    }
)
if response.status_code != 200:
  raise Exception(response.text)

result = response.json()
if result["code"] != 0:
  raise Exception(result["message"])

servers = result["data"]["servers"]
print("servers:", servers)
  • MCPROUTER_API_KEY: The API Key you created or let user input their own API Key.
  • YOUR_APP_URL: The URL of your application, for example: https://chatmcp.ai/.
  • YOUR_APP_NAME: The name of your application, for example: ChatMCP.

Check the List Servers API for more details.

Get MCP Server Information

Request API to get the MCP Server information when the user chooses a server from the MCP marketplace.

  • use server_key get from the response of List Servers API as the server parameter.
curl -X POST https://api.mcprouter.to/v1/get-server \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <MCPROUTER_API_KEY>" \
  -H "HTTP-Referer: <YOUR_APP_URL>" \
  -H "X-Title: <YOUR_APP_NAME>" \
  -d '{
    "server": "time"
  }'    
const response = await fetch("https://api.mcprouter.to/v1/get-server', {
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <MCPROUTER_API_KEY>",
    "HTTP-Referer": "<YOUR_APP_URL>",
    "X-Title": "<YOUR_APP_NAME>"
  },
  body: JSON.stringify({
    server: "time"
  })
})
if (!response.ok) {
  throw new Error("request failed with status " + response.status);
}

const { code, message, data } = await response.json();
if (code !== 0) {
  throw new Error(message);
}

console.log("server:", data);
import requests
import json

response = requests.post("https://api.mcprouter.to/v1/get-server", 
    headers={
        "Content-Type": "application/json",
        "Authorization": "Bearer <MCPROUTER_API_KEY>",
        "HTTP-Referer": "<YOUR_APP_URL>",
        "X-Title": "<YOUR_APP_NAME>"
    }, 
    json={
        "server": "time"
    }
)
if response.status_code != 200:
  raise Exception(response.text)

result = response.json()
if result["code"] != 0:
  raise Exception(result["message"])

server = result["data"]
print("server:", server)

Check the Get Server API for more details.

Configure MCP Server

Automatically configure the MCP server when the user chooses a server installation from the MCP marketplace.

The server information is obtained by the Get Server API.

  • use config_name as the key of the MCP server config.
  • use server_url as the url of the MCP server config.

The configuration is as follows:

{
  "mcpServers": {
    "time": {
      "url": "https://mcprouter.to/time",
      "headers": {
        "Authorization": "Bearer <MCPROUTER_API_KEY>",
        "HTTP-Referer": "<YOUR_APP_URL>",
        "X-Title": "<YOUR_APP_NAME>"
      }
    }
  }
}

List Tools

Use MCP official SDK to list tools for a MCP server.

  • use server_url of the MCP server to create StreamableHTTP Client.
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const serverUrl = "https://mcprouter.to/time";
const headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <MCPROUTER_API_KEY>",
    "HTTP-Referer": "<YOUR_APP_URL>",
    "X-Title": "<YOUR_APP_NAME>",
};

const client = new Client({
    name: "mcp-client",
    version: "1.0.0",
});

const transport = new StreamableHTTPClientTransport(new URL(serverUrl), {
    requestInit: {
        headers,
    },
});
await client.connect(transport);

const { tools } = await client.listTools();
console.log("tools", tools);
import mcp
from mcp.client.streamable_http import streamablehttp_client

serverUrl = "https://mcprouter.to/time"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <MCPROUTER_API_KEY>",
    "HTTP-Referer": "<YOUR_APP_URL>",
    "X-Title": "<YOUR_APP_NAME>",
}

async def main():
    async with streamablehttp_client(serverUrl, headers=headers) as (read_stream, write_stream, _):
        async with mcp.ClientSession(read_stream, write_stream) as session:
            await session.initialize()
            result = await session.list_tools()
            print(f"tools: {result.tools}")

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Or you can request the List Tools API directly to get the tools of a MCP server.

curl -X POST https://api.mcprouter.to/v1/list-tools \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <MCPROUTER_API_KEY>" \
  -H "HTTP-Referer: <YOUR_APP_URL>" \
  -H "X-Title: <YOUR_APP_NAME>" \
  -d '{
    "server": "time"
  }'    
const response = await fetch("https://api.mcprouter.to/v1/list-tools", {
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <MCPROUTER_API_KEY>",
    "HTTP-Referer": "<YOUR_APP_URL>",
    "X-Title": "<YOUR_APP_NAME>"
  },
  body: JSON.stringify({
    server: "time"
  })
})
if (!response.ok) {
  throw new Error("request failed with status " + response.status);
}

const { code, message, data } = await response.json();
if (code !== 0) {
  throw new Error(message);
}

const { tools } = data;
console.log("tools", tools);
import requests
import json

response = requests.post("https://api.mcprouter.to/v1/list-tools", 
    headers={
        "Content-Type": "application/json",   
        "Authorization": "Bearer <MCPROUTER_API_KEY>",
        "HTTP-Referer": "<YOUR_APP_URL>",
        "X-Title": "<YOUR_APP_NAME>"
    },
    json={
        "server": "time"
    }
)
if response.status_code != 200:
  raise Exception(response.text)

result = response.json()
if result["code"] != 0:
  raise Exception(result["message"])

tools = result["data"]["tools"]
print("tools", tools)

Call Tool

Use MCP official SDK to call a tool.

  • use server_url of the MCP server to create StreamableHTTP Client.
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const serverUrl = "https://mcprouter.to/time";
const headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <MCPROUTER_API_KEY>",
    "HTTP-Referer": "<YOUR_APP_URL>",
    "X-Title": "<YOUR_APP_NAME>",
};

const client = new Client({
    name: "mcp-client",
    version: "1.0.0",
});

const transport = new StreamableHTTPClientTransport(new URL(serverUrl), {
    requestInit: {
        headers,
    },
});
await client.connect(transport);

const result = await client.callTool({
    name: "time",
    arguments: {
        timezone: "Asia/Tokyo"
    }
});
console.log("result", result);
import mcp
from mcp.client.streamable_http import streamablehttp_client

serverUrl = "https://mcprouter.to/time"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <MCPROUTER_API_KEY>",
    "HTTP-Referer": "<YOUR_APP_URL>",
    "X-Title": "<YOUR_APP_NAME>",
}

async def main():
    async with streamablehttp_client(serverUrl, headers=headers) as (read_stream, write_stream, _):
        async with mcp.ClientSession(read_stream, write_stream) as session:
            await session.initialize()
            result = await session.call_tool("time", {"timezone": "Asia/Tokyo"})
            print(f"result: {result}")

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Or you can request the Call Tool API directly to call a tool.

curl -X POST https://api.mcprouter.to/v1/call-tool \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <MCPROUTER_API_KEY>" \
  -H "HTTP-Referer: <YOUR_APP_URL>" \
  -H "X-Title: <YOUR_APP_NAME>" \
  -d '{
    "server": "time",
    "name": "get_current_time",
    "arguments": {
      "timezone": "Asia/Tokyo"
    }
  }'    
const response = await fetch("https://api.mcprouter.to/v1/call-tool", {
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <MCPROUTER_API_KEY>",
    "HTTP-Referer": "<YOUR_APP_URL>",
    "X-Title": "<YOUR_APP_NAME>"
  },
  body: JSON.stringify({
    server: "time",
    name: "get_current_time",
    arguments: {
      timezone: "Asia/Tokyo"
    }
  })
})
if (!response.ok) {
  throw new Error("request failed with status " + response.status);
}

const { code, message, data } = await response.json();
if (code !== 0) {
  throw new Error(message);
}

console.log("result", data);
import requests
import json

response = requests.post("https://api.mcprouter.to/v1/call-tool", 
    headers={
        "Content-Type": "application/json",
        "Authorization": "Bearer <MCPROUTER_API_KEY>",
        "HTTP-Referer": "<YOUR_APP_URL>",
        "X-Title": "<YOUR_APP_NAME>"
    },
    json={
        "server": "time",
        "name": "get_current_time",
        "arguments": {
            "timezone": "Asia/Tokyo"
        }
    }
)
if response.status_code != 200:
  raise Exception(response.text)

result = response.json()
if result["code"] != 0:
  raise Exception(result["message"])

print("result", result["data"])

Good to know

  • Create API Key in API Keys page.
  • Choose MCP Server to use in Servers page.
  • Check out Tool Call activities in Activity page.

References