一个与MCP服务器集成的体育博彩数据Python客户端。
graph LR
User([您的代码]) --> Client[Wagyu Sports 客户端] --> API[The Odds API]
MCP[MCP 服务器] --> Client
Client --> MCP
API --> Client --> User
style User fill:#f8f8f8,stroke:#666,stroke-width:1px,color:#000
style Client fill:#4285F4,stroke:#2965C9,stroke-width:2px,color:#fff
style API fill:#F5F5F5,stroke:#999,stroke-width:1px,color:#000
style MCP fill:#34A853,stroke:#1E8E3E,stroke-width:2px,color:#fff
项目已重新组织以提高可维护性:
build/ - 构建相关文件(pyproject.toml, requirements.txt, setup.py)config/ - 配置文件(.env.example, pytest.ini)docs/ - 文档(LICENSE, README.md)examples/ - 示例脚本mcp_server/ - 模型上下文协议(MCP)服务器实现tests/ - 测试文件# 开发安装
uvx install -e .
# 用户安装
uv install wagyu_sports
# 设置API密钥
cp config/.env.example config/.env
# 编辑.env并添加来自https://the-odds-api.com/的API密钥
from wagyu_sports import OddsClient
import os
from dotenv import load_dotenv
# 加载API密钥
load_dotenv(dotenv_path="config/.env")
api_key = os.getenv("ODDS_API_KEY")
# 创建客户端并获取运动项目
client = OddsClient(api_key)
sports = client.get_sports()
print(f"可用运动项目: {len(sports['data'])}")
查看examples/目录了解使用模式:
examples/example.py: 基本用法examples/advanced_example.py: 高级功能examples/verify_install.py: 验证安装examples/fetch_nba_odds.py: 获取NBA赔率示例examples/verify_import.py: 简单导入验证测试套件已清理并改进,以提高组织性和可靠性。使用pytest运行测试:
# 安装测试依赖项
uvx install pytest pytest-asyncio
# 运行所有测试
uvx run pytest --rootdir=. -c config/pytest.ini
# 运行特定测试文件
uvx run pytest tests/test_simple_mcp.py
或者使用Makefile:
make test
测试套件包括:
更多关于测试方法的详情,请参阅tests/README.md文件。
有关运行和配置MCP服务器的详细信息,请参阅主README.md文件。 </中文翻译>