AKShare — Claude Code MCP server: China market data on demand
Gives the model three tools to search, inspect and call AKShare functions for China market data. Useful when a fixed list of sources is not enough.
claude mcp add --env AKSHARE_MAX_ROWS=<AKSHARE_MAX_ROWS> --transport stdio akshare-mcp -- uvx agentpit-akshare-mcpWhat AKShare does
AKShare is a Python library, not an HTTP service, so you cannot wire it up with a single URL. The server runs locally and exposes three tools: akshare_search finds functions by query, akshare_signature shows what arguments a function takes, and akshare_call runs it. Nothing has to be enumerated in advance — the model finds the right interface itself.
Start it with Docker: build the image in tools/akshare-mcp and run the container on port 8931. The image is about 1.5G because AKShare pulls in pandas, lxml and beautifulsoup4, so the first build takes a few minutes. To check it is up, hit http://localhost:8931/sse.
Most AKShare interfaces reach upstream sites inside China. On a machine outside the country many calls will time out, so run the server on a Chinese host or give the container a proxy. Keep it off the public internet: there is no auth, and AKShare sends requests to third-party sites, which means anyone could route those requests through your machine.
What it helps with
- find an AKShare function by the Chinese name of a metric
- check which arguments a given interface expects
- call a function and get a table with its original Chinese columns
- cap the number of rows so the response does not flood the model context
- run local access to China market data without an external service
Example prompts for the agent
- Search AKShare for 龙虎榜 and show me the function signature
- Call
stock_lhb_detail_emand show the first rows - Find functions for 北向资金 and call the right one
How to install AKShare
Platform CLI
claude mcp add --env AKSHARE_MAX_ROWS=<AKSHARE_MAX_ROWS> --transport stdio akshare-mcp -- uvx agentpit-akshare-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from agentpit-akshare-mcp <command>
Platform CLI
codex mcp add akshare-mcp --env AKSHARE_MAX_ROWS=<AKSHARE_MAX_ROWS> -- uvx agentpit-akshare-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from agentpit-akshare-mcp <command>
Config file
{
"mcpServers": {
"akshare-mcp": {
"command": "uvx",
"args": [
"agentpit-akshare-mcp"
],
"env": {
"AKSHARE_MAX_ROWS": "<AKSHARE_MAX_ROWS>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from agentpit-akshare-mcp <command>
Config file
{
"servers": {
"akshare-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"agentpit-akshare-mcp"
],
"env": {
"AKSHARE_MAX_ROWS": "<AKSHARE_MAX_ROWS>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from agentpit-akshare-mcp <command>
Platform CLI
gemini mcp add -e AKSHARE_MAX_ROWS=<AKSHARE_MAX_ROWS> akshare-mcp uvx agentpit-akshare-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from agentpit-akshare-mcp <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about AKShare
How do I install AKShare MCP in Claude Code?
Run claude mcp add akshare-mcp -- uvx agentpit-akshare-mcp. To set a row limit, use the env variant: claude mcp add --env AKSHARE_MAX_ROWS=<AKSHARE_MAX_ROWS> --transport stdio akshare-mcp -- uvx agentpit-akshare-mcp.
What does AKShare MCP do?
It exposes three tools over the AKShare library: search for functions, inspect their signatures, and call them. The model reaches the interface it needs instead of picking from a prebuilt list.
Why do calls time out?
Most AKShare interfaces hit upstream sites inside China. From a machine outside the country the connection often fails, so move the server to a Chinese host or configure a proxy for the container.