Skip to content

Commit 03849cc

Browse files
authored
feat: rabbitmq mcp server (#379)
1 parent 70c8174 commit 03849cc

14 files changed

Lines changed: 4684 additions & 0 deletions

File tree

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# RabbitMQ MCP Server
2+
3+
RabbitMQ MCP Server 是一个模型上下文协议(Model Context Protocol,MCP)服务器,为 MCP 客户端(如 Claude Desktop)提供与火山引擎 RabbitMQ 服务交互的能力。
4+
5+
## Tools
6+
本 MCP Server 产品提供以下 Tools(工具/能力):
7+
8+
### Tool 1: 查询可用区列表(DescribeAvailabilityZones)
9+
10+
#### 类型
11+
SaaS(云 API)
12+
13+
#### 详细描述
14+
查询指定地域下支持 RabbitMQ 的可用区列表,便于在创建实例或规划容灾架构时选择合适的部署位置。
15+
16+
#### 调试所需的输入参数
17+
- RegionId(string):地域 ID,例如 cn-beijing。
18+
19+
#### 输出
20+
- RegionId:请求的地域 ID。
21+
- Zones:可用区列表,每个可用区包含可用区 ID、名称等信息。
22+
23+
#### 最容易被唤起的 Prompt 示例
24+
- 列出北京地域的可用区。
25+
- 查看 cn-beijing 下可以创建 RabbitMQ 实例的可用区列表。
26+
27+
### Tool 2: 查询地域列表(DescribeRegions)
28+
29+
#### 类型
30+
SaaS(云 API)
31+
32+
#### 详细描述
33+
查询当前账号支持的 RabbitMQ 地域列表,用于选择实例部署地域或规划多地域容灾架构。
34+
35+
#### 调试所需的输入参数
36+
- 无:此工具无需额外输入参数。
37+
38+
#### 输出
39+
- Regions:地域列表,每个地域包含地域 ID、名称等基础信息。
40+
41+
#### 最容易被唤起的 Prompt 示例
42+
- 列出当前支持 RabbitMQ 的所有地域。
43+
- 帮我查看有哪些地域可以创建 RabbitMQ 实例。
44+
45+
## 可适配平台
46+
可以使用 cline、cursor、claude desktop 或支持 MCP Server 调用的其它终端。
47+
48+
## 服务开通链接
49+
[开通 RabbitMQ 服务](https://console.volcengine.com/rabbitmq),未开通的用户会自动重定向到开通页;如果已经开通,则会跳转控制台首页。
50+
51+
## 鉴权方式
52+
53+
### 火山 OpenAPI 鉴权
54+
通过 AK/SK(签名机制)访问火山 OpenAPI。默认从环境变量读取(推荐)。
55+
56+
### MCP Client 鉴权(可选)
57+
可通过配置 `auth=oauth` 为 MCP Client 增加 OAuth 身份认证(仅 SSE 模式适用)。
58+
59+
## 安装部署
60+
61+
### 系统依赖
62+
- 安装 Python 3.10 或者更高版本
63+
- 安装 uv
64+
65+
### 安装 uv 方法
66+
**Linux/macOS:**
67+
```bash
68+
curl -LsSf https://astral.sh/uv/install.sh | sh
69+
```
70+
71+
**Windows:**
72+
```bash
73+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
74+
```
75+
76+
## 安装 MCP-Server
77+
克隆仓库:
78+
```bash
79+
git clone git@github.com:volcengine/mcp-server.git
80+
```
81+
82+
## 运行 MCP-Server 指南
83+
84+
### 1. 配置文件
85+
`server/mcp_server_rabbitmq/src/mcp_server_rabbitmq/config/cfg.yaml`
86+
87+
默认配置:`transport = stdio``credential = env`
88+
89+
### 2. 协议切换
90+
对应配置中 `transport` 参数:
91+
- `sse`: 使用 Server-Sent Events 协议
92+
- `server_port`: 用来设置 SSE 端口
93+
- `StreamableHTTP`: 使用 StreamableHTTP 协议
94+
- `server_port`: 用来设置 StreamableHTTP 端口
95+
- `stdio`: 使用标准输入输出流协议
96+
97+
### 3. 身份认证
98+
若期望对 MCP Client 的身份进行认证,可配置 `auth` 参数(仅适用于 SSE 协议):
99+
- `oauth`, 使用 OAuth 认证(需要自备 OAuth 服务)
100+
- `none`, 不进行身份认证
101+
102+
### 4. 火山访问凭证
103+
因为 MCP Server 需要调用火山 OpenAPI,因此要提供火山访问凭证信息。
104+
对应配置中 `credential` 参数:
105+
- `env`: 从环境变量获取 AK、SK 进行鉴权(推荐)
106+
- `token`: 从 Header 中获取凭证(适用于 HTTP 模式,不适用于 STDIO)
107+
108+
### 5. 环境变量设置
109+
- ak 环境变量名: `VOLCENGINE_ACCESS_KEY`
110+
- sk 环境变量名: `VOLCENGINE_SECRET_KEY`
111+
- session_token 环境变量名: `VOLCENGINE_ACCESS_SESSION_TOKEN`
112+
- credential 环境变量名: `VOLCENGINE_CREDENTIAL_TYPE`(若设置,则优先级高于配置)
113+
- transport 环境变量名: `MCP_SERVER_MODE`(若设置,则优先级高于配置)
114+
- auth 环境变量名: `MCP_SERVER_AUTH`(若设置,则优先级高于配置)
115+
- sse_port 环境变量名: `MCP_SERVER_PORT`(若设置,则优先级高于配置)
116+
117+
### 6. 运行
118+
119+
#### 本地运行(STDIO / 默认)
120+
```bash
121+
uv --directory server/mcp_server_rabbitmq run mcp-server-rabbitmq
122+
```
123+
124+
#### 作为远程服务(SSE / StreamableHTTP)
125+
下载代码仓库,并设置 `transport = sse`(或 `StreamableHTTP`)。
126+
```bash
127+
uv --directory server/mcp_server_rabbitmq run mcp-server-rabbitmq
128+
```
129+
130+
## License
131+
MIT
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[project]
2+
name = "mcp-server-rabbitmq"
3+
version = "1.0.0"
4+
description = "A Model Context Protocol server providing tools for volcengine rabbitmq for LLMs"
5+
readme = "README.md"
6+
requires-python = ">=3.10"
7+
authors = [
8+
{ name = "volc-sdk-team" },
9+
]
10+
keywords = ["rabbitmq", "mcp", "llm"]
11+
license = { text = "MIT" }
12+
classifiers = [
13+
"Development Status :: 4 - Beta",
14+
"Intended Audience :: Developers",
15+
"License :: OSI Approved :: MIT License",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.10",
18+
]
19+
dependencies = [
20+
"mcp>=1.23.2",
21+
"aiohttp>=3.11.18",
22+
"fastmcp>=2.0.0",
23+
"pydantic>=2.0.0",
24+
"pyyaml>=6.0.2",
25+
"requests>=2.32.3",
26+
"starlette>=0.46.2",
27+
"tzdata>=2024.2",
28+
"uvicorn>=0.34.2",
29+
"volcengine-python-sdk>=3.0.1",
30+
"h11>=0.16.0",
31+
]
32+
33+
[project.scripts]
34+
mcp-server-rabbitmq = "mcp_server_rabbitmq:main"
35+
36+
[build-system]
37+
requires = ["hatchling"]
38+
build-backend = "hatchling.build"
39+
40+
[tool.uv]
41+
dev-dependencies = [
42+
"freezegun>=1.5.1",
43+
"pyright>=1.1.389",
44+
"pytest>=8.3.3",
45+
"ruff>=0.8.1",
46+
]
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile pyproject.toml --output-file requirements.txt
3+
aiohappyeyeballs==2.6.1
4+
# via aiohttp
5+
aiohttp==3.11.18
6+
# via mcp-server-rabbitmq (pyproject.toml)
7+
aiosignal==1.3.2
8+
# via aiohttp
9+
annotated-types==0.7.0
10+
# via pydantic
11+
anyio==4.9.0
12+
# via
13+
# httpx
14+
# mcp
15+
# sse-starlette
16+
# starlette
17+
attrs==25.3.0
18+
# via
19+
# aiohttp
20+
# jsonschema
21+
# referencing
22+
certifi==2025.1.31
23+
# via
24+
# httpcore
25+
# httpx
26+
# requests
27+
# volcengine-python-sdk
28+
cffi==2.0.0
29+
# via cryptography
30+
charset-normalizer==3.4.1
31+
# via requests
32+
click==8.1.8
33+
# via
34+
# typer
35+
# uvicorn
36+
cryptography==46.0.5
37+
# via pyjwt
38+
exceptiongroup==1.2.2
39+
# via fastmcp
40+
fastmcp==2.2.2
41+
# via mcp-server-rabbitmq (pyproject.toml)
42+
frozenlist==1.6.0
43+
# via
44+
# aiohttp
45+
# aiosignal
46+
h11==0.16.0
47+
# via
48+
# mcp-server-rabbitmq (pyproject.toml)
49+
# httpcore
50+
# uvicorn
51+
httpcore==1.0.9
52+
# via httpx
53+
httpx==0.28.1
54+
# via
55+
# fastmcp
56+
# mcp
57+
httpx-sse==0.4.0
58+
# via mcp
59+
idna==3.10
60+
# via
61+
# anyio
62+
# httpx
63+
# requests
64+
# yarl
65+
jsonschema==4.25.1
66+
# via mcp
67+
jsonschema-specifications==2025.9.1
68+
# via jsonschema
69+
markdown-it-py==3.0.0
70+
# via rich
71+
mcp==1.26.0
72+
# via
73+
# mcp-server-rabbitmq (pyproject.toml)
74+
# fastmcp
75+
mdurl==0.1.2
76+
# via markdown-it-py
77+
multidict==6.4.3
78+
# via
79+
# aiohttp
80+
# yarl
81+
openapi-pydantic==0.5.1
82+
# via fastmcp
83+
propcache==0.3.1
84+
# via
85+
# aiohttp
86+
# yarl
87+
pycparser==3.0
88+
# via cffi
89+
pydantic==2.11.3
90+
# via
91+
# mcp-server-rabbitmq (pyproject.toml)
92+
# mcp
93+
# openapi-pydantic
94+
# pydantic-settings
95+
pydantic-core==2.33.1
96+
# via pydantic
97+
pydantic-settings==2.9.1
98+
# via mcp
99+
pygments==2.19.1
100+
# via rich
101+
pyjwt==2.11.0
102+
# via mcp
103+
python-dateutil==2.9.0.post0
104+
# via volcengine-python-sdk
105+
python-dotenv==1.1.0
106+
# via
107+
# fastmcp
108+
# pydantic-settings
109+
python-multipart==0.0.20
110+
# via mcp
111+
pyyaml==6.0.2
112+
# via mcp-server-rabbitmq (pyproject.toml)
113+
referencing==0.36.2
114+
# via
115+
# jsonschema
116+
# jsonschema-specifications
117+
requests==2.32.3
118+
# via mcp-server-rabbitmq (pyproject.toml)
119+
rich==14.0.0
120+
# via
121+
# fastmcp
122+
# typer
123+
rpds-py==0.27.1
124+
# via
125+
# jsonschema
126+
# referencing
127+
shellingham==1.5.4
128+
# via typer
129+
six==1.17.0
130+
# via
131+
# python-dateutil
132+
# volcengine-python-sdk
133+
sniffio==1.3.1
134+
# via anyio
135+
sse-starlette==2.3.3
136+
# via mcp
137+
starlette==0.46.2
138+
# via
139+
# mcp
140+
# sse-starlette
141+
typer==0.15.2
142+
# via fastmcp
143+
typing-extensions==4.13.2
144+
# via
145+
# mcp
146+
# pydantic
147+
# pydantic-core
148+
# typer
149+
# typing-inspection
150+
typing-inspection==0.4.2
151+
# via
152+
# mcp
153+
# pydantic
154+
# pydantic-settings
155+
tzdata==2025.2
156+
# via mcp-server-rabbitmq (pyproject.toml)
157+
urllib3==2.4.0
158+
# via
159+
# requests
160+
# volcengine-python-sdk
161+
uvicorn==0.34.2
162+
# via mcp
163+
volcengine-python-sdk==3.0.1
164+
# via mcp-server-rabbitmq (pyproject.toml)
165+
websockets==15.0.1
166+
# via fastmcp
167+
yarl==1.20.0
168+
# via aiohttp
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from .server import serve
2+
3+
4+
def main():
5+
"""Volcengine MCP Server"""
6+
import asyncio
7+
8+
asyncio.run(serve())
9+
10+
11+
if __name__ == "__main__":
12+
main()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from . import main
2+
3+
main()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
service_code: rabbitmq
2+
transport: stdio # 支持 stdio 和 sse 和 StreamableHTTP
3+
server_port: 8888 # sse | StreamableHTTP 模式需要设定端口
4+
auth: none # 支持 oauth 和 none
5+
credential: env # 支持 env 和 token
6+
7+
#oauth:
8+
# client_id: your client id
9+
# client_secret: your client secret
10+
# authorize_url: 'https://github.com/login/oauth/authorize'
11+
# token_url: 'https://github.com/login/oauth/access_token'
12+
# scope: [user]

0 commit comments

Comments
 (0)