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.
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_textget_arbitrageget_moversground_probabilityget_feedget_feed_statsget_feed_accountsget_wallet_activityget_wallet_positionsget_market_wallet_flowget_smart_money_marketsget_market_briefexplain_market_moveget_health
Wallet and market context tool status:
get_wallet_activity,get_wallet_positions,get_market_wallet_flow, andget_smart_money_marketsare backed bymusashi-apiendpoints.get_market_briefandexplain_market_movecompose existingmusashi-apiprimitives 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:
- Open Claude MCP or connector settings.
- Add a custom MCP server.
- Use this server URL:
https://musashi-production.up.railway.app/mcp
- Choose
OAuthif prompted. - 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:
- Open
Settings->Apps. - Create a new custom app.
- Set
MCP Server URLto:
https://musashi-production.up.railway.app/mcp
- Leave authentication as
OAuth. - If ChatGPT uses automatic registration, continue with the discovered OAuth settings.
- If ChatGPT asks for manual client credentials, use a client created via the registration endpoint above.
- 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-apiinstance
Install dependencies:
pnpm install
Available scripts
pnpm build: compile the server todist/pnpm dev: run stdio transport locallypnpm dev:http: run the streamable HTTP transport locallypnpm test: build the server and run local smoke testspnpm start: run the compiled stdio server fromdist/pnpm start:http: run the compiled HTTP server fromdist/pnpm watch: run TypeScript in watch modepnpm clean: removedist/
Environment variables
MUSASHI_API_BASE_URL: Musashi API base URLPORT: HTTP port when running with--transport=httpMUSASHI_MCP_PUBLIC_BASE_URL: optional public MCP server base URL for OAuth metadataMUSASHI_MCP_API_KEY: optional single valid MCP API keyMCP_API_KEYS: optional comma-separated list of valid MCP API keysMCP_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 restartUPSTASH_REDIS_REST_URL: required in production — Upstash Redis REST URL for shared OAuth stateUPSTASH_REDIS_REST_TOKEN: required in production — Upstash Redis REST tokenMCP_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 /healthGET /.well-known/oauth-authorization-serverGET /oauth/authorizePOST /oauth/authorizePOST /oauth/tokenPOST /mcpGET /mcpDELETE /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
S256is supported. All clients are public (token_endpoint_auth_method: none) and must providecode_challenge; omitting it returns a400 invalid_request.code_challenge_methodmay be omitted (defaults to S256) or set toS256explicitly; any other value is rejected.client_secret_postis 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_SECRETto 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 testis a smoke suite, not a full MCP interoperability suite.- Behavior depends on a healthy and reachable
musashi-api.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。