使用说明
MCP服务器集合
此存储库包含以下内容的集合 模型上下文协议(MCP) 可用于的服务器 亚马逊Q, 克劳德桌面以及支持MCP协议的其他LLM。
可用的MCP服务器
-
Capital.com MCP服务器:展示Capital.com交易API作为交易操作的MCP工具
- 搜索市场(如欧元、美元、苹果)
- 获取账户信息和头寸
- 创建和管理交易头寸
- 访问监视列表
-
eToro MCP服务器:展示eToro交易API作为交易操作的MCP工具
- 按名称、符号或类别搜索仪器
- 获取账户信息(余额、权益、保证金)
- 获取和管理未平仓交易头寸
- 利用杠杆建立头寸,止损并获利
- 获取工具的实时买卖价格
- 访问详细的工具元数据(交易时间、点差、限额)
什么是MCP?
模型上下文协议(MCP) 是一个开放协议,规范了应用程序如何向LLM提供上下文。MCP支持系统和本地运行的MCP服务器之间的通信,这些服务器提供额外的工具和资源来扩展LLM功能。
先决条件
确保你有 uv 安装在您的系统上:
curl -LsSf https://astral.sh/uv/install.sh | sh
使用亚马逊Q
-
创建一个
mcp.jsonAmazon Q配置目录中的配置文件(~/.aws/amazonq/mcp.json):{ "mcpServers": { "capital-com-mcp-server": { "command": "uvx", "args": ["capital-com-mcp-server"], "env": { "CAPITAL_BASE_URL": "https://demo-api-capital.backend-capital.com", "CAPITAL_API_KEY": "your_api_key_here", "CAPITAL_PASSWORD": "your_password_here", "CAPITAL_IDENTIFIER": "your_email@example.com", "FASTMCP_LOG_LEVEL": "ERROR" } }, "etoro-mcp-server": { "command": "uvx", "args": ["etoro-mcp-server"], "env": { "ETORO_API_KEY": "your_public_app_key_here", "ETORO_USER_KEY": "your_user_key_here", "ETORO_ACCOUNT_TYPE": "demo", "FASTMCP_LOG_LEVEL": "ERROR" } } } } -
使用以下方式运行Amazon Q:
q chat -
Amazon Q将自动启动MCP服务器并连接到它。
与Claude Desktop一起使用
-
在Claude Desktop中,转到“设置”>“开发人员”部分,然后单击“编辑配置”
-
这将打开配置文件。将以下内容添加到JSON中:
{ "mcpServers": { "capital-com-mcp-server": { "command": "uvx", "args": ["capital-com-mcp-server"], "env": { "CAPITAL_BASE_URL": "https://demo-api-capital.backend-capital.com", "CAPITAL_API_KEY": "your_api_key_here", "CAPITAL_PASSWORD": "your_password_here", "CAPITAL_IDENTIFIER": "your_email@example.com", "FASTMCP_LOG_LEVEL": "ERROR" } }, "etoro-mcp-server": { "command": "uvx", "args": ["etoro-mcp-server"], "env": { "ETORO_API_KEY": "your_public_app_key_here", "ETORO_USER_KEY": "your_user_key_here", "ETORO_ACCOUNT_TYPE": "demo", "FASTMCP_LOG_LEVEL": "ERROR" } } } } -
保存文件并重新启动Claude Desktop。
对话示例
Capital.com
You: Search for Apple stock on Capital.com
AI: I'll search for Apple stock on Capital.com for you.
[Uses capital-com-mcp-server___search_markets tool]
I found Apple Inc. (AAPL) on Capital.com. Here are the details:
- Epic: AAPL
- Market name: Apple Inc.
- Current bid price: $184.25
- Current ask price: $184.30
- Market status: OPEN
Would you like me to get more information about this stock or perform any trading operations?
eToro
You: Search for Apple stock on eToro
AI: I'll search for Apple stock on eToro for you.
[Uses search_instruments tool with search_term="Apple"]
I found Apple Inc. on eToro. Here are the details:
- Instrument ID: 1001
- Name: Apple Inc.
- Symbol: AAPL
- Category: Stocks
- Current price: $184.25
- Market status: OPEN
Note: The instrument ID (1001) is what you'll need for trading operations.
You: Buy $1000 worth of Bitcoin with 2x leverage and set a stop loss at $60,000
AI: I'll create a Bitcoin position with your specified parameters.
[Uses search_instruments to find Bitcoin instrument ID, then create_position]
Successfully created a BUY position for Bitcoin:
- Position ID: pos_abc123
- Instrument ID: 2045 (Bitcoin)
- Amount: $1,000
- Leverage: 2x
- Stop loss: $60,000
- Status: OPEN
- Current P&L: $0.00
The position is now active and being monitored.
仓库结构
每个MCP服务器都被组织为一个单独的Python包 src/ 目录:
mcp-servers/
├── README.md
└── src/
├── capital_com_mcp_server/
│ ├── README.md
│ ├── pyproject.toml
│ ├── capital_com_mcp_server/
│ │ ├── __init__.py
│ │ ├── capital_mcp_server.py
│ │ └── capital_client.py
│ └── ...
└── etoro_mcp_server/
├── README.md
├── pyproject.toml
├── etoro_mcp_server/
│ ├── __init__.py
│ ├── etoro_mcp_server.py
│ └── etoro_client.py
└── ...
发展
要将新的MCP服务器添加到此集合中,请执行以下操作:
- 在下创建新目录
src/使用您的服务器名称 - 为您的MCP服务器实现添加必要的文件
- 包括a
pyproject.toml和setup.py在服务器目录中 - 添加带有使用说明的README.md
出版
每个MCP服务器都可以独立发布到PyPI:
cd src/your_mcp_server
uv build
uv pip publish
GitHub操作
此存储库使用GitHub Actions在创建新版本时自动构建包并将其发布到PyPI。工作流配置为使用矩阵策略,允许独立构建和发布每个包。
要将新包添加到发布工作流中,请在中更新矩阵 .github/workflows/python-publish.yml:
strategy:
matrix:
package: [capital_com_mcp_server, etoro_mcp_server]
资源
许可证
此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。