Skip to main content
Deploy agents as MCP servers for Claude Desktop, Cursor, and other MCP clients.

CLI

pip install "praisonaiagents[mcp]"
export OPENAI_API_KEY="your-key"

Python - Single Agent

from praisonaiagents import Agent

agent = Agent(
    name="TweetAgent",
    instructions="Create engaging tweets",
    llm="gpt-4o-mini"
)
agent.launch(port=8080, protocol="mcp")
Expected Output:
🚀 Agent 'TweetAgent' MCP server starting on http://0.0.0.0:8080
📡 MCP SSE endpoint available at /sse
📢 MCP messages post to /messages/
🛠️ Available MCP tools: execute_tweetagent_task
Verify:
curl http://localhost:8080/sse

Python - Multi-Agent

from praisonaiagents import Agent, Agents

researcher = Agent(name="Researcher", instructions="Research topics", llm="gpt-4o-mini")
writer = Agent(name="Writer", instructions="Write content", llm="gpt-4o-mini")

agents = Agents(agents=[researcher, writer])
agents.launch(port=8080, protocol="mcp")
Expected Output:
🚀 PraisonAIAgents MCP Workflow server starting on http://0.0.0.0:8080
📡 MCP SSE endpoint available at /sse
📢 MCP messages post to /messages/
🛠️ Available MCP tools: execute_workflow
🔄 Agents in MCP workflow: Researcher, Writer

agents.yaml

MCP server mode is Python-only. Use the CLI to start an HTTP server, then connect via MCP client.

MCP Endpoints

EndpointMethodDescription
/sseGETSSE connection for MCP
/messages/POSTSend MCP messages

Connect MCP Client

Claude Desktop (claude_desktop_config.json):
{
  "mcpServers": {
    "praisonai": {
      "url": "http://localhost:8080/sse"
    }
  }
}
Cursor (.cursor/mcp.json):
{
  "mcpServers": {
    "praisonai": {
      "url": "http://localhost:8080/sse"
    }
  }
}

launch() Parameters

ParameterTypeDefaultDescription
portint8000Server port
hoststr0.0.0.0Server host
protocolstrmcpMust be mcp
debugboolFalseDebug mode

Docker

app.py:
from praisonaiagents import Agent

agent = Agent(instructions="Create tweets", llm="gpt-4o-mini")
agent.launch(port=8080, protocol="mcp")
Dockerfile:
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app.py .
EXPOSE 8080
CMD ["python", "app.py"]
requirements.txt:
praisonaiagents[mcp]
Build and run:
docker build -t mcp-server .
docker run -p 8080:8080 -e OPENAI_API_KEY=$OPENAI_API_KEY mcp-server

Troubleshooting

IssueFix
Port in uselsof -i :8080
Missing depspip install "praisonaiagents[mcp]"
No API keyexport OPENAI_API_KEY="your-key"
SSE not connectingCheck firewall, use host="0.0.0.0"