股票信息服务 logo

股票信息服务

Community
tddt

获取股票各类信息

Publishertddt
Repositorystock_info_mcp
LanguagePython
Forks
5
Stars
6
Available tools
0
Transport typestdio
Categories
Links
  • Connect tools to AI workflows

    股票信息服务 exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    6 stars and 5 forks from the linked repository.

Stock Info Service

这是一个基于 FastMCP 的股票数据服务,提供了股票历史数据、基本面信息、新闻资讯等功能。

项目结构

stock-info/
├── src/
│   ├── config/           # 配置管理
│   │   └── settings.py
│   ├── core/            # 核心功能
│   │   └── exceptions.py
│   ├── models/          # 数据模型
│   │   └── stock.py
│   ├── repository/      # 数据访问层
│   │   └── stock_repository.py
│   ├── service/         # 业务逻辑层
│   │   └── stock_service.py
│   └── server.py        # 服务入口
├── pyproject.toml       # 项目配置
└── README.md           # 项目文档

功能特性

  • 获取股票历史数据
  • 查询股票基本信息
  • 获取风险警示股票列表
  • 查看个股新闻
  • 获取财经新闻(支持分页)
  • 获取股票主营业务信息
  • .....后续逐渐增加

MCP客户端配置步骤

    1. 拉取代码
    1. 使用uv建立虚拟环境 python 1.10+
    1. 使用本地目录方式配置MCP服务
json
{
  "mcpServers": {
     "stock-info": {
      "isActive": true,
      "command": "uv",
      "args": [
        "--directory",
        "\\path\\to\\sock_info\\src",
        "run",
        "server.py"
      ]
    }
  }

环境要求

  • Python >= 3.10
  • 依赖包:
    • fastmcp
    • akshare
    • pandas
    • pydantic
    • pydantic-settings

安装部署

  1. 创建虚拟环境:
bash
python -m venv .venv
  1. 激活虚拟环境:
bash
# Windows
.venv\Scripts\activate
# Linux/macOS
source .venv/bin/activate
  1. 安装依赖:
bash
pip install -e .

启动服务

bash
# 使用默认配置启动
python src/server.py

# 使用 HTTP 传输协议启动
python src/server.py --transport http --port 8080

# 设置日志级别
python src/server.py --log-level debug

工具说明

  1. get_stock_info: 获取指定股票代码、指定日期范围的股价信息
  2. get_stock_price_monthly: 获取指定股票最近30天的股价信息
  3. stock_individual_basic_info: 获取指定股票的基本信息
  4. risk_stocks: 获取风险警示板股票列表
  5. stock_merito_data: 获取指定股票的主营业务信息
  6. get_stock_news: 获取指定股票的新闻资讯
  7. get_finance_news: 获取财经精选新闻(支持分页)

项目特点

  1. 模块化设计:采用清晰的分层架构,便于维护和扩展
  2. 统一异常处理:使用自定义异常体系,提供友好的错误提示
  3. 配置集中管理:使用 pydantic-settings 进行配置管理
  4. 类型提示:全面使用 Python 类型注解,提高代码可读性
  5. 数据验证:使用 Pydantic 模型进行数据验证和序列化

开发规范

  1. 使用 ruff 进行代码格式化和 lint
  2. 遵循 PEP 8 编码规范
  3. 保持完整的类型注解
  4. 编写清晰的文档字符串

错误处理

服务统一返回以下格式的错误信息:

json
{
    "error": "错误代码",
    "message": "错误描述",
    "details": {
        "额外信息": "值"
    }
}

主要错误代码

  • STOCK_NOT_FOUND: 股票代码不存在
  • INVALID_DATE_FORMAT: 日期格式错误
  • DATA_FETCH_ERROR: 数据获取失败
  • INVALID_PAGINATION: 分页参数错误
  • SYSTEM_ERROR: 系统内部错误

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "tddt-stock_info_mcp": {
      "command": "",
      "args": []
    }
  }
}

Use 股票信息服务 MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once 股票信息服务 is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add 股票信息服务 as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the 股票信息服务 MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "tddt-stock_info_mcp": {
      "command": "npx",
      "args": [
        "-y",
        "stock-info"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the 股票信息服务 MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the 股票信息服务 MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use 股票信息服务 to help me with this task?
股票信息服务
Sure. I read it.
Here is what I found using 股票信息服务.

Frequently asked questions

What is the 股票信息服务 MCP server used for?

股票信息服务 is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use 股票信息服务 MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use 股票信息服务 with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use 股票信息服务 MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With 股票信息服务 connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect 股票信息服务 MCP to TypingMind?

股票信息服务 runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does 股票信息服务 MCP provide in TypingMind?

股票信息服务 exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use 股票信息服务 MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If 股票信息服务 requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇