# AI Gateway & Security Firewall: Protect API Keys (`neon_innovation_lab/zero-trust-mcp-gateway`) Actor

In-band security gateway for AI agents and LLM tool calls. Automatically sanitizes PII, masks API credentials, and prevents prompt injection data leaks.

- **URL**: https://apify.com/neon\_innovation\_lab/zero-trust-mcp-gateway.md
- **Developed by:** [Neon Innovation Lab](https://apify.com/neon_innovation_lab) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 secured tool call with in-band dlps

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Zero-Trust MCP Gateway & In-Band DLP Compliance Engine

[![Model Context Protocol](https://img.shields.io/badge/MCP-2026_Standard-blue.svg)](https://modelcontextprotocol.io)
[![GDPR Compliant](https://img.shields.io/badge/GDPR-Article_5_Compliant-green.svg)](https://gdpr-info.eu/art-5-gdpr/)
[![EU AI Act](https://img.shields.io/badge/EU_AI_Act-Article_15_Ready-emerald.svg)](https://artificialintelligenceact.eu/)
[![OpenTelemetry](https://img.shields.io/badge/OpenTelemetry-W3C_TraceContext-orange.svg)](https://opentelemetry.io)

**Zero-Trust MCP Gateway** is an enterprise-grade reverse proxy and in-band threat firewall designed specifically for the **Model Context Protocol (MCP)**. It secures connections between AI agent runtimes (**Claude Desktop**, **Cursor IDE**, **OpenAI Swarm**, **LangGraph**, **Windsurf**) and tool execution environments.

Operating in high-throughput standby mode, the gateway enforces real-time **Data Loss Prevention (DLP)**, intercepts catastrophic shell and database commands, and generates **W3C OpenTelemetry distributed traces** without adding perceptible latency (<15ms).

***

### 🛡️ Enterprise Security & Compliance Highlights

| Enterprise Requirement | Regulatory & Technical Standard | Gateway Implementation |
| :--- | :--- | :--- |
| **Data Loss Prevention (DLP)** | **GDPR Article 5(1)(c)** & **CCPA/CPRA** | In-band redaction of SSNs, credit cards, emails, phone numbers, and cloud secrets before LLM context ingestion. |
| **Cybersecurity & Robustness** | **EU AI Act Article 15 & 50** | Fail-closed threat firewall blocking destructive SQL (`DROP`/`TRUNCATE`) and shell command execution (`rm -rf /`). |
| **Enterprise Secrets Shield** | **SOC 2 Type II (CC6.1 - Access Control)** | Automatic sanitization of AWS keys (`AKIA...`), OpenAI/Anthropic keys, GitHub tokens, and private RSA keys. |
| **Distributed Observability** | **W3C TraceContext & OpenTelemetry GenAI** | Full request tracing with standardized `traceparent` headers (`00-{traceId}-{spanId}-01`) and token attribution. |
| **Zero Prompt Retention** | **Zero-Trust Data Governance** | Pure in-memory streaming inspection; customer payloads are never persisted to disk. |

***

### 🌍 Global Enterprise & Regional Compliance (GEO Targeting)

#### 🇺🇸 North America (Silicon Valley, New York, Seattle, Austin)

- **SOC 2 Type II & HIPAA Readiness**: Pre-redacts patient identifiers and payment data before sending context to third-party frontier LLMs.
- **Cloud Credential Leak Protection**: Prevents accidental exfiltration of AWS, Azure, GCP, and Snowflake service account credentials through tool call arguments or logs.

#### 🇪🇺 Europe & 🇬🇧 United Kingdom (London, Berlin, Paris, Amsterdam)

- **EU AI Act Articles 15 & 50 Compliance**: Enforces technical documentation, resilience testing, and logging standards required for high-risk AI deployments.
- **GDPR Article 5 Data Minimization**: Guarantees personal data is scrubbed in-band so models are never fed unredacted European citizen records.

#### 🌏 Asia-Pacific & 🇮🇳 India (Singapore, Tokyo, Sydney, Bengaluru, Hyderabad)

- **Offshore Development Security**: Safeguards enterprise internal databases and staging servers accessed by remote engineering teams via Cursor or Claude.
- **Cross-Border AI Compliance**: Satisfies Singapore PDPA and Indian DPDP mandates regarding cross-border transmission of sensitive financial and personal data.

***

### 🔍 In-Band Threat Firewall & DLP Rules

#### 1. PII & High-Entropy Credential Scrubbing (Output Sanitization)

The gateway automatically inspects tool output payloads and replaces detected secrets with structured tokens:

- **Financial**: Credit Cards (Visa, Mastercard, Amex, Discover) -> `[REDACTED_CREDIT_CARD]`
- **Identity**: US Social Security Numbers (`\b\d{3}-\d{2}-\d{4}\b`) -> `[REDACTED_SSN]`
- **Communications**: Corporate & Personal Emails -> `[REDACTED_EMAIL]`, Phone Numbers -> `[REDACTED_PHONE]`
- **Cloud Secrets**: AWS Access Keys (`AKIA...`), OpenAI (`sk-...`), Anthropic (`sk-ant-...`), GitHub PATs (`ghp_...`), JWT Tokens (`eyJ...`), and RSA/EC Private Keys.

#### 2. Destructive Command Firewall (Pre-Execution Interception)

Incoming tool calls are parsed before forwarding. Any payload violating safety policies is immediately halted with an HTTP 403 / `allowed: false` response:

- **Destructive SQL**: Blocks `DROP TABLE`, `TRUNCATE TABLE`, `ALTER TABLE`, and unbounded `DELETE FROM`.
- **Dangerous Shell Commands**: Blocks `rm -rf /`, `rmdir /`, `curl | bash`, `wget | sh`, `eval()`, `exec()`.
- **Path Traversal**: Blocks access to `/etc/passwd`, `/etc/shadow`, `~/.ssh/id_rsa`, and `~/.aws/credentials`.

***

### 🚀 Quick Start & Integration

#### 1. Claude Desktop Integration (`claude_desktop_config.json`)

Add the Zero-Trust Gateway as an SSE proxy in your Claude Desktop configuration:

```json
{
  "mcpServers": {
    "neon-zero-trust-gateway": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "https://<YOUR_APIFY_CONTAINER_URL>/mcp/sse"
      ]
    }
  }
}
```

#### 2. Cursor IDE Integration

In Cursor Settings -> **Features** -> **MCP Servers**:

1. Click **+ Add New MCP Server**.
2. Name: `Zero-Trust Gateway`.
3. Type: `sse`.
4. URL: `https://<YOUR_APIFY_CONTAINER_URL>/mcp/sse`.

#### 3. Direct REST / Python LangChain Usage

```python
import httpx

GATEWAY_URL = "https://<YOUR_APIFY_CONTAINER_URL>"

## Inspect tool arguments before execution
response = httpx.post(f"{GATEWAY_URL}/v1/inspect", json={
    "tool_name": "database_query",
    "payload": "SELECT * FROM users WHERE email = 'john@example.com'"
})
print(response.json())
## Output: {"allowed": true, "severity": "NONE", "traceparent": "00-..."}

## Redact sensitive output before passing back to LLM
scrubbed = httpx.post(f"{GATEWAY_URL}/v1/redact", json={
    "payload": "Customer card is 4111111111111111 with SSN 123-45-6789"
})
print(scrubbed.json())
## Output: {"text": "Customer card is [REDACTED_CREDIT_CARD] with SSN [REDACTED_SSN]", "redactions_count": 2}
```

***

### ⚙️ Input Configuration

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `downstreamMcpUrl` | `String` | `""` | The downstream MCP server SSE endpoint or internal microservice URL to protect. |
| `enableDlp` | `Boolean` | `true` | Automatically scrub PII, credit cards, emails, and API keys before returning context to LLMs. |
| `enableFirewall` | `Boolean` | `true` | Intercept and halt destructive SQL, recursive shell deletions, and path traversals. |
| `maxPayloadSizeBytes` | `Integer` | `102400` | Buffer limit (100KB default) to prevent context-window blowup attacks. |

***

### 📊 Live Console & Enterprise Upgrades

Explore our interactive web console and live sandbox at:
**<https://neoninnovationlab.com/tools/mcp-gateway-hub>**

For dedicated high-volume cluster endpoints, custom regex DLP policies, or SLA support, visit our developer licensing hub:
**<https://neoninnovationlab.com/upgrade>**

# Actor input Schema

## `downstreamMcpUrl` (type: `string`):

The URL of the target MCP server you want to protect (e.g. https://my-server.internal/mcp/sse or an Apify standby container URL).

## `enableDlp` (type: `boolean`):

Automatically redact SSNs, credit cards, emails, phone numbers, AWS keys, OpenAI keys, and JWTs from responses before LLM ingestion.

## `enableFirewall` (type: `boolean`):

Intercept and block destructive SQL (DROP/TRUNCATE), recursive shell execution (rm -rf /), and directory traversal attempts.

## `maxPayloadSizeBytes` (type: `integer`):

Maximum payload size in bytes to prevent LLM context-window blowup and denial-of-service attacks.

## Actor input object example

```json
{
  "enableDlp": true,
  "enableFirewall": true,
  "maxPayloadSizeBytes": 102400
}
```

# Actor output Schema

## `gateway_endpoint` (type: `string`):

Connect Claude Desktop, Cursor, or your autonomous AI agent to this protected SSE URL.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("neon_innovation_lab/zero-trust-mcp-gateway").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("neon_innovation_lab/zero-trust-mcp-gateway").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call neon_innovation_lab/zero-trust-mcp-gateway --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,neon_innovation_lab/zero-trust-mcp-gateway"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/oZNpf0KFFdRbeG3yw/builds/nHmnuFaHmsRAc8stA/openapi.json
