MCP Server
Integrates with GitHub, Neo4j, PostgreSQL, and Milvus, enabling queries and data retrieval across these services.
README
MCP Server
Đây là một server được xây dựng bằng FastMCP, cung cấp một tập hợp các công cụ để tương tác với nhiều dịch vụ và cơ sở dữ liệu khác nhau, bao gồm GitHub, Neo4j, PostgreSQL, và Milvus.
Hướng dẫn Cài đặt và Chạy
Dự án này hỗ trợ hai kịch bản hoạt động chính:
- Local Development (stdio): Chạy server trực tiếp trên máy tính của bạn để phát triển và gỡ lỗi. Kết nối thông qua Standard I/O.
- Remote Deployment (HTTP): Triển khai server lên một máy chủ từ xa và truy cập qua mạng. Đây là kịch bản dành cho production.
Kịch bản 1: Local Development (Chạy trên máy cá nhân)
Sử dụng kịch bản này khi bạn đang phát triển hoặc thử nghiệm các tính năng mới.
1. Cài đặt:
- Clone repository về máy.
- Tạo file
.envvà điền các thông tin cần thiết (xem mục Cấu hình file .env bên dưới). - Cài đặt các thư viện:
uv pip install -r pyproject.toml
2. Cấu hình mã nguồn:
Đảm bảo dòng cuối cùng trong file mcp_server.py được đặt ở chế độ stdio:
if __name__ == "__main__":
mcp.run(transport='stdio')
3. Cấu hình trong Claude Desktop (hoặc công cụ tương tự):
Thêm một server mới với cấu hình chạy lệnh local:
- Command:
D:\path\to\your\project\mcp_server\.venv\Scripts\uv.exe(thay bằng đường dẫn thực tế) - Arguments:
run mcp_server.py - Working Directory:
D:\path\to\your\project\mcp_server(thay bằng đường dẫn thực tế)
Kịch bản 2: Remote Deployment (Triển khai lên Server từ xa)
Sử dụng kịch bản này để đưa ứng dụng vào hoạt động và truy cập từ bất kỳ đâu.
Bước 1: Chỉnh sửa mã nguồn để chạy ở chế độ HTTP
Trong file mcp_server.py, thay đổi dòng cuối cùng để server chạy ở chế độ HTTP:
if __name__ == "__main__":
# Chạy server ở chế độ HTTP, lắng nghe trên tất cả các địa chỉ IP ở port 8000
mcp.run(transport='http', host='0.0.0.0', port=8000)
Bước 2: Đẩy code lên Git
Đảm bảo file .env đã có trong .gitignore để không đưa thông tin nhạy cảm lên repository.
git add mcp_server.py
git commit -m "feat: Switch to HTTP transport for remote deployment"
git push origin main
Bước 3: Chuẩn bị và Triển khai lên Server Remote (Ví dụ: Ubuntu)
-
SSH vào server và cài đặt các công cụ cần thiết:
sudo apt update sudo apt install -y git python3 python3-pip curl -LsSf https://astral.sh/uv/install.sh | sh -
Clone project về server:
git clone <your_repository_url> cd mcp_server -
Cài đặt thư viện:
uv pip install -r pyproject.toml -
Tạo file
.envtrên server và điền các giá trị cấu hình cho môi trường production.nano .env -
Mở port trên firewall (ví dụ port 8000):
sudo ufw allow 8000/tcp sudo ufw reloadLưu ý: Nếu dùng AWS, GCP, Azure, bạn cần mở port trong Security Group/Network Rules.
Bước 4: Chạy ứng dụng như một Dịch vụ (Systemd)
-
Tạo file service:
sudo nano /etc/systemd/system/mcp_server.service -
Dán nội dung sau vào file (thay
your_usernamevà đường dẫn cho đúng):[Unit] Description=MCP Server Application After=network.target [Service] User=your_username Group=your_username WorkingDirectory=/home/your_username/mcp_server ExecStart=/home/your_username/.cargo/bin/uv run /home/your_username/mcp_server/mcp_server.py Restart=always RestartSec=3 [Install] WantedBy=multi-user.target -
Kích hoạt và khởi động service:
sudo systemctl daemon-reload sudo systemctl enable mcp_server.service sudo systemctl start mcp_server.service -
Kiểm tra trạng thái:
sudo systemctl status mcp_server.service
Bước 5: Kết nối từ Claude Desktop
Trong ứng dụng của bạn, thêm một server mới với cấu hình URL:
- Server URL:
http://<your_remote_server_ip>:8000(thay bằng IP public của server bạn).
Cấu hình file .env
Tạo file .env trong thư mục gốc của dự án và điền các thông tin sau:
# GitHub Personal Access Token
GITHUB_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# Neo4j Connection Details
NEO4J_URI="bolt://localhost:7687"
NEO4J_USER="neo4j"
NEO4J_PASSWORD="your_neo4j_password"
# PostgreSQL Connection Details
POSTGRES_HOST="localhost"
POSTGRES_PORT="5432"
POSTGRES_USER="postgres"
POSTGRES_PASSWORD="your_postgres_password"
POSTGRES_DB="your_database_name"
# Milvus Connection Details
MILVUS_HOST="localhost"
MILVUS_PORT="19530"
MILVUS_USER="your_milvus_user"
MILVUS_PASSWORD="your_milvus_password"
Các Công Cụ Có Sẵn
get_github_user_info()get_github_repos()run_neo4j_query(query: str)run_postgres_query(query: str)list_milvus_collections()search_milvus_collection(...)
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.