MC

mclenhard/catie-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

33 stars 1 forks 质量 51 趋势 11MIT

一个轻量级、可配置的反向代理,用于路由和负载均衡MCP(模型上下文协议)请求,基于请求内容向相应后端服务进行路由和负载均衡。

概览

一个轻量级、可配置的反向代理,用于路由和负载均衡MCP(模型上下文协议)请求,基于请求内容向相应后端服务进行路由和负载均衡。 如需详细文档,请访问Catie MCP文档。 - 基于工具调用的 MCP JSON-RPC 请求动态路由 - 将多个不同 MCP 服务器的工具串接,使客户端在无需安装多台服务器的情况下获得所有工具的统一视图。- 会话感知路由以维护客户端与同一后端的连接 - 支持带有 SSE(服务器发送事件)的可流式 HTTP 传输 - 工具名称映射和命名空间以解决不同后端间的命名冲突 - Prometheus 指标集成以实现可观察性 - 使用 Docker 进行容器化部署 - 用于监控界面的基本认证 该应用程序结构化为几个包: - 指挥官/主司令。

概述(AI 翻译)

一个轻量级、可配置的反向代理,用于路由和负载均衡MCP(模型上下文协议)请求,基于请求内容向相应后端服务进行路由和负载均衡。

如需详细文档,请访问Catie MCP文档。

特色

  • 基于工具调用的 MCP JSON-RPC 请求动态路由
  • 将多个不同MCP服务器的工具串接起来,使客户端无需安装多个服务器即可统一查看所有工具。
  • 会话感知路由,以保持客户端连接到同一后端
  • 支持通过SSE(服务器发送事件)进行可流式HTTP传输
  • 工具名称映射和命名空间,以解决不同后端之间的命名冲突
  • Prometheus指标集成以实现可观测性
  • 使用 Docker 进行容器化部署
  • 用于监控UI的基本认证

建筑

该应用程序结构化为几个包:

  • cmd/main.go - 应用入口点带服务器设置
  • pkg/config - 配置加载和管理
  • pkg/router - 请求路由与代理逻辑
  • pkg/session - 用于维护客户端连接的会话管理
  • pkg/logger - 结构化日志系统

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Catie - Context Aware Traffic Ingress Engine

A lightweight, configurable reverse proxy for routing and load balancing MCP (Model Context Protocol) requests to appropriate backend services based on request content.

For detailed documentation, visit Catie MCP Documentation.

Features

  • Dynamic routing of MCP JSON-RPC requests based on tool call
  • Concatenate tools from multiple different MCP Servers so the client gets a unified view of all tools without the user installing multiple servers.
  • Session-aware routing to maintain client connections to the same backend
  • Support for Streamable HTTP transport with SSE (Server-Sent Events)
  • Tool name mapping and namespacing to resolve naming conflicts between different backends
  • Prometheus metrics integration for observability
  • Containerized deployment with Docker
  • Basic authentication for monitoring UI

Architecture

The application is structured into several packages:

  • cmd/main.go - Application entry point with server setup
  • pkg/config - Configuration loading and management
  • pkg/router - Request routing and proxy logic
  • pkg/session - Session management for maintaining client connections
  • pkg/logger - Structured logging system
  • pkg/ui - Simple web UI for monitoring

Configuration

The router is configured using a YAML file (router_config.yaml). Here’s an example configuration:

resources:
  "^weather/.*": "http://weather-service:8080/mcp"
  "^database/.*": "http://database-service:8080/mcp"
tools:
  "^calculator$": "http://calculator-service:8080/mcp"
  "^translator$": "http://translator-service:8080/mcp"
toolMappings:
  - originalName: "weather"
    targetName: "getWeather"
    target: "http://weather-service:8080/mcp"
  - originalName: "search"
    targetName: "googleSearch"
    target: "http://search-service:8080/mcp"
default: "http://default-service:8080/mcp"
ui:
  username: "admin"
  password: "your_secure_password"

The configuration consists of:

  • resources: Regex patterns for resource URIs and their target endpoints
  • tools: Regex patterns for tool names and their target endpoints
  • toolMappings: Mappings for tool name transformations to resolve naming conflicts
  • default: Fallback endpoint for requests that don’t match any pattern
  • ui: Authentication credentials for the monitoring UI

The configuration file is automatically reloaded when changes are detected.

Tool Name Mapping

The tool name mapping feature allows you to present a unified tool interface to clients while handling naming differences across backend MCP servers. This is useful when:

  • Different backends use different names for similar functionality
  • You want to present a simplified or standardized naming scheme to clients
  • You need to avoid naming conflicts between tools from different backends

For each tool mapping, specify:

  • originalName: The name presented to clients
在 GitHub 查看完整 README

安装

docker run -p 80:80 -v $(pwd)/router_config.yaml:/root/router_config.yaml mcp-router-proxy
新手?先看 mcpskill.org 教程 →