NFL交易 MCP
用于从 ProSportsTransactions.com 抓取 NFL 交易数据的模块化命令行程序 (MCP)。
特征
- 使用灵活的过滤选项获取 NFL 交易:
- 球员/教练/高管变动(交易、自由球员签约、选秀权等)
- 伤病储备的转移
- 往返小联盟的流动(NFL 欧洲)
- 因伤缺席比赛
- 因个人原因缺席比赛
- 纪律处分(停职、罚款等)
- 法律/刑事事件
- 按球队、球员、日期范围和交易类型进行筛选
- 以 CSV、JSON 或 DataFrame 格式输出数据
- 列出所有 NFL 球队和交易类型
安装
# Clone the repository
git clone <repository-url>
cd nfl_transactions_mcp
# Install requirements
pip install -r requirements.txt
与游标一起使用
要将此 MCP 与 Cursor 一起使用,请将以下配置添加到您的.cursor/mcp.json
文件:
{
"mcpServers": {
"nfl-transactions": {
"command": "python server.py",
"env": {}
}
}
}
直接运行 MCP
# Run the MCP server via Cursor
cursor run-mcp nfl-transactions
可用工具
1. fetch_transactions
根据指定的过滤器获取 NFL 交易。
参数:
start_date
(必需):开始日期,格式为 YYYY-MM-DDend_date
(必需):结束日期,格式为 YYYY-MM-DDtransaction_type
(可选,默认值:“全部”):要过滤的交易类型team
(可选):团队名称player
(可选):玩家姓名output_format
(可选,默认值:“json”):输出格式(csv、json 或 dataframe)
例子:
{
"jsonrpc": "2.0",
"method": "fetch_transactions",
"params": {
"start_date": "2023-01-01",
"end_date": "2023-12-31",
"transaction_type": "Injury",
"team": "Patriots"
},
"id": 1
}
2. 列出团队
列出所有可供过滤的 NFL 球队。
例子:
{
"jsonrpc": "2.0",
"method": "list_teams",
"id": 2
}
3. 列出交易类型
列出可供过滤的所有交易类型。
例子:
{
"jsonrpc": "2.0",
"method": "list_transaction_types",
"id": 3
}
与超级代理集成
此 MCP 旨在轻松与 AI 代理或超级代理集成。代理可以通过 JSON-RPC 请求与此 MCP 交互,并根据用户查询检索 NFL 交易数据。
代理集成示例:
# Example of an agent calling the MCP
import json
import subprocess
def call_mcp(method, params=None):
request = {
"jsonrpc": "2.0",
"method": method,
"params": params or {},
"id": 1
}
# Call the MCP via cursor
cmd = ["cursor", "run-mcp", "nfl-transactions"]
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
# Send the request and get the response
response, _ = proc.communicate(json.dumps(request))
return json.loads(response)
# Example: Get Patriots injury transactions from 2023
result = call_mcp("fetch_transactions", {
"start_date": "2023-01-01",
"end_date": "2023-12-31",
"transaction_type": "Injury",
"team": "Patriots"
})
print(f"Found {len(result['data'])} transactions")
执照
MIT 许可证