musashi-mcp

musashi-mcp

Exposes Musashi market intelligence as MCP tools for clients like Claude and ChatGPT, enabling text analysis, arbitrage detection, market movers, wallet activity, and smart money tracking.

Category
访问服务器

README

musashi-mcp

musashi-mcp exposes Musashi market intelligence as MCP tools for clients such as Claude and ChatGPT.

It connects to musashi-api and makes these capabilities available over MCP:

  • analyze_text
  • get_arbitrage
  • get_movers
  • ground_probability
  • get_feed
  • get_feed_stats
  • get_feed_accounts
  • get_wallet_activity
  • get_wallet_positions
  • get_market_wallet_flow
  • get_smart_money_markets
  • get_market_brief
  • explain_market_move
  • get_health

Wallet and market context tool status:

  • get_wallet_activity, get_wallet_positions, get_market_wallet_flow, and get_smart_money_markets are backed by musashi-api endpoints.
  • get_market_brief and explain_market_move compose existing musashi-api primitives without direct market-source calls.

Quick start

Hosted server

Production MCP endpoint:

https://musashi-production.up.railway.app/mcp

OAuth discovery endpoint:

https://musashi-production.up.railway.app/.well-known/oauth-authorization-server

OAuth dynamic client registration endpoint:

https://musashi-production.up.railway.app/oauth/register

To authorize access, the server expects a valid mcp_sk_... key from MCP_API_KEYS or MUSASHI_MCP_API_KEY.

Connect from Claude

If your Claude account supports custom MCP connectors:

  1. Open Claude MCP or connector settings.
  2. Add a custom MCP server.
  3. Use this server URL:
https://musashi-production.up.railway.app/mcp
  1. Choose OAuth if prompted.
  2. Complete the Musashi authorization form with a valid mcp_sk_... key.

Connect from ChatGPT

If ChatGPT Apps or Developer Mode is enabled for your account:

  1. Open Settings -> Apps.
  2. Create a new custom app.
  3. Set MCP Server URL to:
https://musashi-production.up.railway.app/mcp
  1. Leave authentication as OAuth.
  2. If ChatGPT uses automatic registration, continue with the discovered OAuth settings.
  3. If ChatGPT asks for manual client credentials, use a client created via the registration endpoint above.
  4. Complete the Musashi authorization form with a valid mcp_sk_... key.

If the connection succeeds, ChatGPT should be able to discover and call Musashi tools from chat.

Example prompts

Once the app is connected, these are good smoke tests:

  • Use the Musashi app to get health status.
  • Use the Musashi app to get feed statistics.
  • Use the Musashi app to list tracked feed accounts.
  • Use the Musashi app to show market movers with a minimum change of 0.03.
  • Use the Musashi app to analyze this text: Bitcoin will be above 150k by the end of 2026.
  • Use the Musashi app to show wallet activity for 0x...
  • Use the Musashi app to show open positions for 0x...
  • Use the Musashi app to explain wallet flow for this market: ...
  • Use the Musashi app to find smart money markets in crypto.
  • Use the Musashi app to get a market brief for BTC 100k.
  • Use the Musashi app to explain why this market moved: BTC 100k.

Local development

Requirements

  • Node.js >=18
  • pnpm
  • a reachable musashi-api instance

Install dependencies:

pnpm install

Available scripts

  • pnpm build: compile the server to dist/
  • pnpm dev: run stdio transport locally
  • pnpm dev:http: run the streamable HTTP transport locally
  • pnpm test: build the server and run local smoke tests
  • pnpm start: run the compiled stdio server from dist/
  • pnpm start:http: run the compiled HTTP server from dist/
  • pnpm watch: run TypeScript in watch mode
  • pnpm clean: remove dist/

Environment variables

  • MUSASHI_API_BASE_URL: Musashi API base URL
  • PORT: HTTP port when running with --transport=http
  • MUSASHI_MCP_PUBLIC_BASE_URL: optional public MCP server base URL for OAuth metadata
  • MUSASHI_MCP_API_KEY: optional single valid MCP API key
  • MCP_API_KEYS: optional comma-separated list of valid MCP API keys
  • MCP_OAUTH_TOKEN_SECRET: required in production — secret for signing OAuth access tokens; without it, a random secret is generated at startup and all tokens are invalidated on every server restart
  • UPSTASH_REDIS_REST_URL: required in production — Upstash Redis REST URL for shared OAuth state
  • UPSTASH_REDIS_REST_TOKEN: required in production — Upstash Redis REST token
  • MCP_RATE_LIMIT_PER_MINUTE: message rate limit per authenticated principal (default: 60)
  • MCP_RATE_LIMIT_PER_HOUR: hourly backstop per authenticated principal (default: 1000)

Production requirements (HTTP transport, Railway or NODE_ENV=production):

UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN, and MCP_OAUTH_TOKEN_SECRET must all be set or the server exits with code 1 at startup. Without shared KV, registered OAuth clients and auth codes are process-local and lost on every restart, breaking GPT/Claude reconnects.

Token lifecycle:

  • Access tokens expire after 1 hour.
  • Refresh tokens expire after 30 days. When a refresh token is used, it is rotated — the old token is consumed and a new token is issued. If a consumed token is replayed, the entire token family is revoked and the user must re-authenticate.
  • When the refresh token expires, the user must complete the OAuth flow again.

Example local values:

MUSASHI_API_BASE_URL=http://127.0.0.1:3000
PORT=3030
MUSASHI_MCP_PUBLIC_BASE_URL=https://your-mcp-server.example.com
MUSASHI_MCP_API_KEY=mcp_sk_your_key_here

For local wallet tools, MUSASHI_API_BASE_URL must point at a musashi-api server that has /api/wallet/activity and /api/wallet/positions available.

Run over stdio

MUSASHI_API_BASE_URL=http://127.0.0.1:3000 pnpm dev

Use this when your MCP client launches the server process directly.

Run over HTTP

MUSASHI_API_BASE_URL=http://127.0.0.1:3000 PORT=3030 pnpm dev:http

Useful local endpoints:

  • GET /health
  • GET /.well-known/oauth-authorization-server
  • GET /oauth/authorize
  • POST /oauth/authorize
  • POST /oauth/token
  • POST /mcp
  • GET /mcp
  • DELETE /mcp

Basic checks

Build:

pnpm build

Smoke tests:

pnpm test

Manual health check:

curl http://127.0.0.1:3030/health

Manual OAuth discovery check:

curl http://127.0.0.1:3030/.well-known/oauth-authorization-server

Manual OAuth verification:

BASE=http://127.0.0.1:3030

# 1. Register a public client
CLIENT_JSON=$(curl -s -X POST "${BASE}/oauth/register" \
  -H 'Content-Type: application/json' \
  -d '{"redirect_uris":["http://127.0.0.1/callback"]}')
CLIENT_ID=$(node -e "console.log(JSON.parse(process.argv[1]).client_id)" -- "${CLIENT_JSON}")

# 2. Generate a PKCE S256 verifier and challenge
VERIFIER=$(node -e "console.log(require('crypto').randomBytes(32).toString('base64url'))")
CHALLENGE=$(node -e \
  "const c=require('crypto');process.stdout.write(c.createHash('sha256').update(process.argv[1]).digest('base64url'))" \
  -- "${VERIFIER}")

# 3. Open the authorization URL in a browser and submit a valid mcp_sk_... key
# code_challenge_method is S256 by default and may be omitted
echo "${BASE}/oauth/authorize?client_id=${CLIENT_ID}&redirect_uri=http://127.0.0.1/callback&state=test-state&code_challenge=${CHALLENGE}"

# 4. After submitting the key, the browser redirects to:
#    http://127.0.0.1/callback?code=AUTH_CODE&state=test-state
#    Copy the code value from the URL, then run:
read -rp "Paste auth code: " AUTH_CODE
curl -s -X POST "${BASE}/oauth/token" \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d "grant_type=authorization_code&code=${AUTH_CODE}&client_id=${CLIENT_ID}&redirect_uri=http://127.0.0.1/callback&code_verifier=${VERIFIER}"

Notes

  • Breaking release: this version invalidates all existing OAuth sessions and registered connector state. GPT/Claude users must reconnect once after deployment. There is no migration path.
  • OAuth PKCE: only S256 is supported. All clients are public (token_endpoint_auth_method: none) and must provide code_challenge; omitting it returns a 400 invalid_request. code_challenge_method may be omitted (defaults to S256) or set to S256 explicitly; any other value is rejected. client_secret_post is not supported.
  • Production requires shared KV (UPSTASH_REDIS_REST_URL + UPSTASH_REDIS_REST_TOKEN). Without it, registered OAuth clients and auth codes are per-process and lost on every restart. The in-memory store is for local development only.
  • Set MCP_OAUTH_TOKEN_SECRET to a stable value in production. Without it, all OAuth tokens are invalidated on every server restart.
  • Session continuity: once the KV store is configured and the server is deployed, connector registrations and sessions survive service restarts. Users only need to reconnect once when first deploying this version.
  • pnpm test is a smoke suite, not a full MCP interoperability suite.
  • Behavior depends on a healthy and reachable musashi-api.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选