Skip to main content

Install the MCP server

The OneSource REST API ships with an official MCP (Model Context Protocol) server. Any MCP-compatible AI assistant (Claude Code, Claude Desktop, Cursor, Windsurf) can call OneSource endpoints with natural language. The server runs locally via npx, authenticates with your API key, and exposes 30 tools for balances, NFTs, transactions, events, contracts, and chain utilities.

Prerequisites

Client-specific setup

Any MCP client (generic stdio)

For any MCP-compatible client not listed above, the server runs over stdio by default:

ONESOURCE_API_KEY=sk_… npx -y @one-source/mcp@latest

Or, as a JSON configuration block:

{
"command": "npx",
"args": ["-y", "@one-source/mcp@latest"],
"env": { "ONESOURCE_API_KEY": "sk_…" }
}

The server communicates over stdin/stdout. Diagnostics go to stderr; most clients capture them separately.

Self-hosted HTTP transport

If you want to run the MCP server as a long-lived HTTP service (multiple agents share a single instance, or you want to expose it over your network):

ONESOURCE_API_KEY=sk_… npx -y @one-source/mcp@latest --http --port=3000

Point MCP clients at http://localhost:3000/mcp.

Endpoints:

EndpointMethodDescription
/mcpPOSTMCP protocol handler
/healthGETReturns server status, version, and tool count
*OPTIONSCORS preflight (allows cross-origin requests)

Health check:

curl http://localhost:3000/health

Port priority: PORT env var (used by hosting platforms like Railway and Fly.io) → --port flag → default 3000.

Verify

After your assistant restarts, ask it: "Call 1s_setup_check." A healthy install reports Status: Configured (API key). If it reports "Not configured," double-check the env var and reload the client.

Next