这是一个与 Scryfall API 对接的 MCP 服务器,可获取并展示详细的标准万智牌 (Magic: The Gathering) 卡牌数据。它支持通过卡牌名称、颜色、类型和文本内容搜索卡牌,为万智牌爱好者和开发者提供了便捷的卡牌信息查询方式。
该项目使用 uv 进行 Python 环境和依赖管理,所有依赖项已声明在 pyproject.toml 文件中。
cargo install uv 安装)uv venv
source .venv/bin/activate # 或者在 Windows 上的 `.venv/Scripts/activate`
uv pip install -r pyproject.toml
运行项目时使用 uv run scryfall.py "Atraxa" 应会显示 Atraxa 卡牌的 Scryfall 结果,不过此项目旨在供 MCP 主机(如 Claude Desktop)运行。
Claude Desktop 可以运行该 MCP 服务器以与 Scryfall API 对接并使用结果。需要安装或更新到最新版本 Claude,并在其配置文件中添加以下内容(如果不存在则创建):
~/Library/Application\ Support/Claude/claude_desktop_config.json 在 MacOS 上$env:AppData\Claude\claude_desktop_config.json 在 Windows 上{
"mcpServers": {
"scryfall": {
"command": "/ABSOLUTE/PATH/TO/BIN/uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/mcp-server",
"run",
"scryfall.py"
]
}
}
}
该项目使用 pytest 进行单元测试,测试文件位于 tests/ 文件夹中。
pytest
pytest tests/test_scryfall.py::test_get_cards_no_query