Mcp Service Broker

Mcp Service Broker

🚀 MCP服务经纪商

MCP服务经纪商是一个基于Spring Cloud Open Service Broker的平台,主要用于注册和绑定模型上下文协议(MCP)服务器。该平台支持Cloud Foundry、本地和Kubernetes等多种环境,为用户提供了便捷的MCP服务器管理方案。

✨ 主要特性

  • 通过Cloud Foundry服务经纪商API或REST API注册MCP服务器。
  • 将MCP服务器绑定到应用程序,在绑定时提供凭证。
  • 提供REST API进行图形化管理。
  • 基于React的UI用于目录浏览和注册(请参见frontend/文件夹)。
  • 配置文件基于持久化,内存适用于本地和Kubernetes环境,Postgres适用于Cloud Foundry环境。
  • 启用actuator端点以提供健康状态和信息监控。

🚀 快速开始

本地开发

./mvnw spring-boot:run -Dspring-boot.run.profiles=local

Cloud Foundry环境

绑定一个Postgres服务,使用cloudfoundry配置文件进行部署。数据源自动从VCAP_SERVICES配置。

REST API使用说明

  • GET /api/mcp-servers — 列出所有MCP服务器。
  • POST /api/mcp-servers — 注册新的MCP服务器(需要JSON格式的请求体)。
  • DELETE /api/mcp-servers/{instanceId} — 删除指定ID的MCP服务器。

用户界面

frontend/文件夹启动基于React的UI(请参见前端README文档)。

📦 安装指南

本地环境

使用以下命令启动应用:

./mvnw spring-boot:run -Dspring-boot.run.profiles=local

Cloud Foundry环境

  1. 绑定一个Postgres服务。
  2. 使用cloudfoundry配置文件进行部署,数据源会自动从VCAP_SERVICES配置。

💻 使用示例

基础用法

列出所有MCP服务器

curl -X GET http://localhost:8081/api/mcp-servers

注册新的MCP服务器

curl -X POST http://localhost:8081/api/mcp-servers -H "Content-Type: application/json" -d '{
"name": "new-mcp-server",
"url": "http://example.com/mcp"
}'

高级用法

删除指定ID的MCP服务器

curl -X DELETE http://localhost:8081/api/mcp-servers/123

📚 详细文档

配置文件说明

属性 详情
配置文件类型 不同环境的配置文件
local 使用内存存储
cloudfoundry 通过JPA连接Postgres数据库(从VCAP_SERVICES自动配置)
kubernetes 使用内存存储

Spring Boot Actuator端点

默认启用以下actuator端点:

  • /actuator/health — 返回应用程序的健康状态(适用于Cloud Foundry、Kubernetes及监控工具)。
  • /actuator/info — 返回应用程序的信息(可在应用属性文件中自定义)。

访问这些端点的方式:

  • 本地:http://localhost:8081/actuator/health 和 http://localhost:8081/actuator/info
  • Cloud Foundry:https://.cfapps.io/actuator/health 和 /actuator/info
  • Kubernetes:http:// :8080/actuator/health 和 /actuator/info

要暴露更多actuator端点,请在属性文件中修改management.endpoints.web.exposure.include配置。

📄 许可证

本项目采用MIT许可证。

  • 0 关注
  • 0 收藏,38 浏览
  • system 提出于 2025-10-05 13:39

相似服务问题

相关AI产品