refac fastmcp custom implementation to standard

This commit is contained in:
Taylor Wilsdon
2025-05-30 11:09:56 -04:00
parent b00fe41de8
commit 395d02494b
7 changed files with 261 additions and 730 deletions

19
main.py
View File

@@ -1,12 +1,10 @@
import asyncio
import argparse
import logging
import os
import sys
import uvicorn
# Local imports
from core.server import server, create_application
from core.server import server
# Configure basic console logging
logging.basicConfig(
@@ -45,7 +43,7 @@ import gdocs.docs_tools
def main():
"""
Main entry point for the Google Workspace MCP server.
Uses streamable-http transport via a Starlette application with SessionAwareStreamableHTTPManager.
Uses FastMCP's native streamable-http transport.
"""
# Parse command line arguments
parser = argparse.ArgumentParser(description='Google Workspace MCP Server')
@@ -61,16 +59,9 @@ def main():
try:
logger.info("Google Workspace MCP server starting...")
# Create the Starlette application with our custom session manager
app = create_application(base_path="/mcp")
# Run the application with uvicorn
uvicorn.run(
app,
host="0.0.0.0",
port=int(os.getenv("WORKSPACE_MCP_PORT", 8000)),
log_level="info"
)
# Use FastMCP's native run method
# FastMCP handles the transport and server configuration internally
server.run()
except KeyboardInterrupt:
logger.info("Server shutdown requested via keyboard interrupt")
sys.exit(0)