Securities prices MCP server sample

Securities prices MCP server sample

site icon
2025.04.14 0
C#金融数据服务证券数据分析金融服务
mcp-investments-sample 是一个基于 C# MCP SDK 的示例服务器,主要用于发布与证券相关的信息作为 MCP 工具。它提供了获取证券当前信息、按行业获取证券、获取历史数据以及获取行业表现等功能,适用于金融数据分析和查询场景。
View on GitHub

Overview

基本能力

产品定位

mcp-investments-sample 是一个金融数据服务示例,专注于提供证券相关的实时和历史数据。

核心功能

  • GetCurrentSecurityInfo: 获取指定股票代码的当前价格、交易量等信息。
  • GetSecuritiesBySector: 获取指定行业内所有证券的信息。
  • GetHistoricalData: 获取指定股票代码在特定日期范围内的历史价格和交易量数据。
  • GetSectorPerformance: 获取指定行业的价格变动和平均交易量。

适用场景

  • 金融数据分析
  • 证券行业比较
  • 历史数据查询

工具列表

  1. GetCurrentSecurityInfo: 获取单个证券的实时数据。
  2. GetSecuritiesBySector: 获取特定行业内的所有证券数据。
  3. GetHistoricalData: 查询证券的历史表现。
  4. GetSectorPerformance: 分析行业的整体表现。

常见问题解答

  • 数据来源: 数据来自 ./api/Data 目录下的静态 JSON 文件。

使用教程

使用依赖

  • 需要安装 .NET SDK。

安装教程

  1. 克隆仓库并打开根目录。
  2. 使用 dotnet build 构建解决方案。
  3. 配置 Claude for Desktop 以加载服务器,mcpServers 部分应包含类似以下代码片段:
"securities": {
    "command": "dotnet",
    "args": [
        "run",
        "--project",
        "<path>\\mcp-investments-sample\\mcp-server",
        "--no-build"
    ]
}

调试方式

  • 运行 dotnet run --project <path>\\mcp-investments-sample\\mcp-server --no-build 启动服务器。

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。