yfnhanced-mcp

yfnhanced-mcp

Production-grade financial data infrastructure for AI assistants, providing reliable market data from Yahoo Finance with enterprise resilience patterns.

Category
访问服务器

README

Yahoo Finance MCP Server

Production-grade financial data infrastructure for AI assistants


Overview

Transforms unreliable financial APIs into dependable data sources with enterprise-grade resilience, comprehensive data quality validation, and production-ready monitoring.

Built for: AI assistants, investment platforms, algorithmic trading systems, and financial research tools

Key Features:

  • ✅ Circuit breaker pattern with automatic recovery
  • ✅ Multi-strategy rate limiting (token bucket + adaptive + per-endpoint)
  • ✅ Data quality scoring with completeness and integrity validation
  • ✅ Comprehensive caching with graceful fallback
  • ✅ 13+ financial data tools covering stocks, crypto, and forex
  • ✅ Enterprise-grade testing (unit, integration, e2e, chaos)

Quick Start

Installation

Via npm (Recommended):

npm install -g yfnhanced-mcp

From source:

# Clone and install
git clone https://github.com/kanishka-namdeo/yfnhanced-mcp.git
cd yfnhanced-mcp
npm install

# Build TypeScript
npm run build

Start Server

# If installed globally via npm
yfnhanced-mcp

# Or if running from source
npm start

Claude Desktop Integration

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "yfnhanced": {
      "command": "yfnhanced-mcp"
    }
  }
}

Or if running from source:

{
  "mcpServers": {
    "yfnhanced": {
      "command": "node",
      "args": ["absolute:\\path\\to\\yfnhanced-mcp\\dist\\index.js"],
      "cwd": "absolute:\\path\\to\\yfnhanced-mcp"
    }
  }
}

Usage with Other AI Tools

Cursor AI:

Add to Cursor's MCP settings:

{
  "mcpServers": {
    "yfnhanced": {
      "command": "yfnhanced-mcp"
    }
  }
}

Cline AI:

Add to Cline's MCP configuration:

{
  "mcpServers": {
    "yfnhanced": {
      "command": "yfnhanced-mcp"
    }
  }
}

Custom Integration:

Use the MCP SDK to integrate with any AI assistant:

import { Client } from '@modelcontextprotocol/sdk';

const client = new Client({
  name: 'your-app',
  version: '1.0.0',
});

await client.connect({
  command: 'yfnhanced-mcp',
});

// Use financial data tools
const quote = await client.callTool({
  name: 'get_quote',
  arguments: { symbol: 'AAPL' }
});

Documentation

Document Description
TOOLS.md Complete reference for all 13+ MCP tools
USAGE_GUIDE.md Practical guide with examples and patterns
CONFIGURATION.md Detailed configuration guide with best practices
ARCHITECTURE.md Deep dive into resilience patterns and architecture
DATA_VERIFICATION.md Verification of data availability and limitations

Available Tools

Market Data

  • get_quote - Real-time quotes with quality reporting
  • get_historical_prices - OHLCV data with date ranges
  • get_historical_prices_multi - Batch historical data

Company Intelligence

  • get_quote_summary - Comprehensive company overview
  • get_balance_sheet - Assets, liabilities, equity
  • get_income_statement - Revenue, expenses, net income
  • get_cash_flow_statement - Operating, investing, financing cash flows
  • get_earnings - Quarterly earnings with estimates
  • get_analysis - Analyst recommendations and price targets
  • get_major_holders - Institutional and insider ownership

Market Sentiment

  • get_news - Latest articles with relevance scoring
  • get_options - Options chains with Greeks
  • get_trending_symbols - Top movers with volume metrics
  • screener - Filter stocks by 12+ criteria

Cross-Asset

  • get_crypto_quote - Cryptocurrency prices
  • get_forex_quote - Currency pair exchange rates

Note: See DATA_VERIFICATION.md for data availability status


Quick Reference

What Works ✅

  • Real-time quotes (price, volume, market cap, etc.)
  • Historical OHLCV data with integrity validation
  • Company profiles and business information
  • Earnings data with surprise analysis
  • Analyst ratings and target prices
  • Company news with metadata
  • Options chains with Greeks
  • Major holders information
  • Trending symbols and stock screener

Known Issues ⚠️

  • Financial Statements: May encounter validation errors for some symbols

  • Crypto/Forex: Tools exist but return placeholder data

Performance

Metric Value
Quote queries 60 requests/minute (configurable)
Batch operations Up to 100 symbols per request
Cache hit ratio 70-90% for frequently accessed symbols
Cold start time <500ms
Test coverage 95%+ for core middleware

Configuration

For detailed configuration options, see CONFIGURATION.md.

Quick Configuration

Create config.json:

{
  "rateLimit": {
    "requestsPerMinute": 60,
    "requestsPerHour": 1500
  },
  "cache": {
    "ttlQuotes": 60000,
    "maxCacheSize": 1000
  },
  "circuitBreaker": {
    "failureThreshold": 5,
    "monitoringWindow": 60000,
    "successThreshold": 3
  },
  "server": {
    "transport": "stdio",
    "logLevel": "info"
  }
}

Testing

npm test              # All tests
npm run test:coverage  # With coverage report
npm run lint         # Code quality checks
npm run typecheck     # TypeScript validation

Test suites include:

  • Unit tests (95%+ coverage for core middleware)
  • Integration tests (full tool and resource workflows)
  • End-to-end tests (complete user journeys)
  • Chaos tests (network failures, API changes, partial data)

Development

Scripts

npm run dev         # Watch mode for development
npm run build       # Compile TypeScript
npm run start       # Start server
npm run test        # Run tests
npm run test:watch   # Watch mode for tests
npm run lint        # Run linter
npm run lint:fix    # Fix linting issues
npm run typecheck   # Type checking

Project Structure

src/
├── config/          # Configuration management
├── middleware/      # Rate limiting, caching, circuit breaker, retry
├── prompts/         # Pre-built financial analysis prompts
├── schemas/         # Zod validation schemas
├── services/        # Yahoo Finance API client
├── tools/           # MCP tool implementations (13+ tools)
├── types/           # TypeScript type definitions
├── utils/           # Data quality, formatting, security
└── index.ts         # Server entry point

For architecture details, see ARCHITECTURE.md.


Comparison

Feature This Implementation Typical Python MCP
Circuit Breaker ✅ Full 3-state implementation ❌ None
Rate Limiting ✅ Token bucket + adaptive + per-endpoint ⚠️ Simple fixed limit
Retry Logic ✅ Exponential backoff + jitter ⚠️ Linear or none
Data Quality ✅ Completeness + integrity + recommendations ❌ None
Observability ✅ Metrics + logging + stats ⚠️ Basic logging
Testing ✅ Unit + integration + e2e + chaos ⚠️ Unit only
Type Safety ✅ TypeScript compile-time checks ❌ Runtime only
Performance ✅ <500ms cold start ⚠️ 2-3s cold start
Configuration ✅ JSON/YAML with validation ⚠️ Environment variables
Security ✅ Input validation + output sanitization ❌ None

Contributing

Contributions welcome! Please ensure:

  1. TypeScript compilation passes (npm run typecheck)
  2. Linting passes (npm run lint)
  3. Tests added for new features (npm test)
  4. Documentation updated for API changes
  5. Chaos tests added for resilience features

License

MIT


Support


Documentation Index

Getting Started:

Using the Server:

Reference:

Best Practices:

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选