高性能MCP协议FastAPI服务器
基于FastAPI的高性能服务器,实现模型上下文协议(MCP),支持与大语言模型(LLM)无缝集成。
快速入门
克隆仓库
git clone https://github.com/yourusername/myaiserv.git
cd myaiserv
安装依赖
如果尚未安装 Poetry,请先安装:
curl -sSL https://install.python-poetry.org | python3 -
安装依赖项:
poetry install
启动服务器
运行以下命令启动服务:
poetry run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
或使用 just 工具:
just run
测试 API
- Swagger UI: http://localhost:8000/docs
- GraphQL 界面: http://localhost:8000/graphql
运行测试
执行测试用例:
poetry run pytest
Docker 部署
构建并启动容器:
docker compose up -d