stock-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@stock-mcpWhat's the outlook for Apple stock?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
stock-mcp
An MCP server that exposes DSA's 问股 (Agent Chat / ask-stock) capability as a cross-client tool.
What it does
Claude Desktop / Code / Cursor
|
| Streamable HTTP (MCP)
v
stock-mcp (this server)
|
| HTTP (REST)
v
DSA FastAPI API
|
/api/v1/agent/chat
/api/v1/agent/skillsask_stock — send a natural-language stock question, get the Agent Chat answer back.
list_agent_skills — list available strategy skills for
ask_stock.
Related MCP server: OpenFinClaw CLI
Prerequisites
Python 3.11+
DSA API server running and reachable (e.g.
python main.py --serve-onlyinside thedaily_stock_analysisrepo, defaulthttp://127.0.0.1:8000).
Install
cd stock-mcp
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"Or install from requirements.txt:
pip install -r requirements-dev.txtRun
# With defaults (DSA on 127.0.0.1:8000, no auth)
python -m stock_mcp
# Or via the installed console script
dsa-mcp-server
# With env overrides
DSA_API_BASE_URL=http://127.0.0.1:8000 DSA_API_AUTH_ENABLED=true DSA_API_PASSWORD=xxx python -m stock_mcpEnvironment variables
stock-mcp reads .env from the working directory automatically, or you can export variables directly.
Variable | Default | Description |
|
| DSA FastAPI base URL |
|
| MCP HTTP bind host |
|
| MCP HTTP bind port |
|
| MCP endpoint path |
|
| Whether DSA requires admin auth |
| (empty) | DSA admin password (required when auth enabled) |
|
| Timeout for short calls (skills, login) |
|
| Timeout for |
| (empty) | Comma-separated extra Host header values allowed by DNS rebinding protection. Localhost entries are always included. |
| (empty) | If set, also write logs to this file path. Parent directories are created automatically. |
|
| Rotate the log file when it reaches this size in bytes. |
|
| Number of rotated log files to keep. |
Logging to a file
By default logs go to stderr only. To also persist them to a file with rotation:
export DSA_MCP_LOG_FILE=/var/log/stock-mcp/server.log
export DSA_MCP_LOG_LEVEL=INFO
python -m stock_mcpLogs are then written to both stderr and DSA_MCP_LOG_FILE. Set DSA_MCP_LOG_MAX_BYTES=0 for a single ever-growing file.
Client configuration
Claude Desktop
Add to your claude_desktop_config.json (macOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"dsa-ask-stock": {
"url": "http://127.0.0.1:8765/mcp",
"env": {
"DSA_API_BASE_URL": "http://127.0.0.1:8000",
"DSA_API_AUTH_ENABLED": "false"
}
}
}
}Claude Code
claude mcp add dsa-ask-stock http://127.0.0.1:8765/mcpCursor
In Settings → MCP, add a Streamable HTTP server pointing to http://127.0.0.1:8765/mcp.
Auth notes
If DSA is running with ADMIN_AUTH_ENABLED=true:
export DSA_API_AUTH_ENABLED=true
export DSA_API_PASSWORD="your-dsa-admin-password"
python -m stock_mcpThe server logs in once at startup via POST /api/v1/auth/login and reuses the session
cookie across tool calls.
Backend limitation
If DSA's AGENT_BACKEND is set to codex_app_server, ask_stock returns a clear error:
Codex requires the streaming Chat interface (/chat/stream), which is not exposed over
MCP in this tool. Switch AGENT_BACKEND to litellm (or auto) for MCP compatibility,
or use the DSA web Chat page directly.
Security
The server binds to 127.0.0.1 by default. When binding to a public interface (0.0.0.0), the
MCP SDK enforces DNS rebinding protection — only Host header values in the allowed list are
accepted (see DSA_MCP_ALLOWED_HOSTS). Keep the allowed list as narrow as your use case
requires.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server giving AI agents one-connection access to China A-share market intelligence: financials,
MCP server exposing the Backtest360 engine API as tools for AI agents.
MCP server for stocksense-ai documentation, generated by doc2mcp.
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceMCP server for A-share stock technical analysis and AI prediction, enabling LLM-based interaction to analyze stocks.344-
- FlicenseNot gradedqualityDmaintenanceEnables quant research, strategy generation, backtesting, and paper trading from natural language prompts, integrating with AI agents via an MCP server.64-
- FlicenseNot gradedqualityFmaintenanceMCP server that exposes stock research tools (fundamentals, news, technicals, analyst ratings) to AI clients, enabling autonomous generation of structured investment briefs.-

backtest360-mcpofficial
AlicenseAqualityDmaintenanceMCP server that exposes the Backtest360 backtesting engine API as tools, enabling AI agents to conversationally discover indicators, build and validate strategies, run backtests, and read results.14MIT