MCP cover image
See in Github
2025-04-01

1

Github Watches

0

Github Forks

0

Github Stars

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

  1. Clone repository:
git clone <repository-url>
cd mcp-server
  1. 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
  1. 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

  1. Thêm tên và mô tả công cụ vào SUPPORTED_TOOLS
  2. Thêm hàm xử lý mới trong process_tool_request
  3. Tạo hàm xử lý riêng cho công cụ mới

Chạy tests

pytest

License

MIT License

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • apappascs
  • Entdecken Sie die umfassendste und aktuellste Sammlung von MCP-Servern auf dem Markt. Dieses Repository dient als zentraler Hub und bietet einen umfangreichen Katalog von Open-Source- und Proprietary MCP-Servern mit Funktionen, Dokumentationslinks und Mitwirkenden.

  • Mintplex-Labs
  • Die All-in-One-Desktop & Docker-AI-Anwendung mit integriertem Lappen, AI-Agenten, No-Code-Agent Builder, MCP-Kompatibilität und vielem mehr.

  • modelcontextprotocol
  • Modellkontext -Protokollserver

  • n8n-io
  • Fair-Code-Workflow-Automatisierungsplattform mit nativen KI-Funktionen. Kombinieren Sie visuelles Gebäude mit benutzerdefiniertem Code, SelbstHost oder Cloud, 400+ Integrationen.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 llm 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Zusammenfassung der weltbesten LLM -Ressourcen.

  • open-webui
  • Benutzerfreundliche KI-Schnittstelle (unterstützt Ollama, OpenAI-API, ...)

  • wong2
  • Eine kuratierte Liste von Servern des Modellkontextprotokolls (MCP)

  • metorial
  • Containerisierte Versionen von Hunderten von MCP -Servern 📡 🧠

    Reviews

    5 (1)
    Avatar
    user_knTuhqKx
    2025-04-18

    As a dedicated user of mcp-server, I am incredibly impressed with its capabilities and performance. The seamless integration and efficient server management make it a top choice for developers. Kudos to devhysterical for creating such a robust and reliable tool. Highly recommend checking it out on GitHub!