Y2K基金MCP服务器
 
模型上下文协议(MCP)服务器,用于在Claude Desktop中直接查询Y2K基金交易数据。获取实时头寸、市场价格、期权数据等。
特性
可用工具
get_positions-按交易品种查询最新股票头寸
- 退货数量、市值、未实现损益、平均成本 - 显示包含法人实体信息的所有帐户的数据
即将推出
get_market_price-实时市场价格get_call_options-看涨期权数据和分析get_put_options-看跌期权数据和分析get_trades-历史贸易数据get_margin_impact-保证金要求和影响
安装
先决条件
快速安装(推荐)
- 通过Claude桌面配置安装
打开您的Claude Desktop配置文件:
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - 视窗: %APPDATA%\Claude\claude_desktop_config.json - Linux: ~/.config/Claude/claude_desktop_config.json
- 增加Y2K基金MCP服务器
{
"mcpServers": {
"y2kfund": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/y2kfund/y2kfund-mcp",
"y2kfund-mcp"
]
}
}
}- 重新启动克劳德桌面
服务器将在首次使用时自动安装。
替代方案:手动安装
# Install from GitHub
pip install git+https://github.com/y2kfund/y2kfund-mcp.git
# Or clone and install locally
git clone https://github.com/y2kfund/y2kfund-mcp.git
cd y2kfund-mcp
pip install -e .然后更新您的Claude配置以使用direct命令:
{
"mcpServers": {
"y2kfund": {
"command": "y2kfund-mcp"
}
}
}用法
安装后,您可以向Claude自然语言提问:
查询示例
获取职位:
"Get my MSFT positions"
"Show positions for META"
"What are my AAPL holdings?"分析职位:
"Show me all my TSLA positions and calculate the total P&L"
"Compare my MSFT and GOOG positions"
"What's my biggest position loss?"工具参考
get_positions
从Y2K基金账户按代码获取最新股票头寸。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
symbol | string | 是 | 股票代码(例如MSFT、META、AAPL) |
示例响应:
Found 2 position(s) for MSFT:
Position 1:
Account: Y2K Fund LLC
Quantity: 1,500 shares
Market Value: $758,637.41
Current Price: $505.76
Avg Cost: $523.13
Unrealized P&L: -$26,053.08
P&L %: -3.32%
Position 2:
Account: Y2K Fund LP
Quantity: 10,055 shares
Market Value: $5,085,238.31
Current Price: $505.74
Avg Cost: $521.05
Unrealized P&L: -$153,943.86
P&L %: -2.95%
Total Summary:
Total Shares: 11,555
Total Market Value: $5,843,875.72
Total Unrealized P&L: -$179,996.94API端点
此MCP服务器连接到: https://ibkr-data-fetch.y2k.fund
API可供公众查阅,并可从Y2K基金的交易账户返回实时数据。
发展
项目结构
y2kfund-mcp/
├── src/
│ └── y2kfund_mcp/
│ ├── __init__.py
│ ├── server.py # Main MCP server
│ ├── config.py # API configuration
│ └── tools/
│ ├── __init__.py
│ ├── base.py # Base tool class
│ └── positions.py # Positions tool
├── examples/
│ └── claude_config.json # Example configuration
├── pyproject.toml
├── requirements.txt
├── LICENSE
└── README.md添加新工具
- 在中创建新的工具文件
src/y2kfund_mcp/tools/ - 从……继承……
BaseTool - 实施所需的属性和
execute()方法 - 注册
src/y2kfund_mcp/server.py
例子:
# tools/market_price.py
from .base import BaseTool
class MarketPriceTool(BaseTool):
@property
def name(self) -> str:
return "get_market_price"
@property
def description(self) -> str:
return "Get current market price for a symbol"
@property
def input_schema(self):
return {
"type": "object",
"properties": {
"symbol": {"type": "string"}
},
"required": ["symbol"]
}
async def execute(self, arguments):
data = await self.api_call("/query/price", params=arguments)
return f"Price: ${data['price']}"本地运行
# Clone the repo
git clone https://github.com/y2kfund/y2kfund-mcp.git
cd y2kfund-mcp
# Install dependencies
pip install -e .
# Run the server
python -m y2kfund_mcp.server故障排除
“服务器没有响应”
- 检查克劳德桌面日志:
- macOS: ~/Library/Logs/Claude/mcp*.log - 视窗: %APPDATA%\Claude\Logs\mcp*.log
- 验证安装:
uvx --from git+https://github.com/y2kfund/y2kfund-mcp y2kfund-mcp --version- 测试API终点:
curl "https://ibkr-data-fetch.y2k.fund/query/positions?symbol=MSFT"“未知工具”错误
请确保在更新配置后重新启动了Claude Desktop。
API连接问题
服务器需要互联网接入才能连接到 https://ibkr-data-fetch.y2k.fund。检查防火墙设置。
贡献
欢迎投稿!请随时提交拉取请求。
- 分叉存储库
- 创建功能分支(
git checkout -b feature/amazing-feature) - 提交您的更改(
git commit -m 'Add amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
支持
- 问题:
- 讨论:
- 网站: https://y2k.fund
更新日志
v1.0.0(2025-11-11)
- 初始版本
- 添加
get_positions查询库存头寸的工具 - 支持用户特定的帐户别名
- 全面的损益计算和总结
______________________________________________________________________
由以下材料制成❤️ Y2K基金
