
一个用于在AMQP上运行MCP的SDK
概览
模型上下文协议(MCP)的AMQP传输实现,使MCP服务器和客户端能够通过如RabbitMQ等AMQP消息代理进行通信。 - : 消息代理负责保证送达、自动重试、错误处理和死信队列(DLQ)管理 - : 消息会被持久化,因此如果MCP服务器故障,服务器恢复后请求可以重新投递 - : 通过简单绑定额外队列到交换处,增加更多MCP服务器实例——代理自动负载均衡请求 - : 利用消息流进行分析、数据湖存储、自定义护栏、安全策略,并与现有企业消息总线基础设施无缝集成 - : 基于AMQP 0.9.1和AMQP 1.0协议的完整实现MCP传输- : AMQP 0.9.1支持客户端AMQPTransport和ServerAMQPTransport类,以及用于AMQP 1的客户端AMQP10Transport和ServerAMQP10Transport。
概述(AI 翻译)
模型上下文协议(MCP)的AMQP传输实现,使MCP服务器和客户端能够通过如RabbitMQ等AMQP消息代理进行通信。
福利
- 降低复杂性:消息代理处理保证送达、自动重试、错误处理和死信队列(DLQ)管理
- 容错:消息被持久化,因此如果MCP服务器故障,服务器恢复后请求可以重新传递
- 易于扩展:通过简单绑定额外队列到交换点,增加更多MCP服务器实例——代理者自动负载均衡请求
- 可扩展性:利用消息流进行分析、数据湖存储、定制护栏、安全策略,并与现有企业消息总线基础设施无缝集成
特色
- AMQP 传输层:基于 AMQP 0.9.1 和 AMQP 1.0 协议实现的 MCP 传输
- 客户端和服务器支持:AMQP 0.9.1 的
ClientAMQPTransport和ServerAMQPTransport类,以及 AMQP 1.0 的ClientAMQP10Transport和ServerAMQP10Transport - CLI 适配器:用于桥接基于 stdio 的 MCP 服务器/客户端的命令行工具,支持AMQP(两种协议)
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MCP AMQP Transport [beta]
AMQP transport implementation for the Model Context Protocol (MCP), enabling MCP servers and clients to communicate over AMQP message brokers like RabbitMQ.
Benefits
- Reduced Complexity: Message broker handles guaranteed delivery, automatic retries, error handling, and dead-letter queue (DLQ) management
- Fault Tolerance: Messages are persisted, so if an MCP server fails, requests can be redelivered once the server recovers
- Easy Scaling: Add more MCP server instances by simply binding additional queues to the exchange—the broker automatically load-balances requests
- Extensibility: Tap into message flows for analytics, data lake storage, custom guardrails, security policies, and seamless integration with existing enterprise message bus infrastructure
Features
- AMQP Transport Layer: Full implementation of MCP transport over AMQP 0.9.1 and AMQP 1.0 protocols
- Client & Server Support: Both
ClientAMQPTransportandServerAMQPTransportclasses for AMQP 0.9.1, plusClientAMQP10TransportandServerAMQP10Transportfor AMQP 1.0 - CLI Adaptors: Command-line tools to bridge stdio-based MCP servers/clients with AMQP (both protocols)
- Interceptor Framework: Base class for building message interceptors
- Flexible Configuration: Support for environment variables and direct configuration
- TLS Support: Secure connections with AMQPS
Installation
npm install -g @aws/mcp-amqp-transport
Usage
Using Transport Classes
You need to configure the following environment variables:
AMQP_HOSTNAME - AMQP broker hostname
AMQP_USERNAME - username for your broker
AMQP_PASSWORD - password for your broker
AMQP_PORT - AMQP broker port (default: 5672 for AMQP, 5671 for AMQPS)
AMQP_USE_TLS - Use TLS connection (default: true)
Example:
export AMQP_HOSTNAME=localhost
export AMQP_PORT=5672
export AMQP_USERNAME=guest
export AMQP_PASSWORD=guest
export AMQP_USE_TLS=false
AMQP 0.9.1 Transport (Default)
Server Transport
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { ServerAMQPTransport } from '@aws/mcp-amqp-transport';
const server = new Server(
{ name: 'my-server', version: '1.0.0' },
{ capabilities: {} }
);
// Configuration via environment variables
const transport = new ServerAMQPTransport({
name: 'my-server',
exchangeName: 'mcp-exchange'
// hostname, port, username, password read from environment variables
});
await server.connect(transport);
Client Transport
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { ClientAMQPTransport } from '@aws/mcp-amqp-transport';
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →