Cover image
Try Now
2025-04-11

Model Context Protocol Platform,统一管理你的MCP服务

3 years

Works with Finder

1

Github Watches

8

Github Forks

27

Github Stars

MCPP.Net

MCPP.Net是一个基于.NET 8的Model Context Protocol (MCP)服务器实现,支持将Swagger API动态转换为MCP工具,使AI工具能够通过MCP协议调用这些API。

图片介绍

项目简介

MCPP.Net允许你将任意OpenAPI/Swagger定义的RESTful API服务动态转换为符合Model Context Protocol规范的工具,实现AI模型与外部服务的无缝集成。项目基于.NET 8构建,提供简单易用的API接口和Swagger UI。

主要功能

  • 🔄 动态Swagger导入:通过URL或本地文件导入Swagger/OpenAPI定义
  • 🛠️ 自动工具生成:将API端点自动转换为MCP工具方法
  • 🔌 即插即用:导入后立即可用,无需重启服务
  • 📝 Swagger UI支持:内置Swagger UI,便于API测试和文档查看
  • 📋 工具管理:支持查看和删除已导入的工具
  • 🔄 MCP协议实现:完整支持Model Context Protocol

技术栈

  • .NET 8
  • ASP.NET Core Web API
  • ModelContextProtocol 库
  • Swashbuckle.AspNetCore (Swagger)
  • Newtonsoft.Json

快速开始

系统要求

  • .NET 8 SDK或更高版本
  • Windows/Linux/macOS

安装指南

  1. 克隆仓库

    git clone https://github.com/yourusername/MCPP.Net.git
    cd MCPP.Net
    
  2. 构建项目

    dotnet build src/MCPP.Net
    
  3. 运行项目

    dotnet run --project src/MCPP.Net
    
  4. 访问Swagger UI

    https://localhost:7103/swagger/index.html
    

使用说明

导入Swagger API

  1. 通过POST请求到 /api/Import/Import 导入Swagger:

    {
      "swaggerUrl": "https://petstore.swagger.io/v2/swagger.json",
      "sourceBaseUrl": "https://petstore.swagger.io/v2",
      "nameSpace": "PetStore",
      "className": "PetStoreApi"
    }
    
  2. 系统将自动:

    • 下载并解析Swagger定义
    • 生成适配MCP协议的工具类
    • 注册到MCP服务器
  3. 导入成功后,返回导入结果:

    {
      "success": true,
      "apiCount": 20,
      "toolClassName": "PetStoreApi",
      "importedApis": ["getPet", "updatePet", "..."]
    }
    

管理已导入的工具

  • 获取已导入工具列表:GET /api/Import/GetImportedTools
  • 删除已导入工具:DELETE /api/Import/DeleteImportedTool?nameSpace=PetStore&className=PetStoreApi

连接MCP客户端

MCP客户端可以通过SSE连接到 /sse 端点,然后通过POST请求到 /message 端点发送消息。

项目结构

  • Controllers/:API控制器
    • ImportController.cs:处理Swagger导入相关API
  • Services/:核心服务
    • SwaggerImportService.cs:Swagger导入和动态类型生成服务
    • ImportedToolsService.cs:管理已导入的工具
    • McpServerMethodRegistry.cs:MCP服务器方法注册
  • Models/:数据模型
    • SwaggerImportModels.cs:导入相关模型定义
  • ImportedSwaggers/:存储已导入的Swagger定义
  • ImportedTools/:存储已编译的工具类

贡献指南

欢迎提交问题报告和合并请求。对于重大更改,请先开issue讨论您想要更改的内容。

许可证

MIT

相关推荐

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

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

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

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

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

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

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

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

  • https://reddgr.com
  • Delivers concise Python code and interprets non-English comments

  • 林乔安妮
  • A fashion stylist GPT offering outfit suggestions for various scenarios.

  • 田中 楓太
  • A virtual science instructor for engaging and informative lessons.

  • 1Panel-dev
  • 💬 MaxKB is an open-source AI assistant for enterprise. It seamlessly integrates RAG pipelines, supports robust workflows, and provides MCP tool-use capabilities.

  • ShrimpingIt
  • Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx

  • Mintplex-Labs
  • The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.

  • GLips
  • MCP server to provide Figma layout information to AI coding agents like Cursor

  • open-webui
  • User-friendly AI Interface (Supports Ollama, OpenAI API, ...)

  • Dhravya
  • Collection of apple-native tools for the model context protocol.

  • activepieces
  • AI Agents & MCPs & AI Workflow Automation • (280+ MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

    Reviews

    2 (1)
    Avatar
    user_wl5gDMJI
    2025-04-17

    As a devoted user of MCPP.Net, I find this tool incredibly efficient for my daily tasks. The ease of use and robust features provided by xuzeyu91 make it stand out from similar products. The clear documentation and welcoming community further enhance the user experience. Highly recommended for anyone in need of a reliable solution! Check it out at https://github.com/xuzeyu91/MCPP.Net.