Skip to content
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cf6610b
Add files via upload
IlumCI Aug 4, 2025
5ea50ea
Update mcp_schemas.py
IlumCI Aug 4, 2025
4515203
Add files via upload
IlumCI Aug 4, 2025
baa2e5d
Update __init__.py
IlumCI Aug 4, 2025
90d8743
Update agent.py
IlumCI Aug 4, 2025
33dca7b
Update mcp_unified_client.py
IlumCI Aug 4, 2025
072f04c
Update agent.py
IlumCI Aug 14, 2025
6497e5d
Update litellm_wrapper.py
IlumCI Aug 14, 2025
6c7c8b9
Update mcp_client_call.py
IlumCI Aug 14, 2025
95d8c4e
Update mcp_unified_client.py
IlumCI Aug 14, 2025
609f594
Update mcp_schemas.py
IlumCI Aug 14, 2025
823e292
Update mcp_unified_client.py
IlumCI Aug 15, 2025
4f61977
Update mcp_schemas.py
IlumCI Aug 15, 2025
08ce346
Update agent.py
IlumCI Aug 15, 2025
dffcba5
Update mcp_unified_client.py
IlumCI Aug 15, 2025
30f88aa
Update mcp_schemas.py
IlumCI Aug 15, 2025
22459b3
Update mcp_unified_client.py
IlumCI Aug 15, 2025
be7862d
Update mcp_client_call.py
IlumCI Aug 15, 2025
faf6f22
Update mcp_unified_client.py
IlumCI Aug 15, 2025
6d0661c
Update agent.py
IlumCI Aug 15, 2025
0d8c717
Update __init__.py
IlumCI Aug 15, 2025
4b59980
Create excelswarm.py
IlumCI Aug 15, 2025
98b40c3
Create working_mcp_server.py
IlumCI Aug 15, 2025
9ecd2c7
Create simple_working_mcp_server.py
IlumCI Aug 15, 2025
77eee8e
Create test_riemann_tools.py
IlumCI Aug 15, 2025
3a836ec
Create test_core_functionality.py
IlumCI Aug 15, 2025
8e2e3b2
Create mcp_streaming.py
IlumCI Aug 15, 2025
ff3c4bd
Update __init__.py
IlumCI Aug 15, 2025
fb74310
Update __init__.py
IlumCI Aug 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
403 changes: 403 additions & 0 deletions examples/mcp/math_example/excelswarm.py

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions examples/mcp/math_example/simple_working_mcp_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/env python3
"""
Simple working MCP server for testing.
"""

import asyncio
import json
import sys
from typing import Any, Dict, List

from mcp.server import Server
from mcp.server.stdio import stdio_server
from mcp.types import CallToolResult, TextContent


def mock_list_tools() -> List[Dict[str, Any]]:
"""Mock function to list available tools."""
return [
{
"name": "get_weather",
"description": "Get current weather information for a location",
"inputSchema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": ["location"]
}
},
{
"name": "calculate",
"description": "Perform mathematical calculations",
"inputSchema": {
"type": "object",
"properties": {
"expression": {
"type": "string",
"description": "Mathematical expression to evaluate"
}
},
"required": ["expression"]
}
}
]


def mock_call_tool(name: str, arguments: Dict[str, Any]) -> str:
"""Mock function to call a tool."""
if name == "get_weather":
location = arguments.get("location", "Unknown")
return f"Weather in {location}: Sunny, 72°F, Humidity: 45%"
elif name == "calculate":
expression = arguments.get("expression", "0")
try:
result = eval(expression)
return f"Result of {expression} = {result}"
except Exception as e:
return f"Error calculating {expression}: {str(e)}"
else:
return f"Unknown tool: {name}"


async def main():
"""Main function to run the MCP server."""
server = Server("simple-working-mcp-server")

@server.list_tools()
async def list_tools() -> List[Dict[str, Any]]:
"""List available tools."""
return mock_list_tools()

@server.call_tool()
async def call_tool(name: str, arguments: Dict[str, Any]) -> CallToolResult:
"""Call a tool with the given name and arguments."""
try:
result = mock_call_tool(name, arguments)
return CallToolResult(
content=[TextContent(type="text", text=result)]
)
except Exception as e:
return CallToolResult(
content=[TextContent(type="text", text=f"Error: {str(e)}")]
)

# Run the server with proper stdio handling
try:
async with stdio_server() as (read_stream, write_stream):
await server.run(
read_stream,
write_stream,
initialization_options={}
)
except KeyboardInterrupt:
print("Server stopped by user", file=sys.stderr)
except Exception as e:
print(f"Server error: {e}", file=sys.stderr)
sys.exit(1)


if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
print("Server stopped by user", file=sys.stderr)
except Exception as e:
print(f"Server error: {e}", file=sys.stderr)
sys.exit(1)
Loading