MCP Setup
Legend’s MCP server works with any MCP-compatible agent host: Claude Code, Cursor, OpenAI Responses API, and others. Legend offers two servers: a local server (recommended) that runs on your machine with full signing capabilities, and a remote server for read-only or shared access.Local MCP Server (recommended)
The local server runs vialegend-cli mcp serve and includes all tools plus plan_and_execute — create, sign, and execute in one tool call. No separate signing step.
Install and authenticate
Connect to your agent host
- Claude Code
- Cursor
- Any MCP host
/mcp — you should see “legend” with a green status and tools like list_accounts, get_portfolio, plan_and_execute.Team Projects (.mcp.json)
Share the local MCP config with your team by committing a .mcp.json at the project root:
legend-cli login once to authenticate with their own account.
Remote MCP Server
The remote server athttps://prime-api.legend.xyz/mcp is best for read-only operations or when you don’t need local signing.
- Claude Code (OAuth)
- Claude Code (Query Key)
- Cursor
- OpenAI Responses API
No API key needed — authenticate with your Google account.Then in Claude Code:Select “legend-remote” > “Authenticate” > sign in with Google. A Prime Account is created automatically if you don’t have one.
Local vs Remote: When to Use Which
| Local MCP | Remote MCP | |
|---|---|---|
| Signing | Built-in — plan_and_execute does everything | Requires separate CLI call for signing |
| Auth | legend-cli login (Google SSO, 30-day JWT) | OAuth or query key |
| Setup | Install CLI + register server | Just register server URL |
| Team sharing | Each person runs their own | Shared via query key |
| Best for | Agents that execute transactions | Read-only dashboards, shared team access |
Setting Up Signing
To execute plans (move funds), you need a P256 signing key. Read-only operations work without it.With Local MCP (easiest)
Ask your agent:“Create a new Legend account with keygen”The
create_account tool generates a P256 key in macOS Keychain and creates the account in one step. Then plan_and_execute handles signing automatically on every subsequent call.
With CLI
Sign Plan Digests (remote MCP only)
When using the remote MCP server, the agent creates a plan via MCP and gets back adigest. To execute:
Agent System Prompt Snippet
Add this context to your agent’s system prompt or project instructions file (CLAUDE.md, AGENTS.md, etc.) so it uses Legend tools correctly:
Troubleshooting
| Issue | Fix |
|---|---|
| ”401 Unauthorized” | Run legend-cli login or check your query key |
| Tools not appearing | Check your agent host’s MCP status panel |
| ”Account not found” on tool call | Use list_accounts to get valid account IDs |
| Plan expired | Plans last 2 minutes — create a new one and execute promptly |
| ”No profile found” on sign | Run legend-cli login then legend-cli accounts create --keygen |
| Local MCP not connecting | Verify legend-cli mcp serve runs without errors in your terminal |