Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions packages/developer_mcp_server/src/developer_mcp_server/http_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""ASGI application for MCP server over StreamableHTTP.

This module exports the ASGI application for use with ASGI servers like gunicorn + uvicorn.
It imports the configured MCP server and exposes its StreamableHTTP application.
"""

from fastmcp.server.http import create_streamable_http_app

from developer_mcp_server.server import mcp

# Note: We use StreamableHTTP with json_response=True and stateless_http=True to enable
# fully stateless operation. This allows horizontal scaling without sticky sessions
# since no session state is maintained between requests.
http_app = create_streamable_http_app(
server=mcp,
streamable_http_path="/mcp",
json_response=True,
stateless_http=True,
)
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"""ASGI application for MCP server over HTTP/SSE.

Note: This SSE transport requires sticky sessions for horizontal scaling since
session state is maintained in-memory per worker. For stateless operation,
use http_app.py instead which uses StreamableHTTP with JSON responses.
"""

from fastmcp.server.http import create_sse_app

from developer_mcp_server.server import mcp
Expand Down
34 changes: 34 additions & 0 deletions packages/secops_mcp_server/src/secops_mcp_server/http_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""ASGI application for MCP server over StreamableHTTP.

This module exports the ASGI application for use with ASGI servers like gunicorn + uvicorn.
It imports the configured MCP server and exposes its StreamableHTTP application.

This module is specifically for production deployment with gunicorn.
For local development, use the run_http_with_uvicorn() function instead.


"""

import logging

from fastmcp.server.http import create_streamable_http_app
from gg_api_core.sentry_integration import init_sentry

from secops_mcp_server.server import mcp

logger = logging.getLogger(__name__)

# Initialize Sentry for production deployment
init_sentry()

# Note: We use StreamableHTTP with json_response=True and stateless_http=True to enable
# fully stateless operation. This allows horizontal scaling without sticky sessions
# since no session state is maintained between requests.
app = create_streamable_http_app(
server=mcp,
streamable_http_path="/mcp",
json_response=True,
stateless_http=True,
)

logger.info("MCP application initialized for StreamableHTTP transport (stateless JSON mode)")
4 changes: 4 additions & 0 deletions packages/secops_mcp_server/src/secops_mcp_server/sse_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

This module is specifically for production deployment with gunicorn.
For local development, use the run_http_with_uvicorn() function instead.

Note: This SSE transport requires sticky sessions for horizontal scaling since
session state is maintained in-memory per worker. For stateless operation,
use http_app.py instead which uses StreamableHTTP with JSON responses.
"""

import logging
Expand Down
Loading