MyShare MCP
Financial data analysis assistant based on AKShare with local SQLite caching.
Setup
-
Create and activate virtual environment:
uv add "mcp[cli]" uv init myshare-mcp cd myshare-mcp uv venv .venv/Scripts/activate # Windows source .venv/bin/activate # Linux/Mac
-
Install dependencies:
pip install -e .
API and MCP Endpoints
Testing MCP
To test mcp, please use the following command:
C:\>myshare-mcp>uv run mcp
Usage: mcp [OPTIONS] COMMAND [ARGS]...
MCP development tools
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ version Show the MCP version. │
│ dev Run a MCP server with the MCP Inspector. │
│ run Run a MCP server. │
│ install Install a MCP server in the Claude desktop app. │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
To debug using MCP inspector:
C:\>myshare-mcp>uv run mcp dev main.py
Starting MCP inspector...
⚙️ Proxy server listening on port 6277
New SSE connection
Query parameters: [Object: null prototype] {
transportType: 'stdio',
command: 'uv',
args: 'run --with mcp mcp run main.py',
...
Testing FastAPI
C:\>myshare-mcp>uv run main.py
API implementation
1. Real-time Stock Data
GET /spot/{symbol}
Gets real-time stock data for a given symbol (e.g., "SH600000").
Example response:
{
"symbol": "SH600000",
"name": "浦发银行",
"current_price": 7.21,
"open_price": 7.19,
"high_price": 7.25,
"low_price": 7.18,
"pe_ratio": 4.85,
"pb_ratio": 0.41,
"market_cap": 211731000000,
"timestamp": "2025-04-26T10:30:00",
"source": "akshare"
}
2. Historical Stock Data
GET /history/{symbol}?start_date={YYYYMMDD}&end_date={YYYYMMDD}&period={daily|weekly|monthly}&adjust={qfq|hfq}
Gets historical stock data for a given symbol and date range.
Parameters:
- start_date: Start date in YYYYMMDD format
- end_date: End date in YYYYMMDD format
- period: Data frequency (daily, weekly, monthly)
- adjust: Price adjustment (qfq for forward-adjusted, hfq for backward-adjusted)
Example response:
[
{
"date": "2025-04-26T00:00:00",
"open": 7.19,
"close": 7.21,
"high": 7.25,
"low": 7.18,
"volume": 123456,
"source": "akshare"
}
]
Caching
All data is automatically cached in a local SQLite database (finance.db). The cache is checked before making requests to AKShare.
Symbol
The following table is the format of stock symbol for different markets.
Please refer to symbol.md.
Database
We can use sqlite_web to navigate the database.
coleifer/sqlite-web: Web-based SQLite database browser written in Python
sqlite_web .\finance.db
Metadata
Release files for myshare_mcp 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| myshare_mcp-0.1.10.tar.gz | 104.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| myshare_mcp-0.1.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 115.1 kB
Security for myshare_mcp 0.1.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.