Authenticated MCP SSE Server

Authenticated MCP SSE Server

A secure MCP (Model Context Protocol) server hosted on Google Cloud Run that enables team collaboration by providing authenticated access via Google Cloud IAM, allowing teams to share custom MCP servers over the internet before official MCP authentication is implemented.

the-freetech-company

Cloud Platforms
Category.security-and-iam
Developer Tools
TypeScript
Visit Server

README

Host MCP SSE Server on Google Cloud Run

At the momenet (03/04/2024) MCP is still addressing Authentication and Authorization. They plan to complete this in H1 2025. The issue is, I want to share my MCP server with my team NOW. So here we are. The only immediate answer to use a SSE MCP server in Cursor, etc.. right now is a network layer based solution (e.g., a proxy). Basic auth, api keys, forget about it.

Utilizing GCP Cloud Run and User Based IAM Authentication, I have created a simple, secure way to allow clients to access a custom MCP server over the internet.

MCP Roadmap

MCP Not Supported

How it works

The MCP server is hosted on Google Cloud Run. Utilizing Cloud Run IAM Authentication, we can securely connect to the server from the internet by utilizing the Google Cloud SDK to create a proxy connection.

TLDR README

This should work out of the box with minimal config if you already have docker and the gcloud CLI set up locally.

Step 1: Update deploy.sh with your project id, service account email, etc.

Step 2: On deploy success, grab the cloud run URL that was provided, and add it to mcp_proxy.ts along with your project id.

Step 3: Run the proxy npx ts-node mcp_proxy.ts Running proxy asking question

Step 3: Access your MCP server using http://localhost:3030 - Add it to Cursor under Settings > Features > MCP Servers (make sure you select SSE not command)

LONG BORING README

Deployment Steps

  1. Clone the repository
  2. Run npm install to install the dependencies
  3. Run npm run dev to start the server locally

Deployment to Google Cloud Run

To deploy your MCP server to Google Cloud Run:

  1. Make sure you have the Google Cloud SDK installed
  2. Update the deploy.sh script with your project details:
    • PROJECT_ID: Your Google Cloud project ID
    • REGION: Your preferred GCP region
    • SERVICE_ACCOUNT_EMAIL: The service account email with appropriate permissions
  3. Run the deployment script:
    chmod +x deploy.sh
    ./deploy.sh
    

The deployment script will:

  • Build a Docker container for your MCP server
  • Push it to Google Container Registry
  • Deploy it to Cloud Run with authentication enabled

Connecting to your deployed MCP server

To connect to your deployed MCP server:

  1. Run the MCP proxy locally:

    npx ts-node mcp_proxy.ts
    
  2. The proxy will:

    • Check if you're authenticated with Google Cloud
    • Obtain authentication tokens automatically
    • Create a local proxy server (default: http://localhost:3030)
    • Forward authenticated requests to your Cloud Run service
  3. Configure your MCP client to connect to the local proxy URL

Use the MCP server in Cursor

  1. First, let's run our proxy to establish a connection between our local machine and the MCP server hosted on Google Cloud Run.
npx ts-node mcp_proxy.ts
  1. Now let's add our local proxy server to cursor within the Setting > Features tab in the MCP server section.

Adding proxy to cursor

Adding proxy to cursor

  1. Now, we're good to go! Start a new composer (ensure you are in agent mode) and ask what the weather is in a location. Your ouput in your terminal where the proxy is connected + the output of your composer should look like this:

Running proxy asking question

Security

This setup provides several security benefits:

  • Your MCP server is not publicly accessible without authentication
  • All connections are secured with Google Cloud IAM
  • Team members need Google Cloud SDK access to connect

Connection Issues

  • Verify the Cloud Run URL in mcp_proxy.ts matches your deployed service
  • Check Cloud Run logs for any server-side errors

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Playwright MCP Server

Playwright MCP Server

Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.

Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Apple MCP Server

Apple MCP Server

Enables interaction with Apple apps like Messages, Notes, and Contacts through the MCP protocol to send messages, search, and open app content using natural language.

Featured
Local
TypeScript
contentful-mcp

contentful-mcp

Update, create, delete content, content-models and assets in your Contentful Space

Featured
TypeScript