状态投资-MCP服务器
该项目是模型上下文协议(MCP)生态系统的一部分,提供了与外部API交互和管理特定域模型的工具。它旨在演示如何构建具有外部API集成和数据验证的MCP服务器。
An integration that enables MCP tools to query stock market data, such as stock prices, indicators, and payment dates, using the Status Invest API.
目录
特性
- 获取acoes:获取基本库存信息。
- GET-指标:获取详细的库存指标信息。
- get-acoes-付款日期:获取库存付款日期。
- 使用以下方式进行输入验证 萨德.
- 使用与Status Invest API集成
fetch(基础设施层)。
建筑
该项目遵循分层架构,灵感来自 领域驱动设计 (DDD)模式:
- 领域 (
src/domain):
定义表示数据结构的接口和类型(例如。, StatusInvest).
- 基础设施 (
src/infrastructure):
实现外部服务,例如 StatusInvestApiService,负责对Status Invest API进行HTTP调用。
- 应用 (
src/application):
包含业务逻辑 StatusInvestService,它处理和格式化来自基础设施的数据。
- 接口 (
src/interface):
包括控制器(StatusInvestToolsController)在MCP服务器中注册工具,定义验证模式,并返回结果。
- 入口点 (
src/main.ts):
初始化 McpServer,配置传输(StdioServerTransport),实例化服务和控制器,并开始监听 _标准输入输出_.
文件夹结构如下:
src/
├── domain/
│ └── models/ # Domain interfaces
├── infrastructure/
│ └── services/ # External API implementations (Status Invest)
├── application/
│ └── services/ # Business logic and data formatting
├── interface/
│ └── controllers/ # MCP tool registration and validation
└── main.ts # Server entry point
build/ # Compiled JavaScript code
.vscode/ # Contains the mcp.json file, MCP Server config安装
git clone git@github.com:newerton/mcp-status-invest.git
cd mcp-status-invest
npm install
npm run buildVSCode中的MCP服务器配置
- 按
Ctrl+Shift+P并选择“MCP:列出服务器” - 选择“股票”,然后选择“启动服务器”
VSCode中的MCP服务器输出
- 按
Ctrl+Shift+P并选择“MCP:列出服务器” - 选择“库存”,然后选择“显示输出”
贡献
欢迎拉取请求!欢迎提出问题并讨论改进。
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
