Cover image
Try Now
2025-04-06

个人学习MCP

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

MCP 学习项目⚡

Python 3.10+ 架构: 微服务 测试: Pytest

🌟 项目简介

本项目是一个基于MCP协议的学习项目,主要用于学习MCP Server如何实现。 api_server目录内是一个使用FastAPI库实现的一组API服务接口,用来模拟现有系统的java后端服务,本项目内只是实现了加减乘除四则运算。 tests目录下是一个针对api_server的单元测试程序,用来熟悉pytest功能。 mcp_server目录下是mcp的server内容,包含mcp的两种实现方式

第一种是stdio方式

主要就是本地调用,本地运行的方式,主要实现包含在server.py代码中。 使用方式可以使用cline插件进行调用,下面附上cline调用的cfg配置

{
  "mcpServers": {
    "math": {
      "timeout": 60,
      "command": "mcp",
      "args": [
        "run",
        "\mcp_server\server.py"
      ],
      "transportType": "stdio",
      "disabled": true
    }
  }
}

stdio运行方式

#进入api_server目录下
python main.py
#启动api 服务

#配置好cline的cfg后
#在cline中测试mcp server

第二种是sse方式

使用uvicon生成一个服务,使用cline插件的remote server方式进行配置连接。 主要功能包含在remote_server.py中,下面附上cline的cfg配置

{
  "mcpServers": {
    "calculate": {
      "autoApprove": [
        "calculate_sum",
        "calculate_subtract",
        "calculate_multiply",
        "calculate_divide"
      ],
      "disabled": false,
      "timeout": 60,
      "url": "http://127.0.0.1:8001/sse",
      "transportType": "sse"
    }
  }
}

sse运行方式

#进入api_server目录下
python main.py
#启动api 服务

#进入mcp_server目录下
python remote_server.py
#启动mcp server

#配置好cline的cfg后
#在cline中测试mcp server

🌟 系统架构

graph LR
    Client-->|SSE Streaming| MCP_Server["MCP Server (Port 8001)"]
    MCP_Server-->|HTTP RPC| API_Server["API Server (Port 8000)"]
    API_Server-.->|Call Function| FUNC[(计算函数)]
    
    subgraph 计算服务
        API_Server
    end

✨ 核心功能

  • 🧮 四则运算工具集(加减乘除)
  • 📡 基于SSE的实时消息传输
  • ⚡ 异步HTTP客户端支持
  • 🔒 强类型输入校验

🛠️ 技术栈

🚀 快速开始

前置要求

  • Python 3.10+
  • uv
# 安装依赖
pip install -r requirements.txt

相关推荐

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

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

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

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

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

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

  • Lists Tailwind CSS classes in monospaced font

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

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

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

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

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • JackKuo666
  • 🔍使AI助手可以通过简单的MCP接口搜索和访问PYPI软件包信息。

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

    Reviews

    2 (1)
    Avatar
    user_ZCQpT0tm
    2025-04-18

    Mcp-Server-Study by uoky5217 is an exceptional tool for server management and study. The GitHub repository is well-organized and the instructions are clear, making it accessible even for beginners. The functionality and reliability of this application make it an invaluable resource for both novice and experienced users. Highly recommended for anyone looking to enhance their server management skills. https://github.com/uoky5217/Mcp-Server-Study