使用说明
克劳德mcp服务器
FastMCP的规格化距离的幂函数MCP服务器示例项目
机能
- 回声工具:一个简单的工具,它直接返回输入的文本
本地测试
1.启动服务器
uv run --with mcp .github/scripts/server.py
服务器是 http://localhost:8000/sse 中所述修改相应参数的值。
2. Claude Code CLI中的连接
# MCPサーバーを追加
claude mcp add --transport sse my-server http://localhost:8000/sse
# 接続を確認
claude mcp list
# Claude Code CLIで対話的にテスト
claude
Claude Code CLI中描述的场景,使用下列步骤创建明细表,以便在概念设计中分析体量的周长:
> mcpのmy-serverをテストしてください
GitHub Actions测试
在动态输入提示中GitHub Actions的Claude Code Action来修改标记元素的显示属性MCP包含自动测试服务器的工作流。
安装,安装
- GitHub在动态输入提示中单击Settings > Secrets and variables > Actions 移到
ANTHROPIC_API_KEY名字Anthropic API添加键
如何运行工作流
工作流可以通过以下三种方式执行:
1. Pull Request自动运行
Pull Request创建或更新时自动MCP将运行服务器测试。
git checkout -b test-branch
git add .
git commit -m "Test MCP server"
git push origin test-branch
# GitHubでPull Requestを作成
2. PR在注释中运行
Pull Request在中 @claude 这样会触发工作流。
@claude MCPサーバーをテストしてください
3.手动実行
- Actions 转到选项卡
- "Test MCP Server" 选择工作流
- "Run workflow" 按钮关闭对话框
工作流行为
- 检出存储库
- Python设置环境
- MCP配置文件(
.mcp/config.json),模板名称将采用不同的格式 - MCP在后台启动服务器
- Claude Code Action使用测试服务器
- 基本文本回声测试
- 测试包含特殊字符的文本
- 日语和图画文字测试
- 测试完成后清理服务器
技术细节
- MCP服务器设置为
--mcp-config用标志传递 - 服务器是
http://localhost:8000/sse(SSE传输)启动 - 通过运行状况检查,最多等待30秒,直到服务器启动
项目配置
.
├── .github/
│ ├── scripts/
│ │ └── server.py # FastMCP Echo Server
│ └── workflows/
│ └── test-mcp.yml # GitHub Actions workflow
├── pyproject.toml # プロジェクト設定
└── .python-version # Python バージョン指定
