Back to MCP directory
publicPublicdnsLocal runtime

mcp-server-indian-stock-market

一个基于MCP协议的印度股票市场数据查询服务器,可通过Claude桌面应用访问实时行情与历史数据。

article

README

🚀 MCP 印度股票市场服务器

这是一个 MCP(模型上下文协议)服务器,用于访问印度股票市场数据,并通过 MCP 框架将其与 Claude 集成。

🚀 快速开始

📋 项目要求

要使用此项目,请确保你具备以下条件:

  • 一个 Claude.ai 账户(所有账户类型均支持 MCP)
  • Claude 桌面应用程序(适用于 macOS 或 Windows)
  • 代码编辑器,如 Visual Studio Code
  • uv - 一个基于 Rust 的快速 Python 包管理器

uv 的安装

macOS 系统(使用 Homebrew)

brew install uv

Windows 系统(使用 WinGet)

winget install --id=astral-sh.uv -e

🚀 项目设置

按照以下步骤在本地设置 MCP 服务器:

  1. 创建项目目录
    mkdir mcp-server-indian-stock-market
    cd mcp-server-indian-stock-market
    
  2. 初始化 uv 项目
    uv init
    
  3. 创建虚拟环境
    uv venv
    
  4. 激活虚拟环境
    • macOS / Linux 系统
    source .venv/bin/activate
    
    • Windows 系统 - 命令提示符
    .venv\Scripts\activate.bat
    
    • Windows 系统 - PowerShell
    .venv\Scripts\Activate.ps1
    
    • Windows 系统 - Git Bash
    source .venv/Scripts/activate
    
    要停用环境,请执行:
    deactivate
    

📦 安装依赖

安装支持 CLI 的 MCP Python SDK 以及所需的依赖项:

uv add "mcp[cli]" httpx

📁 添加 main.py 文件

  1. 克隆仓库或下载源代码:
git clone <your-github-repository-url>
  1. 将 main.py 文件复制到项目根目录:
cp <cloned-repo-path>/main.py .

项目目录结构应如下所示:

mcp-server-indian-stock-market/
├── main.py
├── pyproject.toml
└── .venv/

⚙️ MCP 配置

在 MCP 配置文件中添加以下条目:

{
  "indian_stock_market": {
    "command": "/Users/username/.local/bin/uv",
    "args": [
      "run",
      "--with",
      "mcp[cli]",
      "mcp",
      "run",
      "<absolute-path-to>/main.py"
    ]
  }
}

配置说明

  • username 替换为你的系统用户名。
  • <absolute-path-to>/main.py 替换为 main.py 的完整路径。
  • 运行服务器时,请确保虚拟环境已激活。
  • uv 必须存在于指定路径。

✅ 配置完成

配置完成后,重启 Claude 桌面应用程序,即可使用 MCP 服务器。

🛠️ 可选改进

你可以考虑添加以下内容:

  • MCP 服务器公开的工具描述
  • Claude 提示示例
  • 错误处理和日志记录
  • API 速率限制处理
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client