Skip to content

feat(mcp): add Streamable HTTP transport support with SSE#9858

Open
yakir-shriker wants to merge 4 commits intofirebase:mainfrom
yakir-shriker:feat/mcp-streamable-http-transport
Open

feat(mcp): add Streamable HTTP transport support with SSE#9858
yakir-shriker wants to merge 4 commits intofirebase:mainfrom
yakir-shriker:feat/mcp-streamable-http-transport

Conversation

@yakir-shriker
Copy link

@yakir-shriker yakir-shriker commented Feb 2, 2026

Summary

This PR adds support for the MCP Streamable HTTP transport protocol alongside the existing STDIO transport, enabling:

  • Remote MCP connections over HTTP
  • SSE (Server-Sent Events) streaming for long-running operations
  • Horizontal scaling and load balancing capabilities
  • Production cloud deployments

Changes

New CLI Options

Option Description Default
--transport Transport mode: stdio or streamable-http stdio
--port HTTP server port 8000
--host HTTP server host 127.0.0.1
--stateless Enable stateless mode for horizontal scaling false

New Files

  • src/mcp/http-transport.ts - HTTP transport module using StreamableHTTPServerTransport from MCP SDK
  • src/mcp/http-transport.spec.ts - Comprehensive unit tests

Modified Files

  • src/bin/mcp.ts - Added transport CLI options and validation
  • src/mcp/index.ts - Updated start() method to support transport options, added stop() method
  • src/mcp/README.md - Added HTTP transport documentation
  • src/mcp/server.json - Added streamable-http transport configuration

HTTP Endpoints

  • POST /mcp - Main MCP endpoint for JSON-RPC requests
  • GET /mcp - SSE endpoint for server-initiated messages
  • DELETE /mcp - Session termination (when not in stateless mode)
  • GET /health - Health check endpoint

Security Features

  • CORS middleware with configurable allowed origins
  • Security headers (X-Content-Type-Options, X-Frame-Options, X-XSS-Protection)
  • Origin validation to prevent DNS rebinding attacks

Usage Examples

# STDIO mode (default, unchanged behavior)
firebase mcp --dir /path/to/project

# Streamable HTTP mode
firebase mcp --transport streamable-http --port 8000 --dir /path/to/project

# Stateless mode for horizontal scaling
firebase mcp --transport streamable-http --port 8000 --stateless

MCP client configuration for HTTP:

{
  "mcpServers": {
    "firebase": {
      "transport": {
        "type": "streamable-http",
        "url": "http://localhost:8000/mcp"
      }
    }
  }
}

Test Plan

  • All existing MCP tests pass
  • New HTTP transport unit tests pass (8 tests)
  • Manual testing: HTTP server starts and responds to health checks
  • Manual testing: Help text displays new options correctly
  • TypeScript compiles without errors
  • Integration testing with MCP clients (Cursor, Claude, etc.)

Dependencies

No new dependencies required - uses existing:

  • express (already in package.json)
  • @modelcontextprotocol/sdk (already includes StreamableHTTPServerTransport)

@google-cla
Copy link

google-cla bot commented Feb 2, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yakir-shriker, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Firebase MCP server by integrating a Streamable HTTP transport. This upgrade moves beyond the existing STDIO transport, providing capabilities for remote connections, real-time data streaming via Server-Sent Events, and improved scalability for cloud environments. The changes include new configuration options, robust security measures, and a clear structure for HTTP-based interactions, making the MCP server more versatile and production-ready.

Highlights

  • New Streamable HTTP Transport: Introduces a new Streamable HTTP transport for the Model Context Protocol (MCP) server, allowing for remote connections and advanced deployment scenarios.
  • Enhanced Capabilities: This new transport enables Server-Sent Events (SSE) for streaming long-running operations, supports horizontal scaling, and facilitates production cloud deployments.
  • New CLI Options: Adds command-line interface options --transport, --port, --host, and --stateless to configure the MCP server's transport mode and HTTP server settings.
  • Security Features: Implements CORS middleware with configurable allowed origins, along with standard security headers (X-Content-Type-Options, X-Frame-Options, X-XSS-Protection) and origin validation to enhance server security.
  • New HTTP Endpoints: Exposes dedicated HTTP endpoints for MCP communication (POST /mcp for JSON-RPC, GET /mcp for SSE, DELETE /mcp for session termination) and a health check (GET /health).

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces Streamable HTTP transport support for the MCP server, which is a significant feature enabling remote connections and better scalability. The implementation is well-structured, with new modules for HTTP transport and comprehensive tests. I've identified a few areas for improvement, including a potential race condition during server shutdown and some redundant code in route handling and argument parsing. Overall, this is a great addition.

Add support for the MCP Streamable HTTP transport protocol alongside
the existing STDIO transport. This enables remote MCP connections,
production deployments, and horizontal scaling capabilities.

Changes:
- Add --transport CLI option to choose between 'stdio' and 'streamable-http'
- Add --port, --host, and --stateless options for HTTP transport configuration
- Create http-transport.ts module using StreamableHTTPServerTransport from MCP SDK
- Implement /mcp endpoint for MCP communication (POST/GET/DELETE)
- Add /health endpoint for health checks
- Add CORS middleware with configurable allowed origins
- Add security headers (X-Content-Type-Options, X-Frame-Options, etc.)
- Update FirebaseMcpServer.start() to support transport options
- Add stop() method for graceful server shutdown
- Update server.json with streamable-http transport documentation
- Update README.md with HTTP transport usage instructions
- Add comprehensive unit tests for HTTP transport
@yakir-shriker yakir-shriker force-pushed the feat/mcp-streamable-http-transport branch from 335b973 to a1f1f5c Compare February 2, 2026 13:43
- Fix race condition in close() by awaiting transport.close() before server.close()
- Remove redundant DELETE route handler (already handled by app.all)
- Remove redundant OR fallbacks in mcp.ts (parseArgs already has defaults)
@yakir-shriker
Copy link
Author

@annajowang

@yakir-shriker
Copy link
Author

@andrewbrook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant