zhdddd-mcp-knowledge-server
基于FastAPI的本地知识库MCP服务器,集成FAISS向量库,支持文档上传、向量检索和MCP协议接口。
功能特性
- 文档上传与解析:支持上传文档并自动拆分为文本块,提高检索精度
- 向量检索:使用FAISS向量库实现高效的相似度搜索
- MCP协议接口:支持标准的MCP协议,供大模型调用
- 工具列表与调用:实现了
/tools/list和/tools/call接口,符合MCP规范 - 健康检查:提供服务健康状态检查接口
安装方法
从PyPI安装
pip install zhdddd-mcp-knowledge-server
使用uvx启动
uvx zhdddd-mcp-knowledge-server
快速开始
-
启动服务器:
zhdddd-mcp-knowledge-server
或使用uvx:
uvx zhdddd-mcp-knowledge-server -
服务默认运行在:
http://0.0.0.0:8000
主要接口
健康检查
- GET
/health- 检查服务状态
文档上传
- POST
/upload/document- 上传文档并解析入库
向量检索
- POST
/retrieve- 检索相似文档
MCP协议接口
- POST
/mcp/invoke- MCP协议调用接口 - GET
/mcp/info- 服务信息和工具列表
工具接口(标准MCP规范)
- GET
/tools/list- 获取可用工具列表 - POST
/tools/call- 调用指定工具
集合信息
- GET
/collection/info- 获取知识库信息
示例使用
上传文档
curl -X POST "http://localhost:8000/upload/document" \
-F "file=@example.txt"
检索文档
curl -X POST "http://localhost:8000/retrieve" \
-H "Content-Type: application/json" \
-d '{"query": "ESOP是什么"}'
MCP工具调用
curl -X POST "http://localhost:8000/tools/call" \
-H "Content-Type: application/json" \
-d '{"tool": "retrieve_knowledge", "parameters": {"query": "ESOP是什么"}}'
配置说明
服务默认配置:
- 主机:0.0.0.0
- 端口:8000
- 向量维度:768
- 文档拆分大小:500字符
- 文本块重叠:100字符
依赖项
- fastapi
- uvicorn
- faiss-cpu
- numpy
- packaging
- python-multipart
- pydantic
- pydantic-settings
- python-dotenv
许可证
MIT License
Metadata
Release files for zhdddd-mcp-knowledge-server 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| zhdddd_mcp_knowledge_server-0.1.1.tar.gz | 9.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zhdddd_mcp_knowledge_server-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.5 kB
Release files / zhdddd_mcp_knowledge_server-0.1.1.tar.gz
| Download URL | zhdddd_mcp_knowledge_server-0.1.1.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72a54f2cde84ee3d63f2fff7a83989bb7b8d23c13f530b913d8a9ad3c705ea48
|
|
BLAKE2b-256 checksum How to use checksums |
36a444639466a19676487bd885ea241425125f407d82b9db1322c28a8ff357af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / zhdddd_mcp_knowledge_server-0.1.1-py3-none-any.whl
| Download URL | zhdddd_mcp_knowledge_server-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fef25798b83b2edf4d0852b7a7dcdc2ad69312d2246686e543e7255f641a99b
|
|
BLAKE2b-256 checksum How to use checksums |
60848b40b5888a98ceaaa3b9d5cc49ebc31754d4704b34d0ec9478bb5caaf80f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for zhdddd-mcp-knowledge-server 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.