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.
- Package:
@one-source/mcp - Source: https://github.com/blockparty-global/1s-mcp
Prerequisites
- Node.js 18+
- A OneSource API key: either from your OneSource subscription (keys start with
sk_) or an Ethereum private key for x402 wallet-paid access.
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:
| Endpoint | Method | Description |
|---|---|---|
/mcp | POST | MCP protocol handler |
/health | GET | Returns server status, version, and tool count |
* | OPTIONS | CORS 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
- Configure-by-client guides
- Configuration reference: full env-var and transport-mode reference
- Tool reference: what each of the 30 tools does