gurufocus-mcp
MCP server that exposes GuruFocus financial data to AI assistants via 50+ tools for stocks, gurus, insiders, politicians, and economic data with token-efficient TOON format support.
README
Unofficial GuruFocus MCP Server & Python API Library
NOTE: This repo is currently a work in progress and is not yet ready for production use.
A comprehensive GuruFocus MCP server and Python API client library with Pydantic models for all responses.
Packages
This monorepo contains two packages:
gurufocus-api
A standalone Python client library for the GuruFocus API.
- Full API coverage with type hints
- Three-tier earnings-aware caching
- Rate limiting and retry logic
- Pydantic models for all responses
- Async-first design with
httpx
gurufocus-mcp
An MCP server exposing GuruFocus data to AI assistants.
- FastMCP framework with HTTP/SSE transport
- 50+ tools for stocks, gurus, insiders, politicians, economic data, and more
- Resources for direct data access
- TOON format support for 30-60% token reduction in LLM contexts
Quick Start
Installation
# Install both packages
pip install gurufocus-api gurufocus-mcp
Using the API Client
from gurufocus_api import GuruFocusClient
async with GuruFocusClient() as client:
summary = await client.get_summary("AAPL")
print(summary.gf_score)
Running the MCP Server
export GURUFOCUS_API_TOKEN=your-token
gurufocus-mcp
Claude Desktop Integration
First, install the package:
pipx install gurufocus-mcp # recommended for CLI tools
# or
pip install gurufocus-mcp
Then add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"gurufocus": {
"command": "gurufocus-mcp",
"env": {
"GURUFOCUS_API_TOKEN": "your-token-here"
}
}
}
}
After adding the configuration, restart Claude Desktop. You should see the GuruFocus tools available in Claude's interface.
Running from source (for development):
{
"mcpServers": {
"gurufocus": {
"command": "uv",
"args": ["run", "gurufocus-mcp"],
"env": {
"GURUFOCUS_API_TOKEN": "your-token-here"
}
}
}
}
Output Format (TOON)
The MCP server supports TOON format for token-efficient responses, achieving 30-60% reduction in token usage compared to JSON.
Per-request format selection:
All tools accept a format parameter:
"toon"(default) - Token-efficient format optimized for LLM contexts"json"- Standard JSON format for debugging or compatibility
# TOON format (default)
result = await client.call_tool("get_stock_summary", {"symbol": "AAPL"})
# JSON format
result = await client.call_tool("get_stock_summary", {"symbol": "AAPL", "format": "json"})
Environment variable configuration:
# Change the default output format (default: toon)
export GURUFOCUS_DEFAULT_OUTPUT_FORMAT=json
Configuration
All settings can be configured via environment variables with the GURUFOCUS_ prefix.
Required
| Variable | Description |
|---|---|
GURUFOCUS_API_TOKEN |
Your GuruFocus API token |
Cache Settings
| Variable | Default | Description |
|---|---|---|
GURUFOCUS_CACHE_ENABLED |
true |
Enable response caching |
GURUFOCUS_CACHE_DIR |
.cache/gurufocus-mcp |
Directory for cache storage |
Recommended: Set an absolute path for GURUFOCUS_CACHE_DIR to ensure consistent caching across sessions:
export GURUFOCUS_CACHE_DIR="$HOME/.cache/gurufocus-mcp"
Or in Claude Desktop config:
{
"mcpServers": {
"gurufocus": {
"command": "gurufocus-mcp",
"env": {
"GURUFOCUS_API_TOKEN": "your-token-here",
"GURUFOCUS_CACHE_DIR": "/Users/yourname/.cache/gurufocus-mcp"
}
}
}
}
Rate Limiting
| Variable | Default | Description |
|---|---|---|
GURUFOCUS_RATE_LIMIT_ENABLED |
true |
Enable rate limiting |
GURUFOCUS_RATE_LIMIT_RPM |
30.0 |
Maximum requests per minute |
GURUFOCUS_RATE_LIMIT_DAILY |
0 |
Maximum requests per day (0 = unlimited) |
API Settings
| Variable | Default | Description |
|---|---|---|
GURUFOCUS_API_BASE_URL |
https://api.gurufocus.com/public/user |
API base URL |
GURUFOCUS_API_TIMEOUT |
30.0 |
Request timeout in seconds |
GURUFOCUS_API_MAX_RETRIES |
3 |
Maximum retry attempts for failed requests |
Output Format
| Variable | Default | Description |
|---|---|---|
GURUFOCUS_DEFAULT_OUTPUT_FORMAT |
toon |
Default format: toon (token-efficient) or json |
Logging
| Variable | Default | Description |
|---|---|---|
GURUFOCUS_LOG_LEVEL |
INFO |
Logging level: DEBUG, INFO, WARNING, ERROR |
GURUFOCUS_LOG_FORMAT |
console |
Log format: console (human-readable) or json (structured) |
Development
Setup
# Clone the repository
git clone https://github.com/yourorg/gurufocus-mcp.git
cd gurufocus-mcp
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies
uv sync --all-packages
# Run tests
uv run pytest
# Run tests with coverage
uv run pytest --cov --cov-report=html --junitxml=junit.xml
# Run linting
uv run ruff check .
Project Structure
gurufocus-mcp/
├── packages/
│ ├── gurufocus-api/ # Python API client
│ └── gurufocus-mcp/ # MCP server
├── docs/ # Documentation
├── examples/ # Usage examples
└── pyproject.toml # Workspace config
Disclaimer
This project is an unofficial tool and is not affiliated with, endorsed by, or sponsored by GuruFocus.com, LLC or any of its subsidiaries.
- Non-Affiliation: This software is developed independently and does not represent the views or opinions of GuruFocus.
- Trademarks: "GuruFocus" and the GuruFocus logo are trademarks of GuruFocus.com, LLC.
- Data Usage: Users are responsible for ensuring their use of this tool complies with the GuruFocus Terms of Use and any applicable API usage agreements. This tool is provided "as is" and intended for educational and personal use.
- No Warranty: The authors of this software make no warranty as to the accuracy, completeness, or reliability of the data retrieved using this tool.
- No Investment Advice: The information provided by this tool is for informational and educational purposes only and does not constitute investment advice, financial advice, trading advice, or any other sort of advice. You should not treat any of the tool's content as such.
- External Methodologies: References to third-party investment strategies, books, authors, or personalities (e.g., Phil Town, Rule #1, Warren Buffett) are for educational purposes to demonstrate the application of published methodologies. This project is not affiliated with, endorsed by, or sponsored by any referenced individuals or entities. All trademarks belong to their respective owners.
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。