From 807b0b89904d6ce9c917568746ceed6873fd2296 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Sat, 13 Sep 2025 11:41:08 -0700 Subject: [PATCH] [SSE -> STREAMABLE HTTP MIGRATION] --- docs/llm.txt | 42 +++++++++---------- docs/swarms/structs/agent_mcp.md | 32 +++++++------- docs/swarms/tools/tools_examples.md | 4 +- docs/swarms_rs/agents.md | 4 +- examples/mcp/agent_examples/agent_mcp_old.py | 4 +- .../agent_multi_mcp_connections.py | 4 +- .../agent_tools_dict_example.py | 2 +- examples/mcp/agent_examples/mcp_exampler.py | 2 +- .../mcp_utils/mcp_multiple_servers_example.py | 24 +++++------ .../mcp_utils/test_multiple_mcp_servers.py | 4 +- .../mcp/mcp_utils/utils/find_tools_on_mcp.py | 4 +- .../mcp_utils/utils/mcp_execute_example.py | 4 +- .../mcp_utils/utils/mcp_load_tools_example.py | 4 +- .../utils/mcp_multiserver_tool_fetch.py | 4 +- .../tools/stagehand/3_stagehand_mcp_agent.py | 16 +++---- examples/tools/stagehand/README.md | 2 +- .../tests/test_stagehand_integration.py | 6 +-- examples/utils/misc/aop/client.py | 10 ++--- 18 files changed, 86 insertions(+), 86 deletions(-) diff --git a/docs/llm.txt b/docs/llm.txt index c83f597f..d77b85be 100644 --- a/docs/llm.txt +++ b/docs/llm.txt @@ -33705,7 +33705,7 @@ The **Model Context Protocol (MCP)** integration enables Swarms agents to dynami agent_name="Financial-Analysis-Agent", agent_description="AI-powered financial advisor", max_loops=1, - mcp_url="http://localhost:8000/sse", # Your MCP server + mcp_url="http://localhost:8000/mcp", # Your MCP server output_type="all", ) @@ -33729,7 +33729,7 @@ The **Model Context Protocol (MCP)** integration enables Swarms agents to dynami agent_description="Comprehensive market analysis agent", system_prompt=FINANCIAL_AGENT_SYS_PROMPT, max_loops=3, - mcp_url="http://production-server:8000/sse", + mcp_url="http://production-server:8000/mcp", output_type="json", # Additional parameters for production temperature=0.1, @@ -33805,7 +33805,7 @@ graph TD | Parameter | Type | Description | Default | Example | |-----------|------|-------------|---------|---------| - | `mcp_url` | `str` | MCP server endpoint | `None` | `"http://localhost:8000/sse"` | + | `mcp_url` | `str` | MCP server endpoint | `None` | `"http://localhost:8000/mcp"` | | `output_type` | `str` | Response format | `"str"` | `"json"`, `"all"`, `"dict"` | | `max_loops` | `int` | Execution iterations | `1` | `3` | | `temperature` | `float` | Response creativity | `0.1` | `0.1-1.0` | @@ -33826,7 +33826,7 @@ graph TD agent_name="Crypto-Trading-Agent", agent_description="Real-time cryptocurrency market analyzer", max_loops=2, - mcp_url="http://crypto-server:8000/sse", + mcp_url="http://crypto-server:8000/mcp", output_type="json", temperature=0.1, ) @@ -33853,7 +33853,7 @@ graph TD agent_description="Comprehensive financial market analyst", system_prompt=FINANCIAL_AGENT_SYS_PROMPT, max_loops=4, - mcp_url="http://finance-api:8000/sse", + mcp_url="http://finance-api:8000/mcp", output_type="all", temperature=0.2, ) @@ -33881,7 +33881,7 @@ graph TD agent_name="Healthcare-Data-Agent", agent_description="Medical data analysis and research assistant", max_loops=3, - mcp_url="http://medical-api:8000/sse", + mcp_url="http://medical-api:8000/mcp", output_type="dict", system_prompt=""" You are a healthcare data analyst. Use available medical databases @@ -34008,14 +34008,14 @@ graph TD from swarms.schemas.mcp_schemas import MCPConnection mcp_config = MCPConnection( - url="http://server:8000/sse", + url="http://server:8000/mcp", headers={"Authorization": "Bearer token"}, timeout=30, retry_attempts=3 ) # ✅ Use direct URL instead - mcp_url = "http://server:8000/sse" + mcp_url = "http://server:8000/mcp" ``` ### 🚧 Single Server Limitation @@ -34025,12 +34025,12 @@ graph TD ```python # ❌ Multiple servers not supported mcp_servers = [ - "http://server1:8000/sse", - "http://server2:8000/sse" + "http://server1:8000/mcp", + "http://server2:8000/mcp" ] # ✅ Single server only - mcp_url = "http://primary-server:8000/sse" + mcp_url = "http://primary-server:8000/mcp" ``` ### 🚧 Sequential Execution @@ -34056,7 +34056,7 @@ graph TD **Solutions**: ```bash # Check server status - curl -I http://localhost:8000/sse + curl -I http://localhost:8000/mcp # Verify port is open netstat -tulpn | grep :8000 @@ -34125,7 +34125,7 @@ graph TD ```python # Increase timeout agent = Agent( - mcp_url="http://server:8000/sse", + mcp_url="http://server:8000/mcp", timeout=60, # seconds ) @@ -34158,7 +34158,7 @@ graph TD agent = Agent( agent_name="Debug-Agent", - mcp_url="http://localhost:8000/sse", + mcp_url="http://localhost:8000/mcp", verbose=True, # Enable verbose output output_type="all", # Get full execution trace ) @@ -34213,7 +34213,7 @@ graph TD # Environment variables (.env file) """ - MCP_SERVER_URL=https://secure-server.company.com/sse + MCP_SERVER_URL=https://secure-server.company.com/mcp MCP_API_KEY=your-secure-api-key MCP_TIMEOUT=30 """ @@ -34353,7 +34353,7 @@ graph TD agent = Agent( agent_name="Your-Agent", - mcp_url="http://localhost:8000/sse", + mcp_url="http://localhost:8000/mcp", output_type="json", max_loops=2 ) @@ -53166,7 +53166,7 @@ def get_okx_crypto_volume(symbol: str) -> str: ```python if __name__ == "__main__": # Run the MCP server with SSE (Server-Sent Events) transport - # Server will be available at http://localhost:8001/sse + # Server will be available at http://localhost:8001/mcp mcp.run(transport="sse") ``` @@ -53176,7 +53176,7 @@ if __name__ == "__main__": from swarms import Agent # Method 2: Using direct URL (simpler for development) -mcp_url = "http://0.0.0.0:8001/sse" +mcp_url = "http://0.0.0.0:8001/mcp" # Initialize agent with MCP tools agent = Agent( @@ -58363,7 +58363,7 @@ async def swarm_completion(): """Connect to a server over SSE and fetch available swarms.""" async with Client( - transport="http://localhost:8000/sse" + transport="http://localhost:8000/mcp" ) as client: # Basic connectivity testing # print("Ping check:", await client.ping()) @@ -68979,7 +68979,7 @@ let agent = client .add_stdio_mcp_server("uvx", ["mcp-hn"]) .await // Add SSE MCP server - .add_sse_mcp_server("file-browser", "http://127.0.0.1:8000/sse") + .add_sse_mcp_server("file-browser", "http://127.0.0.1:8000/mcp") .await .build(); ``` @@ -69016,7 +69016,7 @@ async fn main() -> Result<()> { .await // Add filesystem tool // To set up: uvx mcp-proxy --sse-port=8000 -- npx -y @modelcontextprotocol/server-filesystem ~ - .add_sse_mcp_server("file-browser", "http://127.0.0.1:8000/sse") + .add_sse_mcp_server("file-browser", "http://127.0.0.1:8000/mcp") .await .retry_attempts(2) .max_loops(3) diff --git a/docs/swarms/structs/agent_mcp.md b/docs/swarms/structs/agent_mcp.md index 0b8c4f4a..a18027b0 100644 --- a/docs/swarms/structs/agent_mcp.md +++ b/docs/swarms/structs/agent_mcp.md @@ -93,7 +93,7 @@ The **Model Context Protocol (MCP)** integration enables Swarms agents to dynami agent_name="Financial-Analysis-Agent", agent_description="AI-powered financial advisor", max_loops=1, - mcp_url="http://localhost:8000/sse", # Your MCP server + mcp_url="http://localhost:8000/mcp", # Your MCP server output_type="all", ) @@ -117,7 +117,7 @@ The **Model Context Protocol (MCP)** integration enables Swarms agents to dynami agent_description="Comprehensive market analysis agent", system_prompt=FINANCIAL_AGENT_SYS_PROMPT, max_loops=3, - mcp_url="http://production-server:8000/sse", + mcp_url="http://production-server:8000/mcp", output_type="json", # Additional parameters for production temperature=0.1, @@ -193,7 +193,7 @@ graph TD | Parameter | Type | Description | Default | Example | |-----------|------|-------------|---------|---------| - | `mcp_url` | `str` | MCP server endpoint | `None` | `"http://localhost:8000/sse"` | + | `mcp_url` | `str` | MCP server endpoint | `None` | `"http://localhost:8000/mcp"` | | `output_type` | `str` | Response format | `"str"` | `"json"`, `"all"`, `"dict"` | | `max_loops` | `int` | Execution iterations | `1` | `3` | | `temperature` | `float` | Response creativity | `0.1` | `0.1-1.0` | @@ -214,7 +214,7 @@ graph TD agent_name="Crypto-Trading-Agent", agent_description="Real-time cryptocurrency market analyzer", max_loops=2, - mcp_url="http://crypto-server:8000/sse", + mcp_url="http://crypto-server:8000/mcp", output_type="json", temperature=0.1, ) @@ -241,7 +241,7 @@ graph TD agent_description="Comprehensive financial market analyst", system_prompt=FINANCIAL_AGENT_SYS_PROMPT, max_loops=4, - mcp_url="http://finance-api:8000/sse", + mcp_url="http://finance-api:8000/mcp", output_type="all", temperature=0.2, ) @@ -269,7 +269,7 @@ graph TD agent_name="Healthcare-Data-Agent", agent_description="Medical data analysis and research assistant", max_loops=3, - mcp_url="http://medical-api:8000/sse", + mcp_url="http://medical-api:8000/mcp", output_type="dict", system_prompt=""" You are a healthcare data analyst. Use available medical databases @@ -396,14 +396,14 @@ graph TD from swarms.schemas.mcp_schemas import MCPConnection mcp_config = MCPConnection( - url="http://server:8000/sse", + url="http://server:8000/mcp", headers={"Authorization": "Bearer token"}, timeout=30, retry_attempts=3 ) # ✅ Use direct URL instead - mcp_url = "http://server:8000/sse" + mcp_url = "http://server:8000/mcp" ``` ### 🚧 Single Server Limitation @@ -413,12 +413,12 @@ graph TD ```python # ❌ Multiple servers not supported mcp_servers = [ - "http://server1:8000/sse", - "http://server2:8000/sse" + "http://server1:8000/mcp", + "http://server2:8000/mcp" ] # ✅ Single server only - mcp_url = "http://primary-server:8000/sse" + mcp_url = "http://primary-server:8000/mcp" ``` ### 🚧 Sequential Execution @@ -444,7 +444,7 @@ graph TD **Solutions**: ```bash # Check server status - curl -I http://localhost:8000/sse + curl -I http://localhost:8000/mcp # Verify port is open netstat -tulpn | grep :8000 @@ -513,7 +513,7 @@ graph TD ```python # Increase timeout agent = Agent( - mcp_url="http://server:8000/sse", + mcp_url="http://server:8000/mcp", timeout=60, # seconds ) @@ -546,7 +546,7 @@ graph TD agent = Agent( agent_name="Debug-Agent", - mcp_url="http://localhost:8000/sse", + mcp_url="http://localhost:8000/mcp", verbose=True, # Enable verbose output output_type="all", # Get full execution trace ) @@ -601,7 +601,7 @@ graph TD # Environment variables (.env file) """ - MCP_SERVER_URL=https://secure-server.company.com/sse + MCP_SERVER_URL=https://secure-server.company.com/mcp MCP_API_KEY=your-secure-api-key MCP_TIMEOUT=30 """ @@ -741,7 +741,7 @@ graph TD agent = Agent( agent_name="Your-Agent", - mcp_url="http://localhost:8000/sse", + mcp_url="http://localhost:8000/mcp", output_type="json", max_loops=2 ) diff --git a/docs/swarms/tools/tools_examples.md b/docs/swarms/tools/tools_examples.md index d8ec7476..fe282663 100644 --- a/docs/swarms/tools/tools_examples.md +++ b/docs/swarms/tools/tools_examples.md @@ -477,7 +477,7 @@ def get_okx_crypto_volume(symbol: str) -> str: ```python if __name__ == "__main__": # Run the MCP server with SSE (Server-Sent Events) transport - # Server will be available at http://localhost:8001/sse + # Server will be available at http://localhost:8001/mcp mcp.run(transport="sse") ``` @@ -487,7 +487,7 @@ if __name__ == "__main__": from swarms import Agent # Method 2: Using direct URL (simpler for development) -mcp_url = "http://0.0.0.0:8001/sse" +mcp_url = "http://0.0.0.0:8001/mcp" # Initialize agent with MCP tools agent = Agent( diff --git a/docs/swarms_rs/agents.md b/docs/swarms_rs/agents.md index 0b86a9b5..5946cf7c 100644 --- a/docs/swarms_rs/agents.md +++ b/docs/swarms_rs/agents.md @@ -198,7 +198,7 @@ let agent = client .add_stdio_mcp_server("uvx", ["mcp-hn"]) .await // Add SSE MCP server - .add_sse_mcp_server("file-browser", "http://127.0.0.1:8000/sse") + .add_sse_mcp_server("file-browser", "http://127.0.0.1:8000/mcp") .await .build(); ``` @@ -235,7 +235,7 @@ async fn main() -> Result<()> { .await // Add filesystem tool // To set up: uvx mcp-proxy --sse-port=8000 -- npx -y @modelcontextprotocol/server-filesystem ~ - .add_sse_mcp_server("file-browser", "http://127.0.0.1:8000/sse") + .add_sse_mcp_server("file-browser", "http://127.0.0.1:8000/mcp") .await .retry_attempts(2) .max_loops(3) diff --git a/examples/mcp/agent_examples/agent_mcp_old.py b/examples/mcp/agent_examples/agent_mcp_old.py index 19538e1d..84391d9d 100644 --- a/examples/mcp/agent_examples/agent_mcp_old.py +++ b/examples/mcp/agent_examples/agent_mcp_old.py @@ -3,13 +3,13 @@ from swarms.schemas.mcp_schemas import MCPConnection mcp_config = MCPConnection( - url="http://0.0.0.0:8000/sse", + url="http://0.0.0.0:8000/mcp", # headers={"Authorization": "Bearer 1234567890"}, timeout=5, ) -mcp_url = "http://0.0.0.0:8000/sse" +mcp_url = "http://0.0.0.0:8000/mcp" # Initialize the agent agent = Agent( diff --git a/examples/mcp/agent_examples/agent_multi_mcp_connections.py b/examples/mcp/agent_examples/agent_multi_mcp_connections.py index 46e22cbc..3baffe7a 100644 --- a/examples/mcp/agent_examples/agent_multi_mcp_connections.py +++ b/examples/mcp/agent_examples/agent_multi_mcp_connections.py @@ -39,8 +39,8 @@ agent = Agent( dynamic_temperature_enabled=True, output_type="all", mcp_urls=[ - "http://0.0.0.0:8000/sse", - "http://0.0.0.0:8001/sse", + "http://0.0.0.0:8000/mcp", + "http://0.0.0.0:8001/mcp", ], ) diff --git a/examples/mcp/agent_examples/agent_tools_dict_example.py b/examples/mcp/agent_examples/agent_tools_dict_example.py index f1d02620..0140db32 100644 --- a/examples/mcp/agent_examples/agent_tools_dict_example.py +++ b/examples/mcp/agent_examples/agent_tools_dict_example.py @@ -40,7 +40,7 @@ agent = Agent( max_loops=2, tools_list_dictionary=tools, output_type="final", - mcp_url="http://0.0.0.0:8000/sse", + mcp_url="http://0.0.0.0:8000/mcp", ) out = agent.run( diff --git a/examples/mcp/agent_examples/mcp_exampler.py b/examples/mcp/agent_examples/mcp_exampler.py index 433dab07..7b176e9d 100644 --- a/examples/mcp/agent_examples/mcp_exampler.py +++ b/examples/mcp/agent_examples/mcp_exampler.py @@ -44,7 +44,7 @@ agent = Agent( system_prompt=FINANCIAL_AGENT_SYS_PROMPT, max_loops=1, # tools_list_dictionary=tools, - # mcp_servers=["http://localhost:8000/sse"], + # mcp_servers=["http://localhost:8000/mcp"], # output_type="dict-all-except-first", # "dict-final", # "dict-all-except-first", diff --git a/examples/mcp/mcp_utils/mcp_multiple_servers_example.py b/examples/mcp/mcp_utils/mcp_multiple_servers_example.py index e94de2ca..0c123949 100644 --- a/examples/mcp/mcp_utils/mcp_multiple_servers_example.py +++ b/examples/mcp/mcp_utils/mcp_multiple_servers_example.py @@ -21,25 +21,25 @@ def example_sync_execution(): # Example server URLs (replace with your actual MCP server URLs) urls = [ - "http://localhost:8000/sse", # Server 1 - "http://localhost:8001/sse", # Server 2 - "http://localhost:8002/sse", # Server 3 + "http://localhost:8000/mcp", # Server 1 + "http://localhost:8001/mcp", # Server 2 + "http://localhost:8002/mcp", # Server 3 ] # Optional: Create connection objects for each server connections = [ MCPConnection( - url="http://localhost:8000/sse", + url="http://localhost:8000/mcp", authorization_token="token1", # if needed timeout=10, ), MCPConnection( - url="http://localhost:8001/sse", + url="http://localhost:8001/mcp", authorization_token="token2", # if needed timeout=10, ), MCPConnection( - url="http://localhost:8002/sse", + url="http://localhost:8002/mcp", authorization_token="token3", # if needed timeout=10, ), @@ -111,9 +111,9 @@ async def example_async_execution(): # Example server URLs urls = [ - "http://localhost:8000/sse", - "http://localhost:8001/sse", - "http://localhost:8002/sse", + "http://localhost:8000/mcp", + "http://localhost:8001/mcp", + "http://localhost:8002/mcp", ] # Example responses with multiple tool calls in a single response @@ -190,9 +190,9 @@ def example_get_tools_from_multiple_servers(): """Example of getting tools from multiple servers.""" urls = [ - "http://localhost:8000/sse", - "http://localhost:8001/sse", - "http://localhost:8002/sse", + "http://localhost:8000/mcp", + "http://localhost:8001/mcp", + "http://localhost:8002/mcp", ] print("\n=== Getting Tools from Multiple Servers ===") diff --git a/examples/mcp/mcp_utils/test_multiple_mcp_servers.py b/examples/mcp/mcp_utils/test_multiple_mcp_servers.py index dba47d66..e2ac9865 100644 --- a/examples/mcp/mcp_utils/test_multiple_mcp_servers.py +++ b/examples/mcp/mcp_utils/test_multiple_mcp_servers.py @@ -14,8 +14,8 @@ def test_async_multiple_tools_execution(): ) urls = [ - "http://localhost:8000/sse", - "http://localhost:8001/sse", + "http://localhost:8000/mcp", + "http://localhost:8001/mcp", ] # Mock responses with multiple tool calls diff --git a/examples/mcp/mcp_utils/utils/find_tools_on_mcp.py b/examples/mcp/mcp_utils/utils/find_tools_on_mcp.py index 82301a0e..1705c2c2 100644 --- a/examples/mcp/mcp_utils/utils/find_tools_on_mcp.py +++ b/examples/mcp/mcp_utils/utils/find_tools_on_mcp.py @@ -7,10 +7,10 @@ import json if __name__ == "__main__": tools = get_mcp_tools_sync( - server_path="http://0.0.0.0:8000/sse", + server_path="http://0.0.0.0:8000/mcp", format="openai", connection=MCPConnection( - url="http://0.0.0.0:8000/sse", + url="http://0.0.0.0:8000/mcp", headers={"Authorization": "Bearer 1234567890"}, timeout=10, ), diff --git a/examples/mcp/mcp_utils/utils/mcp_execute_example.py b/examples/mcp/mcp_utils/utils/mcp_execute_example.py index 326f48a9..750c3eb6 100644 --- a/examples/mcp/mcp_utils/utils/mcp_execute_example.py +++ b/examples/mcp/mcp_utils/utils/mcp_execute_example.py @@ -13,12 +13,12 @@ response = { } connection = MCPConnection( - url="http://0.0.0.0:8000/sse", + url="http://0.0.0.0:8000/mcp", headers={"Authorization": "Bearer 1234567890"}, timeout=10, ) -url = "http://0.0.0.0:8000/sse" +url = "http://0.0.0.0:8000/mcp" if __name__ == "__main__": tools = asyncio.run( diff --git a/examples/mcp/mcp_utils/utils/mcp_load_tools_example.py b/examples/mcp/mcp_utils/utils/mcp_load_tools_example.py index 0847845c..dc3480cb 100644 --- a/examples/mcp/mcp_utils/utils/mcp_load_tools_example.py +++ b/examples/mcp/mcp_utils/utils/mcp_load_tools_example.py @@ -7,10 +7,10 @@ from swarms.tools.mcp_client_tools import ( if __name__ == "__main__": tools = get_mcp_tools_sync( - server_path="http://0.0.0.0:8000/sse", + server_path="http://0.0.0.0:8000/mcp", format="openai", connection=MCPConnection( - url="http://0.0.0.0:8000/sse", + url="http://0.0.0.0:8000/mcp", headers={"Authorization": "Bearer 1234567890"}, timeout=10, ), diff --git a/examples/mcp/mcp_utils/utils/mcp_multiserver_tool_fetch.py b/examples/mcp/mcp_utils/utils/mcp_multiserver_tool_fetch.py index ade0009f..3ea4a307 100644 --- a/examples/mcp/mcp_utils/utils/mcp_multiserver_tool_fetch.py +++ b/examples/mcp/mcp_utils/utils/mcp_multiserver_tool_fetch.py @@ -5,12 +5,12 @@ from swarms.schemas.mcp_schemas import MCPConnection mcp_config = MCPConnection( - url="http://0.0.0.0:8000/sse", + url="http://0.0.0.0:8000/mcp", # headers={"Authorization": "Bearer 1234567890"}, timeout=5, ) -urls = ["http://0.0.0.0:8000/sse", "http://0.0.0.0:8001/sse"] +urls = ["http://0.0.0.0:8000/mcp", "http://0.0.0.0:8001/mcp"] out = get_tools_for_multiple_mcp_servers( urls=urls, diff --git a/examples/tools/stagehand/3_stagehand_mcp_agent.py b/examples/tools/stagehand/3_stagehand_mcp_agent.py index 64688490..d35f4416 100644 --- a/examples/tools/stagehand/3_stagehand_mcp_agent.py +++ b/examples/tools/stagehand/3_stagehand_mcp_agent.py @@ -13,7 +13,7 @@ Prerequisites: npm run build npm start -2. The server will start on http://localhost:3000/sse +2. The server will start on http://localhost:3000/mcp Features: - Automatic tool discovery from MCP server @@ -41,7 +41,7 @@ class StagehandMCPAgent: def __init__( self, agent_name: str = "StagehandMCPAgent", - mcp_server_url: str = "http://localhost:3000/sse", + mcp_server_url: str = "http://localhost:3000/mcp", model_name: str = "gpt-4o-mini", max_loops: int = 1, ): @@ -91,7 +91,7 @@ class MultiSessionBrowserSwarm: def __init__( self, - mcp_server_url: str = "http://localhost:3000/sse", + mcp_server_url: str = "http://localhost:3000/mcp", num_agents: int = 3, ): """ @@ -165,7 +165,7 @@ if __name__ == "__main__": print("Stagehand MCP Server Integration Examples") print("=" * 70) print( - "\nMake sure the Stagehand MCP server is running on http://localhost:3000/sse" + "\nMake sure the Stagehand MCP server is running on http://localhost:3000/mcp" ) print("Run: cd stagehand-mcp-server && npm start\n") @@ -175,7 +175,7 @@ if __name__ == "__main__": mcp_agent = StagehandMCPAgent( agent_name="WebResearchAgent", - mcp_server_url="http://localhost:3000/sse", + mcp_server_url="http://localhost:3000/mcp", ) # Research task using MCP tools @@ -196,7 +196,7 @@ if __name__ == "__main__": parallel_agent = StagehandMCPAgent( agent_name="ParallelBrowserAgent", - mcp_server_url="http://localhost:3000/sse", + mcp_server_url="http://localhost:3000/mcp", ) result2 = parallel_agent.run( @@ -217,7 +217,7 @@ if __name__ == "__main__": # Create a swarm of specialized browser agents browser_swarm = MultiSessionBrowserSwarm( - mcp_server_url="http://localhost:3000/sse", + mcp_server_url="http://localhost:3000/mcp", num_agents=3, ) @@ -242,7 +242,7 @@ if __name__ == "__main__": workflow_agent = StagehandMCPAgent( agent_name="WorkflowAgent", - mcp_server_url="http://localhost:3000/sse", + mcp_server_url="http://localhost:3000/mcp", max_loops=2, # Allow more complex reasoning ) diff --git a/examples/tools/stagehand/README.md b/examples/tools/stagehand/README.md index 2d1ee341..29dbf7ee 100644 --- a/examples/tools/stagehand/README.md +++ b/examples/tools/stagehand/README.md @@ -86,7 +86,7 @@ from examples.stagehand.stagehand_mcp_agent import StagehandMCPAgent # Connect to Stagehand MCP server mcp_agent = StagehandMCPAgent( agent_name="WebResearchAgent", - mcp_server_url="http://localhost:3000/sse", + mcp_server_url="http://localhost:3000/mcp", ) # Use MCP tools including multi-session management diff --git a/examples/tools/stagehand/tests/test_stagehand_integration.py b/examples/tools/stagehand/tests/test_stagehand_integration.py index d2048d11..327d1f96 100644 --- a/examples/tools/stagehand/tests/test_stagehand_integration.py +++ b/examples/tools/stagehand/tests/test_stagehand_integration.py @@ -271,12 +271,12 @@ class TestStagehandMCP: mcp_agent = StagehandMCPAgent( agent_name="TestMCPAgent", - mcp_server_url="http://localhost:3000/sse", + mcp_server_url="http://localhost:3000/mcp", model_name="gpt-4o-mini", ) assert mcp_agent.agent.agent_name == "TestMCPAgent" - assert mcp_agent.agent.mcp_url == "http://localhost:3000/sse" + assert mcp_agent.agent.mcp_url == "http://localhost:3000/mcp" assert mcp_agent.agent.model_name == "gpt-4o-mini" def test_multi_session_swarm_creation(self): @@ -286,7 +286,7 @@ class TestStagehandMCP: ) swarm = MultiSessionBrowserSwarm( - mcp_server_url="http://localhost:3000/sse", + mcp_server_url="http://localhost:3000/mcp", num_agents=3, ) diff --git a/examples/utils/misc/aop/client.py b/examples/utils/misc/aop/client.py index 6d42a6dd..ff327f7f 100644 --- a/examples/utils/misc/aop/client.py +++ b/examples/utils/misc/aop/client.py @@ -3,12 +3,12 @@ from swarms.structs.aop import AOP aop = AOP( name="example_system", description="A simple example of tools, agents, and swarms", - url="http://localhost:8000/sse", + url="http://localhost:8000/mcp", ) # print( # aop.call_tool_or_agent( -# url="http://localhost:8000/sse", +# url="http://localhost:8000/mcp", # name="calculator", # arguments={"operation": "add", "x": 1, "y": 2}, # output_type="list", @@ -18,7 +18,7 @@ aop = AOP( # print( # aop.call_tool_or_agent_batched( -# url="http://localhost:8000/sse", +# url="http://localhost:8000/mcp", # names=["calculator", "calculator"], # arguments=[{"operation": "add", "x": 1, "y": 2}, {"operation": "multiply", "x": 3, "y": 4}], # output_type="list", @@ -28,7 +28,7 @@ aop = AOP( # print( # aop.call_tool_or_agent_concurrently( -# url="http://localhost:8000/sse", +# url="http://localhost:8000/mcp", # names=["calculator", "calculator"], # arguments=[{"operation": "add", "x": 1, "y": 2}, {"operation": "multiply", "x": 3, "y": 4}], # output_type="list", @@ -42,7 +42,7 @@ aop = AOP( # print(aop.list_swarms()) -# print(aop.list_all(url="http://localhost:8000/sse")) +# print(aop.list_all(url="http://localhost:8000/mcp")) # print(any_to_str(aop.list_all()))