Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 42 additions & 8 deletions docs/deploy/mcp-server-deploy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ This guide focuses on deploying Model Context Protocol (MCP) servers for product
<Step title="Install Dependencies">
Make sure you have the required packages installed:
```bash
pip install "praisonaiagents[mcp]>=0.0.81"
pip install "praisonaiagents[mcp]"
```

For the multi-agent example with search capabilities:
```bash
pip install "praisonaiagents[mcp]>=0.0.81" duckduckgo-search
pip install "praisonaiagents[mcp]" duckduckgo-search
```
</Step>
<Step title="Create MCP Server Files">
Expand All @@ -30,12 +30,12 @@ This guide focuses on deploying Model Context Protocol (MCP) servers for product
```python
from praisonaiagents import Agent

agent = Agent(name="TweetAgent", instructions="Create a Tweet based on the topic provided")
agent = Agent(instructions="Create a Tweet based on the topic provided")
agent.launch(port=8080, host="0.0.0.0", protocol="mcp")
```

**Multi-Agent MCP Server with Custom Tools**

Create a file named `simple-mcp-multi-agents-server.py`:
```python
from praisonaiagents import Agent, Agents
Expand All @@ -52,10 +52,44 @@ This guide focuses on deploying Model Context Protocol (MCP) servers for product
})
return results

agent = Agent(name="SearchAgent", instructions="You Search the internet for information", tools=[internet_search_tool])
agent2 = Agent(name="SummariseAgent", instructions="You Summarise the information")
agent = Agent(instructions="You Search the internet for information", tools=[internet_search_tool])
agent2 = Agent(instructions="You Summarise the information")

agents = Agents(agents=[agent, agent2])
agents.launch(port=8080, host="0.0.0.0", protocol="mcp")
```

**Simple Multi-Agent MCP Server**

Create a file named `simple-multi-agents-server.py`:
```python
from praisonaiagents import Agent, Agents

agent = Agent(instructions="You Search the internet for information")
agent2 = Agent(instructions="You Summarise the information")

agents = Agents(agents=[agent, agent2])
agents.launch(port=8080, host="0.0.0.0", protocol="mcp")
```
```python
from praisonaiagents import Agent, Agents
from duckduckgo_search import DDGS

def internet_search_tool(query: str):
results = []
ddgs = DDGS()
for result in ddgs.text(keywords=query, max_results=5):
results.append({
"title": result.get("title", ""),
"url": result.get("href", ""),
"snippet": result.get("body", "")
})
return results

agent = Agent(instructions="You Search the internet for information", tools=[internet_search_tool])
agent2 = Agent(instructions="You Summarise the information")

agents = Agents(name="MultiAgents", agents=[agent, agent2])
agents = Agents(agents=[agent, agent2])
agents.launch(port=8080, host="0.0.0.0", protocol="mcp")
```
Comment on lines +74 to 94
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This code block (lines 74-94) appears to be identical to the 'Multi-Agent MCP Server with Custom Tools' example already present in this document (see lines 40-60).

Could you clarify if this duplication under the 'Simple Multi-Agent MCP Server' heading is intentional? If it's meant to illustrate something different, the surrounding explanation or the example itself might need adjustment. If it's redundant, removing it would help prevent potential confusion for users.

</Step>
Expand Down Expand Up @@ -86,7 +120,7 @@ This guide focuses on deploying Model Context Protocol (MCP) servers for product

Create a `requirements.txt` file:
```
praisonaiagents[mcp]>=0.0.81
praisonaiagents[mcp]
duckduckgo-search # Only needed for the multi-agent example
```
</Step>
Expand Down
28 changes: 22 additions & 6 deletions docs/mcp/mcp-server.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Creating MCP Servers"
title: "MCP Servers"
sidebarTitle: "MCP Servers"
description: "Learn how to create Model Context Protocol (MCP) servers with PraisonAI agents"
icon: "server"
Expand All @@ -25,7 +25,7 @@ The simplest way to create an MCP server is with a single agent. This approach i
```python
from praisonaiagents import Agent

agent = Agent(name="TweetAgent", instructions="Create a Tweet based on the topic provided")
agent = Agent(instructions="Create a Tweet based on the topic provided")
agent.launch(port=8080, protocol="mcp")
```
</Step>
Expand All @@ -45,7 +45,7 @@ For more complex scenarios, you can create an MCP server with multiple agents an
<Steps>
<Step title="Install Additional Dependencies">
```bash
pip install "praisonaiagents[mcp]>=0.0.81" duckduckgo-search
pip install "praisonaiagents[mcp]" duckduckgo-search
```
</Step>
<Step title="Create a Multi-Agent MCP Server">
Expand All @@ -65,10 +65,10 @@ For more complex scenarios, you can create an MCP server with multiple agents an
})
return results

agent = Agent(name="SearchAgent", instructions="You Search the internet for information", tools=[internet_search_tool])
agent2 = Agent(name="SummariseAgent", instructions="You Summarise the information")
agent = Agent(instructions="You Search the internet for information", tools=[internet_search_tool])
agent2 = Agent(instructions="You Summarise the information")

agents = Agents(name="MultiAgents", agents=[agent, agent2])
agents = Agents(agents=[agent, agent2])
agents.launch(port=8080, protocol="mcp")
```
</Step>
Expand All @@ -81,6 +81,22 @@ For more complex scenarios, you can create an MCP server with multiple agents an
</Step>
</Steps>

## Multi-Agent MCP Server (Simple)

For scenarios where you need multiple agents to collaborate without custom tools, you can create a simpler multi-agent MCP server:

```python
from praisonaiagents import Agent, Agents

agent = Agent(instructions="You Search the internet for information")
agent2 = Agent(instructions="You Summarise the information")

agents = Agents(agents=[agent, agent2])
agents.launch(port=8080, protocol="mcp")
```

This approach is ideal for cases where you want agents with different specializations to work together using their built-in capabilities.

## Connecting to MCP Servers

You can connect to MCP servers using various clients:
Expand Down
Loading