sfinance-mcp-server

sfinance-mcp-server

Provides access to Indian stock market data via screener.in, enabling stock analysis, document access, screening, and more through MCP.

Category
访问服务器

README

SFinance MCP Server

A Model Context Protocol (MCP) server that provides access to Indian stock market data. Built on top of the SFinance package.

Supports both stdio (Claude Desktop) and HTTP transports.

Prerequisites

  • Python 3.11.6 or higher
  • uv package manager
  • Google Chrome browser
  • Screener.in account

Installation

  1. Clone and setup

    git clone https://github.com/shivakharbanda/sfinance-mcp-server.git
    cd sfinance-mcp-server
    uv sync
    
  2. Environment variables Create a .env file in the project root:

    SCREENER_EMAIL=your-email@example.com
    SCREENER_PASSWORD=YourPassword123
    CHROME_PATH=C:\Program Files\Google\Chrome\Application\chrome.exe
    SCREENER_URL=https://www.screener.in/
    

Running the Server

HTTP mode (remote / API access)

uv run python sfinance_server.py --transport http

The server starts at http://0.0.0.0:8000/mcp.

Custom host/port:

uv run python sfinance_server.py --transport http --host 127.0.0.1 --port 9000

Or via environment variables:

TRANSPORT=http HOST=0.0.0.0 PORT=8000 uv run python sfinance_server.py

Health check endpoint: GET http://localhost:8000/health

Stdio mode (Claude Desktop)

uv run python sfinance_server.py

Claude Desktop Configuration

Option 1: uv run (Recommended)

Windows:

{
  "mcpServers": {
    "sfinance": {
      "command": "uv",
      "args": [
        "run",
        "--directory", "C:\\path\\to\\sfinance-mcp-server",
        "python", "sfinance_server.py"
      ],
      "env": {
        "SCREENER_EMAIL": "your-email@example.com",
        "SCREENER_PASSWORD": "YourPassword123",
        "CHROME_PATH": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
        "SCREENER_URL": "https://www.screener.in/"
      }
    }
  }
}

macOS/Linux:

{
  "mcpServers": {
    "sfinance": {
      "command": "uv",
      "args": [
        "run",
        "--directory", "/path/to/sfinance-mcp-server",
        "python", "sfinance_server.py"
      ],
      "env": {
        "SCREENER_EMAIL": "your-email@example.com",
        "SCREENER_PASSWORD": "YourPassword123",
        "CHROME_PATH": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
        "SCREENER_URL": "https://www.screener.in/"
      }
    }
  }
}

Option 2: HTTP transport (connect to a running server)

If you already have the server running in HTTP mode, point Claude Desktop at it:

{
  "mcpServers": {
    "sfinance": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

Configuration File Locations

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Features

  • Stock Analysis: Company overview, financial statements, quarterly results, shareholding patterns, peer comparison
  • Document Access (login required): Announcements, annual reports, credit ratings, concall transcripts/PPTs
  • Document Download (login required): Batch download any document type to a local folder
  • Stock Screening (login required): Custom queries with financial parameters and pre-built templates
  • Indian Market Focus: NSE/BSE listed companies via screener.in

Available Tools

Stock Data

Tool Description
get_overview Company overview and about
get_income_statement P&L statement
get_balance_sheet Balance sheet
get_cash_flow Cash flow statement
get_quarterly_results Quarterly results
get_shareholding Shareholding pattern
get_peer_comparison Industry peer comparison

Documents (login required)

Tool Description
get_announcements Recent or important company announcements
get_annual_reports Annual report list with download URLs
get_credit_ratings Credit rating documents
get_concalls Concall transcripts, PPTs, and recordings
download_documents Batch download documents to a local folder

Screening (login required)

Tool Description
screen_stocks Custom stock screening with financial criteria
get_screening_parameters Browse available screening parameters

Utilities

Tool Description
check_login_status Verify screener.in login
get_cache_stats Cache information
clear_cache Clear ticker cache

Usage Examples

Get overview for RELIANCE
Get income statement for TCS
Get concalls for INFY
Download the last 3 annual reports for HDFCBANK to C:\Downloads\HDFCBANK
Screen stocks with Piotroski score > 7 AND Return on equity > 15
Find value stocks with Price to Earning < 15 AND Dividend yield > 3

Prompt Templates

  • High Quality Stocks - Strong fundamentals (Piotroski, ROE, P/E)
  • Value Stocks - Undervalued opportunities (P/E, P/B, dividend yield)
  • Growth Stocks - High-growth companies (sales/profit growth, ROE)
  • Custom Screener - Build your own criteria

Dependencies

  • sfinance - Core data library
  • fastmcp - MCP server framework (stdio + HTTP)
  • pandas - Data handling
  • python-dotenv - Environment variables

License

Apache License 2.0

Disclaimer

For educational purposes only. Always verify financial data from official sources before making investment decisions.

Legal Notice

Users are solely responsible for ensuring that their use of this software complies with the terms of service of any website they access.

This project is not affiliated with, endorsed by, or sponsored by Screener.in, Mittal Analytics Private Limited, or any other third-party data provider.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选