refactor(mcp): simplify client to use math agent only, remove finance agent

pull/819/head
Pavan Kumar 3 months ago committed by ascender1729
parent 77324e6ace
commit 977623ab7b

@ -81,14 +81,6 @@ name = "Run MCP Demo"
author = 13983571
mode = "parallel"
[[workflows.workflow.tasks]]
task = "shell.exec"
args = "python examples/mcp_example/mock_stock_server.py &"
[[workflows.workflow.tasks]]
task = "shell.exec"
args = "sleep 2"
[[workflows.workflow.tasks]]
task = "shell.exec"
args = "python examples/mcp_example/mock_math_server.py &"

@ -1,10 +1,9 @@
from swarms import Agent
from swarms.tools.mcp_integration import MCPServerSseParams
from swarms.prompts.agent_prompts import FINANCE_AGENT_PROMPT, MATH_AGENT_PROMPT
from swarms.prompts.agent_prompts import MATH_AGENT_PROMPT
def main():
# Configure MCP server connections
# Configure MCP server connection
math_server = MCPServerSseParams(
url="http://0.0.0.0:8000/mcp",
headers={"Content-Type": "application/json"},
@ -12,13 +11,6 @@ def main():
sse_read_timeout=30.0
)
stock_server = MCPServerSseParams(
url="http://0.0.0.0:8001/mcp",
headers={"Content-Type": "application/json"},
timeout=5.0,
sse_read_timeout=30.0
)
# Initialize math agent
math_agent = Agent(
agent_name="Math Agent",
@ -29,20 +21,9 @@ def main():
streaming_on=True
)
# Initialize stock agent
stock_agent = Agent(
agent_name="Stock Agent",
agent_description="Specialized agent for stock analysis",
system_prompt=FINANCE_AGENT_PROMPT,
max_loops=1,
mcp_servers=[stock_server],
streaming_on=True
)
print("\nMulti-Agent System Initialized")
print("\nMath Agent System Initialized")
print("\nAvailable operations:")
print("Math Agent: add, multiply, divide")
print("Stock Agent: get stock price, calculate moving average")
while True:
query = input("\nEnter your query (or 'exit' to quit): ")
@ -50,12 +31,9 @@ def main():
if query.lower() == 'exit':
break
# Process with both agents
# Process with math agent
math_result = math_agent.run(query)
stock_result = stock_agent.run(query)
print("\nMath Agent Response:", math_result)
print("Stock Agent Response:", stock_result)
if __name__ == "__main__":
main()
Loading…
Cancel
Save