Add nansen mcp install/verify for local MCP clients (Cursor first) - #511
Add nansen mcp install/verify for local MCP clients (Cursor first)#511gulshngill wants to merge 1 commit into
Conversation
`nansen mcp install cursor` merges a native url+headers Nansen entry into ~/.cursor/mcp.json using the saved login key (or --api-key), preserves other configured servers, refuses to clobber invalid JSON, and chmods the file to 0600 since it embeds a credential. `nansen mcp verify cursor` proves the endpoint with a streamable-HTTP initialize handshake, then validates the configured key with a credit-free account check — necessary because the MCP server accepts initialize and tools/list unauthenticated, so a handshake alone never proves auth. --config-path overrides the client default for workspace configs and tests. Verified live against mcp.nansen.ai: happy path (transport ok, auth ok), invalid-key path (INVALID_API_KEY with resolution steps, exit 1). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pr-reviewer Summary for #19b9ecb📝 1 finding Review completed. Please address the findings below. Findings by Severity
Review effort: 3/5 (Moderate) SummaryThis is a well-structured addition of Findings
|
|
Closing as a duplicate: this was opened without checking the existing in-flight MCP stack, which is more complete and pre-dates it — #487 ( |
What
Adds a real one-command MCP setup to the CLI — the command the docs always wanted to exist (see nansen-api#1803, API-317):
nansen mcp install cursormerges a nativeurl+headersNansen entry into~/.cursor/mcp.json(or--config-path), using the saved login key,NANSEN_API_KEY, or--api-key. It preserves other configured servers, refuses to clobber a file that isn't valid JSON, and chmods the file to0600since it embeds a credential.nansen mcp verify cursorproves the setup in two steps: a streamable-HTTPinitializehandshake against the configured URL (transport), then a credit-free account check with the configured key (auth). The second step exists because the MCP server acceptsinitializeandtools/listunauthenticated — a handshake alone never proves the key works.The client registry is a map, so adding e.g.
claude-desktoplater is one entry.Why
API-317 flagged that the documented Cursor "one-click" deep link shipped a placeholder key inside an opaque base64 payload. nansen-api#1803 replaces it with copy-paste JSON; this PR gives users the actual one-command path and a machine-checkable verify step.
Testing
src/__tests__/mcp.test.js); full suite passes (2115 passed, 2 skipped), eslint clean.mcp.nansen.ai:transport: ok,auth: ok, servernansen-mcp 3.2.4, exit 0INVALID_API_KEY+ resolution steps, exit 10600permissions confirmed on diskFollow-up
Once released, nansen-api's
gitbook/mcp/connecting.mdCursor section can add these commands back (they were removed from #1803 because they didn't exist yet). README here already documents them.🤖 Generated with Claude Code