secure-mcp-gateway: Instructions file for Claude Code

CLAUDE.md

secure-mcp-gateway CLAUDE.md is an instructions file for Claude Code from enkryptai/secure-mcp-gateway. It costs 13,326 tokens per session, scanned A, original, Apache-2.0.

Project instructions for a Python security gateway between MCP clients and MCP servers. MCP is a standard way for AI applications to discover and use external tools.

In plain words
What is it for?
Working on authentication, OAuth, tool discovery, input and output safeguards, caching, monitoring, and the gateway’s management API.
Why use it?
They explain the gateway’s role and code structure, helping contributors understand where connection security, tool controls, caching, and monitoring are handled.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md.

This is enkryptai/secure-mcp-gateway's own configuration. It tells Claude Code how to work on secure-mcp-gateway itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything secure-mcp-gateway configures β†’

Reuse

Borrowing it

Nothing to install: this file belongs to enkryptai/secure-mcp-gateway. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/enkryptai/secure-mcp-gateway/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/enkryptai/secure-mcp-gateway

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for secure-mcp-gateway CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/enkryptai/secure-mcp-gateway/claude-md.svg)](https://agentmods.dev/instructions/enkryptai/secure-mcp-gateway/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/enkryptai/secure-mcp-gateway/claude-md"><img src="https://agentmods.dev/badge/instructions/enkryptai/secure-mcp-gateway/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 13,326 This file is loaded in full into every session.
When invoked 13,326 The same file β€” it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file β€” not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.13326 $0.13326
Opus 5 $0.06663 $0.06663
Sonnet 5 $0.02665 $0.02665
Haiku 4.5 $0.01333 $0.01333

Measured 8d ago against content hash 0b96c60d0a04, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

secure-mcp-gateway CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories β€” prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency β€” measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md Β· 1,580 lines

How it starts

The opening of the file, as written. The whole thing β€” 1,580 lines β€” stays where its author put it; the contents beside it link to each section on GitHub.

Secure MCP Gateway - Complete Project Analysis

Version: 2.1.2 Last Updated: 2026-05-17 Project Type: Python Security Middleware for Model Context Protocol (MCP)


πŸ“‹ Project Overview

Secure MCP Gateway is an Enkrypt AI-developed security middleware that sits between MCP clients (like Claude Desktop, Cursor) and MCP servers. It acts as both an MCP server (to clients) and an MCP client (to actual servers), providing:

  • Authentication & Authorization
  • OAuth 2.0/2.1 Support (Client credentials, mTLS, token management)
  • Dynamic Tool Discovery
  • Guardrails (Input/Output protection)
  • Caching (Local & External Redis/KeyDB)
  • Observability (OpenTelemetry, Prometheus, Grafana)
  • RESTful API for management

πŸ—οΈ Project Structure


secure-mcp-gateway/
β”œβ”€β”€ src/secure_mcp_gateway/
β”‚   β”œβ”€β”€ __init__.py                    # Package initialization
β”‚   β”œβ”€β”€ version.py                     # Version: "2.1.2"
β”‚   β”œβ”€β”€ consts.py                      # Constants and defaults
β”‚   β”œβ”€β”€ utils.py                       # Utilities, lazy logger, masking
β”‚   β”œβ”€β”€ dependencies.py                # Package dependencies list
β”‚   β”‚
β”‚   β”œβ”€β”€ gateway.py                     # ⭐ Main MCP server (FastMCP)
β”‚   β”œβ”€β”€ client.py                      # ⭐ MCP client to actual servers
β”‚   β”œβ”€β”€ cli.py                         # ⭐ CLI interface (huge file)
β”‚   β”œβ”€β”€ api_server.py                  # FastAPI REST API server (port 8001)
β”‚   β”œβ”€β”€ api_routes.py                  # Additional API routes
β”‚   β”œβ”€β”€ api_cache_routes.py            # REST cache flush endpoints (port 8001)
β”‚   β”œβ”€β”€ api_health_routes.py           # REST health endpoints (port 8001)
β”‚   β”œβ”€β”€ gateway_cache_routes.py        # MCP gateway cache flush endpoints (port 8000)
β”‚   β”‚
β”‚   β”œβ”€β”€ error_handling.py              # Standardized error handling
β”‚   β”œβ”€β”€ exceptions.py                  # Custom exception classes
β”‚   β”‚
β”‚   β”œβ”€β”€ plugins/                       # πŸ”Œ Plugin system
β”‚   β”‚   β”œβ”€β”€ plugin_loader.py           # Dynamic plugin discovery
β”‚   β”‚   β”œβ”€β”€ provider_loader.py         # Provider loading utilities
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ auth/                      # Authentication plugins
β”‚   β”‚   β”‚   β”œβ”€β”€ base.py                # AuthProvider abstract class
β”‚   β”‚   β”‚   β”œβ”€β”€ config_manager.py      # Auth plugin manager
β”‚   β”‚   β”‚   β”œβ”€β”€ enkrypt_provider.py    # Enkrypt remote auth
β”‚   β”‚   β”‚   └── example_providers.py   # Local API key provider
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ guardrails/                # Guardrail plugins
β”‚   β”‚   β”‚   β”œβ”€β”€ base.py                # GuardrailProvider abstract class
β”‚   β”‚   β”‚   β”œβ”€β”€ config_manager.py      # Guardrail plugin manager
β”‚   β”‚   β”‚   β”œβ”€β”€ enkrypt_provider.py    # Enkrypt guardrail API
β”‚   β”‚   β”‚   └── example_providers.py   # OpenAI, Custom keyword providers
β”‚   β”‚   β”‚
β”‚   β”‚   └── telemetry/                 # Telemetry plugins
β”‚   β”‚       β”œβ”€β”€ base.py                # TelemetryProvider abstract class
β”‚   β”‚       β”œβ”€β”€ config_manager.py      # Telemetry plugin manager
β”‚   β”‚       β”œβ”€β”€ opentelemetry_provider.py  # OpenTelemetry OTLP
β”‚   β”‚       └── example_providers.py   # Stdout provider
β”‚   β”‚
β”‚   β”œβ”€β”€ services/                      # 🎯 Service layer
β”‚   β”‚   β”œβ”€β”€ cache/
β”‚   β”‚   β”‚   β”œβ”€β”€ cache_service.py       # Core cache operations
β”‚   β”‚   β”‚   β”œβ”€β”€ cache_management_service.py  # Clear cache
β”‚   β”‚   β”‚   └── cache_status_service.py      # Cache statistics
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ discovery/
β”‚   β”‚   β”‚   └── discovery_service.py   # Tool discovery service
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ execution/
β”‚   β”‚   β”‚   β”œβ”€β”€ secure_tool_execution_service.py  # With guardrails
β”‚   β”‚   β”‚   β”œβ”€β”€ tool_execution_service.py         # Basic execution
β”‚   β”‚   β”‚   └── execution_utils.py                # Utilities
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ oauth/                     # πŸ” OAuth 2.0/2.1 service
β”‚   β”‚   β”‚   β”œβ”€β”€ oauth_service.py       # Core OAuth implementation
β”‚   β”‚   β”‚   β”œβ”€β”€ token_manager.py       # Token caching & refresh
β”‚   β”‚   β”‚   β”œβ”€β”€ integration.py         # Client integration
β”‚   β”‚   β”‚   β”œβ”€β”€ models.py              # OAuth data models
β”‚   β”‚   β”‚   β”œβ”€β”€ validation.py          # Scope & token validation
β”‚   β”‚   β”‚   └── metrics.py             # OAuth metrics tracking
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ server/
β”‚   β”‚   β”‚   β”œβ”€β”€ server_listing_service.py  # List all servers
β”‚   β”‚   β”‚   └── server_info_service.py     # Server details
β”‚   β”‚   β”‚
β”‚   β”‚   └── timeout/
β”‚   β”‚       └── timeout_manager.py     # Timeout management
β”‚   β”‚
β”‚   β”œβ”€β”€ bad_mcps/                      # πŸ§ͺ Test MCP servers (security testing)
β”‚   β”‚   β”œβ”€β”€ echo_mcp.py                # Simple echo server
β”‚   β”‚   β”œβ”€β”€ echo_oauth_mcp.py          # OAuth header testing server
β”‚   β”‚   β”œβ”€β”€ bad_mcp.py                 # Multiple attack vectors
β”‚   β”‚   β”œβ”€β”€ bad_output_mcp.py          # Malicious output testing
β”‚   β”‚   β”œβ”€β”€ command_injection_mcp.py   # Command injection scenarios
β”‚   β”‚   β”œβ”€β”€ credential_theft_mcp.py    # Credential theft attacks
β”‚   β”‚   β”œβ”€β”€ mpma_mcp.py                # Multi-parameter manipulation
β”‚   β”‚   β”œβ”€β”€ path_traversal_mcp.py      # Path traversal attacks
β”‚   β”‚   β”œβ”€β”€ prompt_injection_mcp.py    # Prompt injection attacks
β”‚   β”‚   β”œβ”€β”€ rce_mcp.py                 # Remote code execution
β”‚   β”‚   β”œβ”€β”€ resource_exhaustion_mcp.py # DoS/resource exhaustion
β”‚   β”‚   β”œβ”€β”€ schema_poisoning_mcp.py    # Schema manipulation
β”‚   β”‚   β”œβ”€β”€ session_management_mcp.py  # Session attacks
β”‚   β”‚   β”œβ”€β”€ ssrf_mcp.py                # Server-side request forgery
β”‚   β”‚   β”œβ”€β”€ tool_poisoning_mcp.py      # Tool definition attacks
β”‚   β”‚   └── unauthenticated_access_mcp.py  # Auth bypass scenarios
β”‚   β”‚
β”‚   └── example_enkrypt_mcp_config.json  # Example configuration
β”‚
β”œβ”€β”€ observability/                     # Observability stack -- TWO backends, run one
β”‚   β”œβ”€β”€ docker-compose.opensearch.yml  # OpenSearch/Data Prepper stack (PRIMARY; OTLP host :4317/:4318)
β”‚   β”œβ”€β”€ docker-compose.grafana.yml     # Grafana/Prometheus/Loki/Jaeger stack (legacy; OTLP host :4327/:4328)
β”‚   β”œβ”€β”€ .env.opensearch.example        # env template -> copy to .env.opensearch
β”‚   β”œβ”€β”€ .env.grafana.example           # env template -> copy to .env.grafana
β”‚   β”œβ”€β”€ README.opensearch.md           # OpenSearch stack operator guide
β”‚   β”œβ”€β”€ README.md                      # Grafana stack operator guide
β”‚   β”œβ”€β”€ emit_dummy_telemetry.py        # synthetic OTLP emitter (dashboard/monitor verification)
β”‚   β”œβ”€β”€ opensearch/                    # bootstrap.sh + ISM policy / templates / monitors / channel
β”‚   β”‚   β”œβ”€β”€ bootstrap.sh               # idempotent installer (policy, templates, data streams, monitors, local user)
β”‚   β”‚   β”œβ”€β”€ policies/                  # gateway_telemetry_policy.json (7d hot->delete, prio 1000)
β”‚   β”‚   β”œβ”€β”€ templates/                 # gateway-{metrics,traces,logs}-elastic-template.json (SS4O data streams)
β”‚   β”‚   β”œβ”€β”€ monitors/                  # 01..09 bucket-level alerting monitors
β”‚   β”‚   └── notification_channels/     # slack-mcpgw-alerts.json
β”‚   β”œβ”€β”€ opensearch_dashboards/         # saved-objects.ndjson + gateway-dashboards.ndjson (13 viz + 3 dashboards)
β”‚   β”œβ”€β”€ data_prepper/                  # pipelines.yaml + render_pipelines.py (+ unit tests) + config
β”‚   β”œβ”€β”€ otel_collector/                # otel-collector-config.yaml (Grafana) + .opensearch.yaml (OpenSearch)
β”‚   β”œβ”€β”€ grafana/                       # Grafana dashboards + alert provisioning
β”‚   β”œβ”€β”€ prometheus/                    # Prometheus scrape config
β”‚   β”œβ”€β”€ loki/                          # Loki log-aggregation config
β”‚   └── promtail/                      # Promtail config
β”‚
β”‚   NOTE: the apiaas repo is canonical for the OpenSearch resources;
β”‚   observability/opensearch{,_dashboards}/ is a vendored mirror kept in
β”‚   sync by scripts/install/opensearch/sync-check.sh (see apiaas repo).
β”‚
β”œβ”€β”€ docs/                              # Documentation
β”‚   β”œβ”€β”€ claude/
β”‚   β”‚   └── k8s-deployment-runbook.md  # ⭐ EKS dev/prod deploy runbook (manual today)
β”‚   β”œβ”€β”€ secure-mcp-gateway-manifest.yaml          # LIVE dev manifest (gitignored -- holds creds)
β”‚   └── secure-mcp-gateway-manifest-example.yaml  # tracked template for the above
β”œβ”€β”€ pyproject.toml                     # Python project config (PEP 621)
β”œβ”€β”€ requirements.txt                   # Pinned runtime deps
β”œβ”€β”€ Dockerfile / Dockerfile-Base       # Container build
β”œβ”€β”€ README.md                          # Main documentation
β”œβ”€β”€ CHANGELOG.md                       # Version history
β”œβ”€β”€ CLI-Commands-Reference.md          # CLI documentation
└── API-Reference.md                   # API documentation

Read the full file on GitHub Β· 1,580 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen Β· 1,580 lines Β· 13,326 tokens per session scan A 0b96c60d0a04

Subscribe to this mod's changes

secure-mcp-gateway CLAUDE.md is an instructions file published in the GitHub repository enkryptai/secure-mcp-gateway (57 stars, last pushed 14d ago), licensed Apache-2.0. It adds 13,326 tokens to every session, about $0.0666 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js Β· 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex Β· 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode Β· 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode Β· 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain Β· 4,469 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart β€” add a new integration in 5 steps, integration architecture and integrationmanifest β€” file tracking.

github/spec-kit Β· 7,104 tokens