Integrated Server Architecture
The Integrated Server combines both MCP and webhook server functionality into a single FastAPI application. This document details the architecture, implementation, and deployment patterns for the unified server approach.
Overview
The integrated server provides a comprehensive solution that handles both MCP client requests and Slack webhook events in a single deployment. This approach simplifies deployment, reduces operational overhead, and enables unified configuration and monitoring.
Architecture Components
The Integrated Server uses the common instance management design shared across all server types in this project. For detailed information about factory patterns, singleton management, token handling, and testing support, see the Common Instance Management documentation.
Integrated Application Factory
The core integration function that creates a unified FastAPI app:
from slack_mcp.integrate.server import create_integrated_app
def create_integrated_app(
token: Optional[str] = None,
mcp_transport: str = "sse",
mcp_mount_path: Optional[str] = "/mcp",
retry: int = 3,
) -> FastAPI:
# Create webhook server as base
app = create_slack_app()
# Initialize shared Slack client
initialize_slack_client(token, retry=retry)
# Mount MCP server based on transport type
if mcp_transport == "sse":
mcp_app = _server_instance.sse_app(mount_path=mcp_mount_path)
app.mount(mcp_mount_path or "/mcp", mcp_app)
elif mcp_transport == "streamable-http":
mcp_app = _server_instance.streamable_http_app()
# Merge routes for HTTP streaming
for route in mcp_app.routes:
app.routes.append(route)
return app
Unified FastAPI Application
The integrated server uses FastAPI as the foundation, providing:
- Webhook Endpoints:
/slack/eventsfor Slack event processing - MCP Endpoints: Mounted at configurable path (default:
/mcp) - Health Checks: Unified health monitoring for both components
- OpenAPI Documentation: Combined API documentation