MCP-S Gateway logo

MCP-S Gateway

Organization
webrix-ai

A secure, open-source OAuth gateway for MCP authentication

Publisherwebrix-ai
Repositorysecure-mcp-gateway
LanguageTypeScript
Forks
4
Stars
23
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    MCP-S Gateway exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    23 stars and 4 forks from the linked repository.


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.

Quick Start

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

json
{
  "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):

bash
# 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:

bash
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:

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

Streamable HTTP Configuration:

json
{
  "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:

    ClientLink
    Claudeclaude.ai
    Cursorcursor.com
    Windsurfcodeium.com/windsurf
    VSCodecode.visualstudio.com
    Clinecline.tools
    Highlight AIhighlightai.com
    Augment Codeaugmentcode.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

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.

Documentation: Auth.js Google Provider

env
AUTH_SECRET=your-random-secret
AUTH_PROVIDER=google
AUTH_GOOGLE_ID=your-google-client-id
AUTH_GOOGLE_SECRET=your-google-client-secret

Documentation: Auth.js Okta Provider

env
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

Documentation: Auth.js Azure AD Provider

env
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

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.

env
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

OptionDescriptionDefault ValueExample
--mcp-configPath to MCP servers configuration file./mcp.json--mcp-config ./config/servers.json
--envfilePath to environment variables file./.env--envfile ./config/production.env

Environment Variables

Environment VariableDescriptionDefault ValueRequired
PORTServer port3000No
BASE_URLBase URL for the gatewayhttp://localhost:3000No
AUTH_SECRETSecret for signing/encrypting tokens (generate with openssl rand -base64 33)-Yes
AUTH_PROVIDEROAuth provider namegoogleNo
TOKEN_EXPIRATION_TIMEToken expiration time in milliseconds86400000 (24h)No
DB_PATHSQLite database file path./mcp.sqliteNo
AUTH_[Provider]_IDOAuth client ID for your provider-Yes
AUTH_[Provider]_SECRETOAuth client secret for your provider-Yes
AUTH_[Provider]_*Additional provider-specific variables (see Auth.js documentation)-Varies

Troubleshooting

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

Issue: You see the following error:

text
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 →

License

Released under the MIT License. Contributions welcome - star & fork!

Installation

TypingMind
{
  "mcpServers": {
    "webrix-ai-secure-mcp-gateway": {
      "command": "npx",
      "args": [
        "-y",
        "@mcp-s/secure-mcp-gateway"
      ]
    }
  }
}

Use MCP-S Gateway MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once MCP-S Gateway is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add MCP-S Gateway as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the MCP-S Gateway MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "webrix-ai-secure-mcp-gateway": {
      "command": "npx",
      "args": [
        "-y",
        "@mcp-s/secure-mcp-gateway"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the MCP-S Gateway MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the MCP-S Gateway MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MCP-S Gateway to help me with this task?
MCP-S Gateway
Sure. I read it.
Here is what I found using MCP-S Gateway.

Frequently asked questions

What is the MCP-S Gateway MCP server used for?

MCP-S Gateway is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use MCP-S Gateway MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use MCP-S Gateway with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use MCP-S Gateway MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With MCP-S Gateway connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect MCP-S Gateway MCP to TypingMind?

MCP-S Gateway runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does MCP-S Gateway MCP provide in TypingMind?

MCP-S Gateway exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use MCP-S Gateway MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If MCP-S Gateway requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇