Skip to content

Commit 5379800

Browse files
authored
Add example for usage and update README (#13)
1 parent f6cbad4 commit 5379800

File tree

8 files changed

+712
-87
lines changed

8 files changed

+712
-87
lines changed

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ A [Model Context Protocol](https://www.anthropic.com/news/model-context-protocol
66
### Manage your RabbitMQ message brokers using AI agent
77
This MCP servers wraps admin APIs of a RabbitMQ broker as MCP tools.
88

9+
### Connect to multiple brokers in one session
10+
Supports connecting to multiple RabbitMQ brokers within a single session, allowing you to manage multiple clusters simultaneously.
11+
12+
### OAuth authentication support
13+
Connect to RabbitMQ brokers using OAuth tokens for secure, token-based authentication.
14+
915
### Supports streamable HTTP with FastMCP's `BearerAuthProvider`
1016
You can start a remote RabbitMQ MCP server by configuring your own IdP and 3rd party authorization provider.
1117

@@ -56,7 +62,40 @@ Use uvx directly in your MCP client config
5662
```
5763

5864
### Configuration
59-
`--allow-mutative-tools`: if specificy, it will enable tools that can mutate broker states. Default is false.
65+
`--allow-mutative-tools`: if specified, it will enable tools that can mutate broker states. Default is false.
66+
67+
## Usage Examples
68+
69+
### Strands Agent Example
70+
71+
See [example/agent_strands](example/agent_strands) for a complete example of using the RabbitMQ MCP server with Strands AI agents.
72+
73+
```python
74+
from mcp import stdio_client, StdioServerParameters
75+
from strands import Agent
76+
from strands.tools.mcp import MCPClient
77+
78+
stdio_mcp_client = MCPClient(lambda: stdio_client(
79+
StdioServerParameters(
80+
command="uvx",
81+
args=["amq-mcp-server-rabbitmq@latest"]
82+
)
83+
))
84+
85+
with stdio_mcp_client:
86+
tools = stdio_mcp_client.list_tools_sync()
87+
agent = Agent(tools=tools)
88+
89+
while True:
90+
user_input = input("\nYou: ").strip()
91+
if not user_input or user_input.lower() in ["exit", "quit"]:
92+
break
93+
agent(user_input)
94+
```
95+
96+
### Amazon Q Developer CLI Example
97+
98+
See [example/amazon_q_cli](example/amazon_q_cli) for configuration examples with Amazon Q Developer CLI.
6099

61100
## Development
62101

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

example/agent_strands/README.md

Whitespace-only changes.

example/agent_strands/agent.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""Strands agent that uses RabbitMQ MCP server via stdio."""
2+
3+
from mcp import StdioServerParameters, stdio_client
4+
from strands import Agent
5+
from strands.tools.mcp import MCPClient
6+
7+
# Connect to RabbitMQ MCP server using stdio transport
8+
stdio_mcp_client = MCPClient(
9+
lambda: stdio_client(
10+
StdioServerParameters(
11+
command="/Users/qrl/.local/bin/uvx", args=["amq-mcp-server-rabbitmq@latest"]
12+
)
13+
)
14+
)
15+
16+
# Create an agent with MCP tools
17+
with stdio_mcp_client:
18+
tools = stdio_mcp_client.list_tools_sync()
19+
agent = Agent(tools=tools)
20+
agent("what can you do?")
21+
while True:
22+
user_input = input("\nYou: ").strip()
23+
if not user_input or user_input.lower() in ["exit", "quit"]:
24+
break
25+
agent(user_input)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[project]
2+
name = "rabbitmq-strands-agent"
3+
version = "0.1.0"
4+
description = "Strands agent for RabbitMQ MCP server"
5+
requires-python = ">=3.10"
6+
dependencies = [
7+
"strands-agents>=1.12.0",
8+
"mcp>=1.0.0",
9+
]

example/amazon_q_cli/sample_agent.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
"prompt": null,
66
"mcpServers": {
77
"rabbitmq": {
8-
"command": "/Users/qrl/.local/bin/uv",
8+
"command": "/Users/qrl/.local/bin/uvx",
99
"args": [
10-
"--directory",
11-
"/Users/qrl/amzn/personal_workspace/amazon_mq_github/mcp-server-rabbitmq",
12-
"run",
13-
"mcp-server-rabbitmq",
14-
"--allow-mutative-tools"
10+
"amq-mcp-server-rabbitmq@latest"
1511
]
1612
}
1713
},

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ packages = ["src"]
4949
[tool.uv]
5050
dev-dependencies = ["pyright>=1.1.389", "ruff>=0.7.3", "pytest>=8.3.5"]
5151

52+
[tool.uv.workspace]
53+
members = ["example/agent_strands"]
54+
5255
[tool.ruff]
5356
line-length = 99
5457
target-version = "py310"

0 commit comments

Comments
 (0)