This guide focuses on deploying Model Context Protocol (MCP) servers for production environments. MCP servers allow AI models to access tools and external systems through a standardized protocol.
from praisonaiagents import Agentagent = 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:
from praisonaiagents import Agent, Agentsfrom duckduckgo_search import DDGSdef 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 resultsagent = 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:
from praisonaiagents import Agent, Agentsagent = 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")
from praisonaiagents import Agent, Agentsfrom duckduckgo_search import DDGSdef 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 resultsagent = 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")
# Configure Docker to use Google Cloud credentialsgcloud auth configure-docker# Build and tag the imagedocker build -t gcr.io/YOUR_PROJECT_ID/mcp-server .# Push the imagedocker push gcr.io/YOUR_PROJECT_ID/mcp-server