Transform Strands Agents into MCP servers, exposing agent tools to any MCP-compatible client
Project description
strands-mcp-server
Bidirectional MCP integration for Strands Agents. Expose agents as MCP servers or connect to any MCP server.
pip install strands-mcp-server
Overview
Two Python tools + CLI for Model Context Protocol (MCP):
- mcp_server: Expose your agent's tools as MCP server
- mcp_client: Connect to and use remote MCP servers
- CLI: stdio server for Claude Desktop/Kiro
graph TD
A[Your Strands Agent<br/>tools: calculator, shell, file_read] --> B[mcp_server tool]
B --> C[MCP Protocol<br/>HTTP/stdio]
C --> D[MCP Clients]
D --> E[Claude Desktop]
D --> F[Other Agents]
D --> G[Custom Clients]
style A fill:#2d3748,stroke:#4a5568,color:#fff
style B fill:#2b6cb0,stroke:#2c5282,color:#fff
style C fill:#38a169,stroke:#2f855a,color:#fff
style D fill:#805ad5,stroke:#6b46c1,color:#fff
style E fill:#d69e2e,stroke:#b7791f,color:#fff
style F fill:#d69e2e,stroke:#b7791f,color:#fff
style G fill:#d69e2e,stroke:#b7791f,color:#fff
Quick Start
1. Expose Your Agent (Server)
from strands import Agent
from strands_tools import calculator, shell
from strands_mcp_server import mcp_server
agent = Agent(tools=[calculator, shell, mcp_server])
agent("start mcp server on port 8000")
# Server running at http://localhost:8000/mcp
Stateless mode (production):
agent.tool.mcp_server(action="start", stateless=True, agent=agent)
2. Connect to Servers (Client)
from strands import Agent
from strands_mcp_server import mcp_client
agent = Agent(tools=[mcp_client])
# Connect
agent.tool.mcp_client(
action="connect",
connection_id="server1",
transport="http",
server_url="http://localhost:8000/mcp"
)
# Call remote tool
agent.tool.mcp_client(
action="call_tool",
connection_id="server1",
tool_name="calculator",
tool_args={"expression": "42 * 89"}
)
3. Claude Desktop Integration
Local mode (expose ./tools/ directory):
{
"mcpServers": {
"my-tools": {
"command": "uvx",
"args": [
"strands-mcp-server",
"--cwd", "/absolute/path/to/project"
]
}
}
}
Proxy mode (bridge to HTTP server):
{
"mcpServers": {
"my-agent": {
"command": "uvx",
"args": [
"strands-mcp-server",
"--upstream-url", "http://localhost:8000/mcp"
],
"autoApprove": ["tool_name"]
}
}
}
API Reference
mcp_server
| Parameter | Type | Default | Description |
|---|---|---|---|
action |
str | required | start, stop, status, list |
transport |
str | http |
http (background) or stdio (foreground) |
port |
int | 8000 | HTTP port |
tools |
list[str] | None | Tools to expose (None = all) |
expose_agent |
bool | True | Enable invoke_agent tool |
stateless |
bool | False | Multi-node ready (no session state) |
Examples:
# Basic
agent("start mcp server")
# Specific tools only
agent.tool.mcp_server(action="start", tools=["calculator"], agent=agent)
# Production
agent.tool.mcp_server(action="start", stateless=True, agent=agent)
mcp_client
| Parameter | Type | Description |
|---|---|---|
action |
str | connect, disconnect, list_tools, call_tool, list_connections |
connection_id |
str | Connection identifier |
transport |
str | http, stdio, sse |
server_url |
str | URL (http/sse) |
tool_name |
str | Tool to call |
tool_args |
dict | Tool arguments |
Transports:
# HTTP
agent.tool.mcp_client(
action="connect", connection_id="s1",
transport="http", server_url="http://localhost:8000/mcp"
)
# stdio (subprocess)
agent.tool.mcp_client(
action="connect", connection_id="s2",
transport="stdio", command="python", args=["server.py"]
)
# SSE
agent.tool.mcp_client(
action="connect", connection_id="s3",
transport="sse", server_url="http://localhost:8000/sse"
)
invoke_agent Tool
When expose_agent=True, clients get full agent access with model switching:
# Basic
invoke_agent(prompt="Calculate 2 + 2")
# Switch model provider
invoke_agent(
prompt="Complex calculation",
model_provider="anthropic",
model_settings={"model_id": "claude-sonnet-4-20250514"}
)
# Custom system prompt
invoke_agent(
prompt="Explain concept",
system_prompt="You are a teacher."
)
Parameters:
prompt(required): Query for agentmodel_provider: bedrock, anthropic, ollama, openai, github, envmodel_settings:{"model_id": "...", "params": {...}}system_prompt: Override agent's system prompt
CLI
uvx strands-mcp-server [OPTIONS]
| Option | Description |
|---|---|
--cwd PATH |
Working directory (local mode) |
--upstream-url URL |
Upstream server (proxy mode) |
--system-prompt TEXT |
Custom system prompt |
--no-agent-invocation |
Disable invoke_agent |
--debug |
Debug logging |
Local mode: Exposes ./tools/ directory with hot reload
Proxy mode: Bridges stdio ↔ HTTP server
Examples:
# Local mode
uvx strands-mcp-server --cwd /path/to/project
# Proxy mode
uvx strands-mcp-server --upstream-url http://localhost:8000/mcp
# With debug logging
uvx strands-mcp-server --cwd /path/to/project --debug
Troubleshooting
Tools not loading:
uvx strands-mcp-server --cwd /absolute/path --debug
Connection refused:
curl http://localhost:8000/mcp
Port in use:
lsof -i :8000
kill -9 <PID>
Check Claude Desktop logs:
tail -f ~/Library/Logs/Claude/mcp*.log
Testing
pytest # All tests
pytest --cov # With coverage
Links
- Docs: https://cagataycali.github.io/strands-mcp-server/
- Source: https://github.com/cagataycali/strands-mcp-server
- PyPI: https://pypi.org/project/strands-mcp-server/
- Strands: https://strandsagents.com
- MCP Spec: https://modelcontextprotocol.io/
License
Apache 2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strands_mcp_server-0.1.1.tar.gz.
File metadata
- Download URL: strands_mcp_server-0.1.1.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ceb66799289cebd87f1d41eef4d8d0b1a925010620ea9a9ed71559fc8721af74
|
|
| MD5 |
b057e0b44f1a63a1481232af0e5acd06
|
|
| BLAKE2b-256 |
328f3749f2b6abf8f89e694193d34d76b20e8f3fb038a767cd0f0f180bd8ba95
|
File details
Details for the file strands_mcp_server-0.1.1-py3-none-any.whl.
File metadata
- Download URL: strands_mcp_server-0.1.1-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d9617c630902337deaedc1483902f189c679a01a60bf0d1cc683340dce26d93
|
|
| MD5 |
df848620df2884e7ed87476ecccc338a
|
|
| BLAKE2b-256 |
8a03381a38dfe4901437b2b2f3d9da4428777901b3b660bc00682c712787aaea
|