Files
mcp-template-python/README.md
2025-07-19 22:50:04 +08:00

59 lines
756 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# MCP FastAPI 应用模板
本项目提供了 FastAPI 集成的 MCP 应用模板。
- [x] 支持多 MCP 挂载
- [x] 支持命令行调用 Stdio 模式
- [x] 支持 SSE / Streamable HTTP 兼容
- [x] 支持打包分发
## 开始
安装依赖:
```bash
uv sync
```
开发:
```bash
uv run dev
```
可通过 <http://127.0.0.1:3001/math/mcp> 访问示例 MCP 接口Streamable HTTP<http://127.0.0.1:3001/math/compatible/sse> 访问 SSE 接口。
通过 `--stdio` 来调用命令行:
```bash
uv run prod --stdio
```
## 部署
生产:
```bash
uv run --no-sync prod
```
构建 Python Wheel 包:
```bash
uv build
```
## Docker 部署
运行:
```bash
docker compose up -d
```
仅构建:
```bash
docker compose build
```