Compare commits

...
2 Commits
Author SHA1 Message Date
Mervin Praison 124a95d7d0 Merge pull request #479 from MervinPraison/develop
Remove agent names and version constraints in MCP server documentation
2025-05-15 12:04:45 +01:00
MervinPraison 8ca4e3285d Remove agent names and version constraints in MCP server documentation 2025-05-15 12:04:07 +01:00
2 changed files with 64 additions and 14 deletions

No files matched your search

+42 -8
View File
@@ -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">
@@ -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
@@ -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(name="MultiAgents", agents=[agent, agent2])
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(agents=[agent, agent2])
agents.launch(port=8080, host="0.0.0.0", protocol="mcp")
```
</Step>
@@ -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>
+22 -6
View File
@@ -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"
@@ -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>
@@ -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">
@@ -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>
@@ -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: