
mcp server
一个基于Python的服务器,用于标准化大型语言模型与外部工具和服务的交互。
Repository Info
About This Server
一个基于Python的服务器,用于标准化大型语言模型与外部工具和服务的交互。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
MCP Server
MCP Server là một máy chủ triển khai giao thức Model Context Protocol (MCP), cho phép các mô hình ngôn ngữ lớn (LLMs) tương tác với các công cụ và dịch vụ bên ngoài một cách chuẩn hóa.
Tính năng
- Hỗ trợ nhiều công cụ khác nhau (calculator, weather, search)
- API RESTful với FastAPI
- Xác thực dữ liệu với Pydantic
- Xử lý bất đồng bộ hiệu quả
- Tài liệu API tự động với Swagger UI
Yêu cầu hệ thống
- Python 3.8+
- pip (Python package manager)
Cài đặt
- Clone repository:
git clone <repository-url>
cd mcp-server
- Tạo và kích hoạt môi trường ảo:
python -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activate
- Cài đặt các thư viện cần thiết:
pip install -r requirements.txt
Chạy server
python main.py
Server sẽ chạy tại địa chỉ: http://localhost:8000
API Endpoints
1. Root Endpoint
- URL:
/ - Method: GET
- Description: Trả về thông tin về server và danh sách các công cụ được hỗ trợ
2. Execute Tool
- URL:
/execute - Method: POST
- Description: Thực thi một công cụ với các tham số được cung cấp
- Request Body:
{
"tool_name": "calculator",
"parameters": {
"operation": "add",
"numbers": [1, 2, 3]
},
"context": {}
}
Các công cụ được hỗ trợ
1. Calculator
- Thực hiện các phép tính cơ bản
- Tham số:
operation: "add" hoặc "multiply"numbers: mảng các số cần tính
2. Weather
- Lấy thông tin thời tiết cho một địa điểm
- Tham số:
location: tên địa điểm
3. Search
- Thực hiện tìm kiếm web
- Tham số:
query: từ khóa tìm kiếm
Tài liệu API
Truy cập http://localhost:8000/docs để xem tài liệu API đầy đủ với Swagger UI.
Phát triển
Thêm công cụ mới
- Thêm tên và mô tả công cụ vào
SUPPORTED_TOOLS - Thêm hàm xử lý mới trong
process_tool_request - Tạo hàm xử lý riêng cho công cụ mới
Chạy tests
pytest
License
MIT License
Quick Start
Clone the repository
git clone https://github.com/devhysterical/mcp-serverInstall dependencies
cd mcp-server
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.