A multi-functional computing platform server designed to integrate with large language models like Qwen, providing file access, database connections, API integration, and vector database functionality.
MCP(多功能计算平台)服务器是一个功能强大的后端服务,支持文件访问、数据库连接、API集成和向量数据库访问等多种功能。本项目专为与通义千问(Qwen)等大型语言模型集成而设计,提供了完整的Docker部署配置和通义千问调用示例。
mcp_server/
├── src/ # 源代码目录
│ ├── __init__.py # 初始化模块
│ ├── config.py # 配置管理
│ ├── server.py # 服务器主类
│ └── modules/ # 功能模块
│ ├── __init__.py # 模块注册
│ ├── file_module.py # 文件访问模块
│ ├── database_module.py # 数据库连接模块
│ ├── api_module.py # API集成模块
│ └── vector_module.py # 向量数据库模块
├── docker/ # Docker配置
│ ├── Dockerfile # Docker镜像配置
│ └── docker-compose.yml # Docker Compose配置
├── examples/ # 示例代码
│ ├── qwen_client.py # 通义千问客户端库
│ └── qwen_example.py # 通义千问使用示例
├── docs/ # 文档
│ ├── user_guide.md # 用户指南
│ ├── api_docs.md # API文档
│ └── qwen_examples.md # 通义千问示例说明
├── test_server.py # 服务器测试脚本
├── test_qwen_client.py # 通义千问客户端测试脚本
├── main.py # 主入口文件
└── requirements.txt # 依赖列表
git clone https://github.com/ningwenjie/mcp_server cd mcp_server
docker-compose -f docker/docker-compose.yml up -d
curl http://localhost:8000/health
from examples.qwen_client import QwenMCPClient # 初始化客户端 client = QwenMCPClient("http://localhost:8000") # 上传文件 file_info = client.upload_file("example.txt") # 存储向量 vector = [0.1, 0.2, 0.3] * 512 # 1536维向量 metadata = {"text": "这是一个示例文本", "source": "通义千问"} vector_info = client.store_vector("qwen_embeddings", vector, metadata) # 搜索向量 query_vector = [0.15, 0.25, 0.35] * 512 search_results = client.search_vector("qwen_embeddings", query_vector, top_k=3)
详细文档请参阅:
运行服务器测试:
python test_server.py
运行通义千问客户端测试:
python test_qwen_client.py
详细依赖列表请参阅 requirements.txt
。
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!