Tool

Secure AI agent access with enterprise SSO and RBAC

Webrix MCP-S Gateway is a self-hosted, open-source OAuth gateway that fronts multiple MCP servers with Auth.js-based authentication.

Works with helm

46
Spark score
out of 100
Updated 8 months ago
Version 1.0.9

Add to Favorites

Why it matters

Organizations hire this gateway to centrally control and audit how AI agents access internal systems and data, enforcing authentication, authorization, and compliance policies across all agent interactions.

Outcomes

What it gets done

01

Authenticate AI agents using single sign-on (SSO) integration

02

Enforce role-based access control (RBAC) policies for agent permissions

03

Maintain comprehensive audit trails of all agent access events

04

Manage and vault authentication tokens securely for agent connections

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/mcp-webrix-mcp-gateway | bash

Overview

Webrix MCP Gateway

Webrix MCP-S Gateway is a self-hosted, open-source OAuth gateway for MCP servers, built on Auth.js for 80+ OAuth providers, with STDIO and StreamableHTTP connection support and a hosted managed alternative. Use it when multiple MCP servers need one authenticated entry point instead of per-server auth. Skip it for a single unauthenticated local MCP server, or use the hosted version to avoid self-hosting OAuth.

What it does

Webrix MCP-S Gateway (@mcp-s/mcp) is an open-source, self-hosted OAuth gateway and integration layer that sits in front of one or more MCP servers, giving a single, enterprise-ready endpoint for connecting, managing, and securing them. It supports both STDIO and StreamableHTTP MCP connection types, and adds OAuth authentication in front of the whole setup by building on Auth.js, which supports 80+ OAuth providers out of the box - Google, Okta, Azure AD, GitHub, and others - so the gateway doesn't need to reimplement OAuth flows itself.

When to use - and when NOT to

Reach for this gateway when several MCP servers need to sit behind one authenticated endpoint - configured once in an mcp.json file - rather than each server implementing its own auth. It fits teams already using OAuth-based SSO who want AI clients like Claude, Cursor, Windsurf, VS Code, Cline, Highlight AI, or Augment Code to connect through a single StreamableHTTP or STDIO endpoint, with a ?server_name=XXX query parameter letting a client target one specific configured server. It's not needed for a single local MCP server with no auth requirement; teams that would rather not self-host and configure OAuth providers themselves can instead use Webrix's fully managed hosted solution, which adds zero-config setup, 20+ pre-built connectors, roles and permissions, and monitoring on top of the same gateway model.

Capabilities

  • Self-hosted gateway deployable within your own infrastructure, with full STDIO and StreamableHTTP MCP connection support.
  • OAuth authentication via Auth.js, configured per-provider through environment variables (AUTH_PROVIDER plus provider-specific AUTH_[Provider]ID/AUTH[Provider]_SECRET values) - documented setups exist for Google, Okta, Azure AD, and GitHub, including GitHub scope selection such as repo for repository-accessing MCP servers like Octocode.
  • Configurable via CLI flags (--mcp-config, --envfile) and environment variables, including PORT, BASE_URL, AUTH_SECRET (required, generated with openssl rand -base64 33), TOKEN_EXPIRATION_TIME, and DB_PATH for its SQLite store.
  • TypeScript throughout, MIT-licensed, with production deployment options covering PM2 process management, Docker/Kubernetes, and platforms like Heroku, Railway, or Render.

How to install

npx @mcp-s/secure-mcp-gateway

This runs the gateway using the default ./mcp.json and ./.env in the current directory; pass --mcp-config and --envfile to point at custom paths, or clone the repository and run npm install && npm run start instead. Note the node:sqlite module requires Node.js 22 or later - an older Node version raises an ERR_UNKNOWN_BUILTIN_MODULE error, fixable by upgrading, e.g. nvm install 22 && nvm use 22.

Who it's for

Teams and developers who run multiple MCP servers and want one OAuth-secured, self-hosted entry point for AI coding clients to connect through, without hand-rolling OAuth integration for each provider. Organizations that would rather skip self-hosting and OAuth-provider setup entirely can use Webrix's managed hosted version instead, which adds enterprise SSO, pre-built connectors, and an uptime SLA.

Source README

mcp-gateway logo

Webrix MCP-S Gateway
A secure, open-source OAuth gateway for MCP authentication

Gateway + integration layer for the Model Context Protocol (MCP)

MCP Gateway is released under the MIT license npm latest release Downloads GitHub Stars


MCP-S Gateway

mcp-gateway is a secure gateway and integration layer for the Model Context Protocol (MCP). It provides a unified, enterprise-ready interface for connecting, managing, and extending MCP modules and services, with a focus on security and seamless integration.

MCP Gateway Demo

Quick Start

1. Configure your MCP servers - Create mcp.json file in your project:

{
  "mcpServers": {
    "your-server": {
      "command": "npx",
      "args": ["-y", "@your-mcp-server"],
      "env": {
        "API_KEY": "your-api-key"
      }
    },
    "octocode": {
      "command": "npx",
      "args": ["octocode-mcp"]
    }
  }
}

2. Use the .env.example file as a base, and override as needed:

3. Start with npx (Recommended):

# Default (uses ./mcp.json and ./.env)
npx @mcp-s/secure-mcp-gateway

# Custom configuration paths
npx @mcp-s/secure-mcp-gateway --mcp-config ./custom/mcp.json --envfile ./custom/.env

Or clone:

git clone https://github.com/mcp-s-ai/secure-mcp-gateway.git && cd secure-mcp-gateway
npm install && npm run start

4. Add to your MCP configuration:

stdio:

{
  "mcpServers": {
    "mcp-gateway": {
      "command": "npx",
      "args": ["-y", "@mcp-s/mcp"],
      "env": {
        "BASE_URL": "http://localhost:3000"
      }
    }
  }
}

Streamable HTTP Configuration:

{
  "mcpServers": {
    "mcp-gateway": {
      "url": "http://localhost:3000/mcp"
    }
  }
}

Features

  • Self-Hosted Gateway: Deploy within your own infrastructure for maximum control
  • OAuth Authentication: Secure authentication with any OAuth provider via Auth.js
  • TypeScript Support: Fully typed for robust development

Supports all MCP Connection Types:

  • STDIO: Standard input/output MCP servers

  • StreamableHTTP: HTTP-based streaming connections via http://localhost:3000/mcp (or https://<your-domain>/mcp for hosted deployments)

    Server Selection: You can connect to a specific MCP server by adding the ?server_name=XXX query parameter, where XXX is the name of the server from your mcp.json configuration. For example: http://localhost:3000/mcp?server_name=your-server

    Connect with your preferred AI client:

    Client Link
    Claude Claude claude.ai
    Cursor Cursor cursor.com
    Windsurf Windsurf codeium.com/windsurf
    VSCode VSCode code.visualstudio.com
    Cline Cline cline.tools
    Highlight AI Highlight AI highlightai.com
    Augment Code Augment Code augmentcode.com

Deploy

Deploy the mcp-s gateway using npx:

  1. Set up your environment variables (see Advanced Configuration)
  2. Create your mcp.json configuration file
  3. Run npx @mcp-s/secure-mcp-gateway

For production deployments, consider using:

  • Process managers like PM2: pm2 start "npx @mcp-s/secure-mcp-gateway" --name mcp-gateway
  • Container orchestration (Docker, Kubernetes)
  • Cloud platforms (Heroku, Railway, Render)

Authentication Setup

Auth.js logo

mcp-gateway leverages the power of Auth.js, which supports 80+ OAuth providers out of the box. This makes Auth.js the perfect companion for an open-source project like mcp-gateway. Both libraries share the same commitment to flexibility, security, and developer experience. By integrating with Auth.js, we avoid reinventing authentication wheels and instead provide you with battle-tested, production-ready OAuth flows that work seamlessly across providers.

Simply set the AUTH_PROVIDER environment variable and provide the required credentials for your chosen provider - mcp-gateway handles the rest.

Google OAuth Setup

Documentation: Auth.js Google Provider

AUTH_SECRET=your-random-secret
AUTH_PROVIDER=google
AUTH_GOOGLE_ID=your-google-client-id
AUTH_GOOGLE_SECRET=your-google-client-secret
Okta OAuth Setup

Documentation: Auth.js Okta Provider

AUTH_SECRET=your-random-secret
AUTH_PROVIDER=okta
AUTH_OKTA_ID=your-okta-client-id
AUTH_OKTA_SECRET=your-okta-client-secret
AUTH_OKTA_ISSUER=https://your-okta-domain.okta.com/oauth2/default
Azure AD OAuth Setup

Documentation: Auth.js Azure AD Provider

AUTH_SECRET=your-random-secret
AUTH_PROVIDER=azure-ad
AUTH_AZURE_AD_ID=your-azure-client-id
AUTH_AZURE_AD_SECRET=your-azure-client-secret
AUTH_AZURE_AD_TENANT_ID=your-tenant-id-or-common
GitHub OAuth Setup

Documentation: Auth.js GitHub Provider

GitHub OAuth is particularly useful for MCP servers that interact with GitHub repositories, such as Octocode. When using GitHub OAuth, you can specify scopes to control what permissions your MCP servers have access to.

AUTH_SECRET=your-random-secret
AUTH_PROVIDER=github
AUTH_GITHUB_ID=your-github-client-id
AUTH_GITHUB_SECRET=your-github-client-secret
AUTH_GITHUB_SCOPES=repo

Common GitHub Scopes:

  • repo - Full access to repositories (public and private)
  • public_repo - Access to public repositories only
  • read:user - Read access to user profile information
  • user:email - Access to user email addresses

For Octocode and similar MCP servers that need repository access, the repo scope is typically required.

For other providers, see the Auth.js Providers documentation.

Advanced Configuration

Command Line Options
Option Description Default Value Example
--mcp-config Path to MCP servers configuration file ./mcp.json --mcp-config ./config/servers.json
--envfile Path to environment variables file ./.env --envfile ./config/production.env
Environment Variables
Environment Variable Description Default Value Required
PORT Server port 3000 No
BASE_URL Base URL for the gateway http://localhost:3000 No
AUTH_SECRET Secret for signing/encrypting tokens (generate with openssl rand -base64 33) - Yes
AUTH_PROVIDER OAuth provider name google No
TOKEN_EXPIRATION_TIME Token expiration time in milliseconds 86400000 (24h) No
DB_PATH SQLite database file path ./mcp.sqlite No
AUTH_[Provider]_ID OAuth client ID for your provider - Yes
AUTH_[Provider]_SECRET OAuth client secret for your provider - Yes
AUTH_[Provider]_* Additional provider-specific variables (see Auth.js documentation) - Varies

Troubleshooting

StreamableHTTP with Cursor: Tools not appearing after login

Issue: When using StreamableHTTP configuration in Cursor, tools don't appear even after successful authentication.

Solution: Make sure you have only one Cursor window open. Multiple Cursor windows can interfere with the MCP connection establishment.

  1. Close all Cursor windows
  2. Open a single Cursor window
  3. Retry the authentication process
Node.js SQLite module error

Issue: You see the following error:

Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: node:sqlite

Solution: This error occurs when using an older version of Node.js. The node:sqlite module requires Node.js version 22 or higher.

Fix:

  1. Update Node.js to version 22 or later
  2. Verify your version: node --version
  3. Restart the gateway: npm run start

Installation options:

  • Using nvm: nvm install 22 && nvm use 22
  • Download from nodejs.org

Hosted Solution

Visit webrix.ai for our fully managed hosting solution with advanced features:

  • Zero Configuration: Get started in seconds without any setup
  • Enterprise-grade Security: Advanced SSO authentication for all MCP interactions
  • 20+ Pre-built Connectors: Fast plug-and-play integration with hundreds of tools
  • Roles & Permissions: Granular access control with custom role definitions
  • Monitoring & Analytics: Real-time insights into your MCP usage
  • High Availability: 99.9% uptime SLA with global CDN
  • Premium Support: Direct access to our engineering team
  • Custom Integrations: Build and deploy custom MCP connectors

Community

Have questions? Need help getting started? Want to share your MCP setup?

Join our Slack community where developers are actively helping each other with MCP gatway implementations, troubleshooting, and sharing best practices.

๐Ÿ’ฌ Join our Slack community โ†’

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.