Skip to main content

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. The local server runs via legend-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

Verify with /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:
Each team member runs legend-cli login once to authenticate with their own account.

Remote MCP Server

The remote server at https://prime-api.legend.xyz/mcp is best for read-only operations or when you don’t need local signing.
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

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

This generates a P256 key in macOS Keychain, creates a Turnkey-backed sub-account, and saves the key reference to your profile.

Sign Plan Digests (remote MCP only)

When using the remote MCP server, the agent creates a plan via MCP and gets back a digest. 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