45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""
|
||
|
|
MCP Development Server Runner
|
||
|
|
Optimized for use with: mcp dev dev_run.py
|
||
|
|
|
||
|
|
This file is specifically designed for MCP development workflow.
|
||
|
|
It automatically starts the server with SSE transport on port 3000.
|
||
|
|
"""
|
||
|
|
|
||
|
|
import sys
|
||
|
|
import os
|
||
|
|
import logging
|
||
|
|
|
||
|
|
# Configure logging to reduce noise
|
||
|
|
logging.getLogger("mcp").setLevel(logging.WARNING)
|
||
|
|
logging.getLogger("uvicorn").setLevel(logging.WARNING)
|
||
|
|
logging.getLogger("uvicorn.access").setLevel(logging.WARNING)
|
||
|
|
|
||
|
|
# Add the src directory to the Python path
|
||
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
|
||
|
|
|
||
|
|
from mcp_template.server.modular_server import create_default_server
|
||
|
|
|
||
|
|
# Create and expose the MCP server for dev mode
|
||
|
|
# This is what mcp dev command looks for
|
||
|
|
print("Initializing MCP Development Server...")
|
||
|
|
print("SSE Transport on port 3000")
|
||
|
|
|
||
|
|
# Create the server with dev settings
|
||
|
|
server = create_default_server()
|
||
|
|
|
||
|
|
# Extract the FastMCP instance for MCP dev command compatibility
|
||
|
|
mcp = server.mcp
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
mcp.run()
|
||
|
|
|
||
|
|
# print(" MCP server ready for development!")
|
||
|
|
# print("Use: mcp dev dev_run.py")
|
||
|
|
# print("Server will be available at: http://0.0.0.0:3000/sse")
|
||
|
|
#uv run mcp dev dev_run.py
|
||
|
|
# The MCP dev command will handle running the server
|
||
|
|
# We just need to make the mcp object available
|