Sponsored by Deepsite.site

MCP服务器项目说明

Created By
ningwenjie9 months ago
mcp_server
Content

MCP服务器项目说明

项目概述

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        # 依赖列表

功能特性

  • 文件访问:上传、下载、列表和删除文件
  • 数据库连接:MongoDB集成,支持文档的增删改查
  • API集成:支持调用外部API服务
  • 向量数据库:支持向量存储和相似度搜索
  • Docker部署:完整的Docker配置,支持一键部署
  • 通义千问集成:提供通义千问调用MCP服务器的客户端和示例

快速开始

安装

  1. 克隆项目代码:
git clone https://github.com/ningwenjie/mcp_server
cd mcp_server
  1. 使用Docker Compose启动服务:
docker-compose -f docker/docker-compose.yml up -d
  1. 验证服务是否正常运行:
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

依赖

  • Python 3.10+
  • FastAPI
  • Uvicorn
  • PyMongo
  • FAISS
  • Docker (用于部署)

详细依赖列表请参阅 requirements.txt

许可证

MIT License

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Serper MCP ServerA Serper MCP Server
Amap Maps高德地图官方 MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Tavily Mcp
CursorThe AI Code Editor
Playwright McpPlaywright MCP server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
ChatWiseThe second fastest AI chatbot™
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
DeepChatYour AI Partner on Desktop
WindsurfThe new purpose-built IDE to harness magic
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。