FastAPI开发服务器

一个基于FastAPI的开发服务器,支持快速启动、调试和集成检查,适用于API开发和测试。

  • by dudeinthemirror
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 dudeinthemirror/test-mcp-server

使用说明

测试mcp服务器

发展

安装uv

该项目使用 uv 包装商。要在您的计算机上安装它,请运行:

curl -LsSf https://astral.sh/uv/install.sh | sh

安装direnv

此项目使用 direnv 根据当前目录加载和卸载环境变量

brew install direnv

首次进入此项目时,系统将提示您运行:

direnv allow

依赖项

要安装依赖项,请运行:

uv sync

装订、格式化

此项目使用 ruff.Ruff是用Rust编写的,旨在实现极高的速度和效率

# Lint files or directories
ruff check ./src

# Format files
ruff format ./src

# Fix issues automatically
ruff check --fix ./src
  • (可选)在VSCode中,您可以安装Ruff扩展(+卸载Black)

运行和调试

  • 在开发模式下启动服务器
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检查器
npx @modelcontextprotocol/inspector http://127.0.0.1:8088/mcp
  • 在浏览器中打开检查器 http://127.0.0.1:5173
  • 在左侧面板中:
    • 运输类型:SSE
    • 网址: http://127.0.0.1:8088/mcp
    • 点击 Connect