Portfolio Research MCP Server
Enables AI assistants to perform live stock and portfolio research using Yahoo Finance data, including quotes, fundamentals, price history, news, portfolio analysis, and ticker comparisons.
README
<p align="center"> <img src="assets/banner.png" alt="Stock Research MCP Server" width="100%"> </p>
Portfolio Research MCP Server 📈
A Model Context Protocol (MCP) server that gives any AI coding assistant or chat client live stock and portfolio research tools, powered by Yahoo Finance data. Written in Python with FastMCP, it speaks Streamable HTTP so you can host it once and connect from Claude, Cursor, VS Code, Google Antigravity, Windsurf, and terminal-based agents.
Ask your assistant: "Analyze my portfolio: 10 AAPL bought at $150 and 5 MSFT at $300," and it will call this server, price the holdings live, and report your gain/loss and weights.
⏳ First request is slow — please read
The public demo is hosted on Render's free tier, which puts the server to sleep after ~15 minutes of inactivity. When you send your first request after it has been idle, Render has to wake it up (a "cold start"), which takes roughly 30–60 seconds.
- Your first message may hang or time out — this is normal. Just wait and try again; once awake, the server responds instantly.
- Tip: open
https://stock-research-mcp.onrender.com/healthin your browser first. When it showsok, the server is warm and ready.- This delay only affects the free hosted demo. A local run or a paid Render instance has no cold start.
🚀 Try it instantly (public demo)
A live instance is already hosted — you don't need to deploy anything to test it.
| URL | https://stock-research-mcp.onrender.com/mcp |
| Auth header | Authorization: Bearer mYfUEnx-jnDKlUTHIkUXhCWhMBPgxuzmSvCfxegrt98 |
Drop those into any config block in Connect it to your IDE / agent below and start asking questions.
⚠️ This is a shared public demo token for trying the server out. It may be rate-limited, rotated, or taken down at any time, and the instance sleeps after ~15 min idle (first call may take 30–60s to wake). For anything real, deploy your own and set your own private
MCP_AUTH_TOKEN.
Tools
| Tool | What it does |
|---|---|
get_quote |
Latest price, day change, volume, market cap for a ticker |
get_fundamentals |
P/E, EPS, dividend yield, beta, 52-week range, sector, analyst rating |
get_price_history |
Historical OHLC candles (period/interval) for trend analysis |
get_news |
Recent news headlines with links for a ticker |
analyze_portfolio |
Value a set of holdings; per-position + total gain/loss and weights |
compare_tickers |
Side-by-side valuation snapshot for several tickers |
Data source: yfinance — free, no API key required.
Quick start (local)
Requires Python 3.10+.
git clone <your-repo-url> stock-research-mcp
cd stock-research-mcp
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate
pip install -r requirements.txt
python server.py
The server starts at:
- MCP endpoint:
http://127.0.0.1:8000/mcp - Health check:
http://127.0.0.1:8000/health→ok
Locally, auth is disabled unless you set MCP_AUTH_TOKEN (see Security).
Deploy free on Render
Render's free web-service tier hosts this at a public HTTPS URL. A render.yaml blueprint is
included.
-
Push this repo to GitHub.
-
In the Render dashboard: New + → Blueprint, select your repo. Render reads
render.yamland provisions a free web service. (Or New + → Web Service manually: Buildpip install -r requirements.txt, Startpython server.py.) -
Under Environment, set a secret
MCP_AUTH_TOKEN(a long random string). -
Deploy. Your server is live at:
https://<your-app-name>.onrender.com/mcp
⚠️ Free-tier cold starts: free instances spin down after ~15 minutes idle. The next request wakes it and can take 30–60 seconds. Upgrade to any paid instance to stay always-on. Hit
/healthto warm it before a demo.
Connect it to your IDE / agent
The blocks below use the public demo URL and token so you can copy-paste and go. To use
your own deployment, swap in your Render URL and your private MCP_AUTH_TOKEN (or
http://127.0.0.1:8000/mcp with no header for a local run).
⚠️ The config key differs by client. Cursor and VS Code use
url; Antigravity and Windsurf useserverUrl; Claude Code uses a CLI command. Copy the right block below.
Claude Code (terminal)
claude mcp add --transport http stock-research \
https://stock-research-mcp.onrender.com/mcp \
--header "Authorization: Bearer mYfUEnx-jnDKlUTHIkUXhCWhMBPgxuzmSvCfxegrt98"
Then check it: claude mcp list. Remove with claude mcp remove stock-research.
Claude Desktop
Claude Desktop connects to remote servers through the mcp-remote bridge (needs Node.js).
Edit claude_desktop_config.json (Settings → Developer → Edit Config):
{
"mcpServers": {
"stock-research": {
"command": "npx",
"args": [
"-y", "mcp-remote",
"https://stock-research-mcp.onrender.com/mcp",
"--header", "Authorization: Bearer mYfUEnx-jnDKlUTHIkUXhCWhMBPgxuzmSvCfxegrt98"
]
}
}
}
Restart Claude Desktop. Tools appear under the 🔌 (MCP) icon.
Cursor
Edit ~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project):
{
"mcpServers": {
"stock-research": {
"url": "https://stock-research-mcp.onrender.com/mcp",
"headers": {
"Authorization": "Bearer mYfUEnx-jnDKlUTHIkUXhCWhMBPgxuzmSvCfxegrt98"
}
}
}
}
Then Settings → MCP and confirm the server shows green.
Google Antigravity
Antigravity uses serverUrl (not url). Open the MCP store via the "…" menu in the
agent panel → Manage MCP Servers → View raw config, or edit
~/.gemini/config/mcp_config.json directly:
{
"mcpServers": {
"stock-research": {
"serverUrl": "https://stock-research-mcp.onrender.com/mcp",
"headers": {
"Authorization": "Bearer mYfUEnx-jnDKlUTHIkUXhCWhMBPgxuzmSvCfxegrt98"
}
}
}
}
Save, then Customizations → Installed MCP Servers → Refresh.
Windsurf
Windsurf also uses serverUrl. Edit ~/.codeium/windsurf/mcp_config.json
(or Settings → Cascade → MCP Servers → Manage → View raw config):
{
"mcpServers": {
"stock-research": {
"serverUrl": "https://stock-research-mcp.onrender.com/mcp",
"headers": {
"Authorization": "Bearer mYfUEnx-jnDKlUTHIkUXhCWhMBPgxuzmSvCfxegrt98"
}
}
}
}
Click Refresh in the MCP panel.
VS Code (Copilot agent mode)
Create .vscode/mcp.json in your workspace (or run MCP: Add Server from the Command
Palette):
{
"servers": {
"stock-research": {
"type": "http",
"url": "https://stock-research-mcp.onrender.com/mcp",
"headers": {
"Authorization": "Bearer mYfUEnx-jnDKlUTHIkUXhCWhMBPgxuzmSvCfxegrt98"
}
}
}
}
Open Copilot Chat, switch to Agent mode, and the tools become available.
Other terminal / stdio-only agents
Clients that speak the remote MCP shape can reuse the Cursor block above (url + headers).
For agents that only support local stdio servers, bridge to the remote URL with
mcp-remote:
npx -y mcp-remote https://stock-research-mcp.onrender.com/mcp \
--header "Authorization: Bearer mYfUEnx-jnDKlUTHIkUXhCWhMBPgxuzmSvCfxegrt98"
Point the client's command/args at that (as in the Claude Desktop example).
Usage examples
Once connected, try prompts like:
- "What's AAPL trading at right now?" →
get_quote - "Compare NVDA, AMD and INTC on valuation." →
compare_tickers - "Show me TSLA's price history over the last 6 months." →
get_price_history - "Any recent news on MSFT?" →
get_news - "Analyze my portfolio: 10 AAPL at $150, 5 MSFT at $300, 20 NVDA at $110." →
analyze_portfolio
Security
- If
MCP_AUTH_TOKENis set, every request to/mcpmust sendAuthorization: Bearer <token>or it's rejected with401. Always set it in production. - If it's unset, auth is off — fine for
localhost, never for a public URL. - A shared bearer token is a pragmatic choice for a personal/portfolio project. The MCP spec's full answer for public servers is OAuth 2.1 with PKCE; adopt that if you expose this to untrusted clients.
- The token shown in this README is a deliberately public demo token so anyone can try the
hosted instance. Never reuse it for a private deployment — generate your own with
python -c "import secrets; print(secrets.token_urlsafe(32))"and keep it secret.
Project structure
.
├── server.py # FastMCP app: tools, bearer-auth middleware, /health, HTTP transport
├── portfolio.py # yfinance data layer (pure, testable, returns plain dicts)
├── requirements.txt # fastmcp, yfinance, uvicorn
├── render.yaml # Render blueprint (free web service)
├── .env.example # MCP_AUTH_TOKEN, PORT
└── README.md
Troubleshooting
| Symptom | Fix |
|---|---|
| First request after idle is very slow | Render free-tier cold start (~30–60s). Ping /health to warm it, or upgrade the instance. |
401 Unauthorized |
Token in the client header must exactly match MCP_AUTH_TOKEN on the server. |
Empty / error fields from a tool |
yfinance can rate-limit or return partial data. Retry shortly, or verify the ticker symbol. |
| Client shows the server but no tools | Confirm the URL ends in /mcp and (for Antigravity/Windsurf) that you used serverUrl, not url. |
License
MIT — do whatever you like. Data is provided by Yahoo Finance via yfinance and is subject to
their terms; this project is for research/educational use, not investment advice.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。