From 110cbb43e68b339cfdb216215235f12cb81708fb Mon Sep 17 00:00:00 2001 From: MervinPraison Date: Thu, 15 May 2025 12:04:07 +0100 Subject: [PATCH] Remove agent names and version constraints in MCP server documentation --- docs/deploy/mcp-server-deploy.mdx | 50 ++++++++++++++++++++++++++----- docs/mcp/mcp-server.mdx | 28 +++++++++++++---- 2 files changed, 64 insertions(+), 14 deletions(-) diff --git a/docs/deploy/mcp-server-deploy.mdx b/docs/deploy/mcp-server-deploy.mdx index c538606c9..ee0111d39 100644 --- a/docs/deploy/mcp-server-deploy.mdx +++ b/docs/deploy/mcp-server-deploy.mdx @@ -15,12 +15,12 @@ This guide focuses on deploying Model Context Protocol (MCP) servers for product 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 ``` @@ -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(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") ``` @@ -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 ``` diff --git a/docs/mcp/mcp-server.mdx b/docs/mcp/mcp-server.mdx index ca3e9d70d..66d67a1f7 100644 --- a/docs/mcp/mcp-server.mdx +++ b/docs/mcp/mcp-server.mdx @@ -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") ``` @@ -45,7 +45,7 @@ For more complex scenarios, you can create an MCP server with multiple agents an ```bash - pip install "praisonaiagents[mcp]>=0.0.81" duckduckgo-search + pip install "praisonaiagents[mcp]" duckduckgo-search ``` @@ -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") ``` @@ -81,6 +81,22 @@ For more complex scenarios, you can create an MCP server with multiple agents an +## 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: