MCP Gateway MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
pip install mcp-gateway
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add mcp-gateway -- node "<FULL_PATH_TO_MCP_GATEWAY>/dist/index.js"

Replace <FULL_PATH_TO_MCP_GATEWAY>/dist/index.js with the actual folder you prepared in step 1.

README.md

The production platform for MCP tools.

MCP Gateway

The production platform for MCP tools.

Claude Desktop can connect to your internal tools — databases, filesystems, APIs, anything — through a single authenticated endpoint. You control who can use which tools, every action is logged, and no raw credentials ever leave your server.

Built-in tools: SQL query (Postgres, MySQL, SQLite, MSSQL), filesystem access. Custom tools: plug in anything that implements the MCP tool interface.

See it in action — short demo of Claude Desktop querying a database through MCP Gateway.

Overview

MCP Gateway sits between AI assistants and your databases. It:

  1. Authenticates users via password login, Microsoft Entra ID (Azure AD), or API keys
  2. Enforces role-based access control (viewer / analyst / admin)
  3. Exposes databases as MCP tools that AI assistants can discover and call
  4. Translates natural language questions into SQL via Claude, executes queries, and summarizes results
  5. Logs all activity to a structured audit trail
Claude Desktop / mcp-remote
        │
        │ MCP over SSE (OAuth 2.1 + PKCE)
        ▼
┌─────────────────────────────────────────────────────────┐
│                      MCP Gateway                        │
│                                                         │
│  ┌──────────┐  ┌──────────┐  ┌───────────────────────┐ │
│  │ Auth /   │  │  Admin   │  │   MCP SSE Endpoint    │ │
│  │ OAuth    │  │   UI     │  │  /t/{slug}/mcp/sse    │ │
│  └──────────┘  └──────────┘  └───────────────────────┘ │
│                                          │              │
│  ┌──────────────────────────────────────┐│              │
│  │         Tool Providers               ││              │
│  │  sql.py → get_schema / execute_sql   ││              │
│  └──────────────────────────────────────┘│              │
└─────────────────────────────────────────┼───────────────┘
                                          │ Decrypted DSN
                    ┌─────────────────────┼────────────────┐
                    │   Your Databases    │                │
                    │  Postgres  MySQL  MSSQL  SQLite      │
                    └────────────────────────────────────  ┘

What you get out of the box

For your organisation

  • One URL for Claude Desktop — users authenticate once, access everything they're allowed
  • Microsoft Entra ID SSO — roles assigned automatically from Azure AD groups
  • Full audit trail — every tool call, every query, every login, who did what and when

For your tools

  • Drop any MCP tool into the gateway and it inherits auth, RBAC, and logging automatically
  • Per-tool role overrides — restrict SQL execution to analysts, filesystem writes to admins
  • Bundled: SQL tools (4 databases), filesystem tools (read, write, search, tree)

For your security team

  • No credentials on employee machines
  • Tenant isolation — org A cannot see org B's tools or data
  • API keys for CI/CD, OAuth 2.1 + PKCE for human users

Supported Databases

Database Driver DSN Format
PostgreSQL psycopg2 postgresql://user:pass@host/db
MySQL / MariaDB PyMySQL mysql+pymysql://user:pass@host/db
Microsoft SQL Server pymssql mssql+pymssql://user:pass@host/db
SQLite Built-in sqlite:///path/to/file.db

Filesystem Tools

  • Sandboxed file read/write/search exposed as MCP tools
  • Enabled via FILESYSTEM_ALLOWED_DIRS environment variable
  • Read operations (analyst+): fs_read_file, fs_list_directory, fs_directory_tree, fs_search_files, fs_get_file_info
  • Write operations (admin): fs_write_file, fs_create_directory, fs_move_file

Admin UI

  • Web interface served at /admin/
  • Manage connections, users, SSO config, API keys, and tool roles
  • View audit logs, generated SQL, and query results

Architecture

Technology Stack

Layer Technology Version
API Framework FastAPI 0.131.0
ASGI Server Uvicorn 0.34.0
ORM SQLAlchemy 2.0.30
Migrations Alembic 1.13.1
Auth / JWT PyJWT + bcrypt 2.12.0 / 4.0.1
Encryption cryptography (Fernet) 46.0.5
LLM Anthropic SDK 0.42.0
MCP Protocol mcp 1.23.

Tools (5)

sql_queryExecutes SQL queries against connected databases including Postgres, MySQL, SQLite, and MSSQL.
fs_read_fileReads the content of a file from allowed directories.
fs_list_directoryLists files and directories within an allowed path.
fs_search_filesSearches for files matching a pattern within allowed directories.
fs_write_fileWrites content to a file in allowed directories (admin role required).

Environment Variables

FILESYSTEM_ALLOWED_DIRSComma-separated list of directories accessible to the filesystem tools.
DATABASE_URLConnection string for the primary database.

Configuration

claude_desktop_config.json
{"mcpServers": {"mcp-gateway": {"command": "python", "args": ["-m", "mcp_gateway"], "env": {"DATABASE_URL": "postgresql://user:pass@host/db", "FILESYSTEM_ALLOWED_DIRS": "/path/to/data"}}}}

Try it

Query the sales database to find the total revenue for the last quarter.
List all files in the project directory and summarize the contents of config.json.
Search for all log files created in the last 24 hours and identify any error patterns.
Update the README.md file in the documentation folder with the latest deployment steps.

Frequently Asked Questions

What are the key features of MCP Gateway?

Role-based access control (RBAC) for tool execution. Unified authentication via password, API keys, or Microsoft Entra ID. Comprehensive audit logging for all tool calls and database queries. Support for multiple database types including Postgres, MySQL, MSSQL, and SQLite. Sandboxed filesystem access with configurable directory restrictions.

What can I use MCP Gateway for?

Enabling secure, audited database access for non-technical analysts via Claude. Centralizing internal tool management for enterprise AI deployments. Providing controlled filesystem access to AI agents for automated documentation updates. Implementing SSO-based security policies for AI-assisted data analysis.

How do I install MCP Gateway?

Install MCP Gateway by running: pip install mcp-gateway

What MCP clients work with MCP Gateway?

MCP Gateway works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP Gateway docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare