测试 MCP 服务器
一个用于开发和调试的 Python 服务端项目。
快速入门
环境准备
- 安装
uv
包管理工具:
curl -LsSf https://astral.sh/uv/install.sh | sh
2. 安装 `direnv` 工具(macOS 使用 Homebrew):
```shell
brew install direnv
首次进入项目目录时运行:
direnv allow
- 安装依赖:
uv sync
## 开发与调试
- 启动开发服务器:
```shell
uv run fastapi dev src/main.py --host 127.0.0.1 --port 8088
- 或者运行简单集成文件:
uv run fastapi dev src/simple_integration.py --host 127.0.0.1 --port 8088
- 启动 MCP 检查器:
```shell
npx @modelcontextprotocol/inspector http://127.0.0.1:8088/mcp
- 在浏览器中打开检查器:
http://127.0.0.1:5173
格式化与检查
- 使用 Ruff 检查代码:
ruff check ./src
- 格式化代码:
```shell
ruff format ./src
- 自动修复问题:
ruff check --fix ./src