MCP Protection

An MCP route turns the gateway into an MCP server in front of the tools your agents use. Clients connect to one ByteHide URL, see only the tools you grant, and every call and result passes through a policy before it reaches the tool or comes back to the agent.

Looking for the ByteHide MCP server?

This section is about protecting your MCP servers and the ones your agents call. To connect your coding agent to ByteHide's own security tools (Code scans, dependency checks), see MCP Integration.


How MCP Protection Works

  1. You connect the MCP servers your agents need, and import their tools into the Tools inventory. You can also publish tools backed by your own endpoints.
  2. You create an MCP route and pick which tools it publishes, optionally under a different name (an alias).
  3. You attach an Agent-to-Tool policy to the route.
  4. MCP clients connect to the route URL with a credential. The gateway answers tools/list with only the granted tools, and inspects every tools/call, its arguments and its result.
  5. Every request is recorded in Incidences.

The upstream server never sees the client's credential, and the client never sees the upstream's. The gateway authenticates on each side separately.


What It Protects Against

The policy on an MCP route uses the Agent-to-Tool detectors:

ThreatDetector
Instructions hidden in tool definitions (tool poisoning)Tool Guard
Calls to tools the client should not reachRoute tool grants, Tool Permission
Malformed or out-of-schema tool callsTool Selection
Prompt injection in tool argumentsPrompt Guard
Injection hidden in tool results (second-order injection)Tool Result Guard
Secrets and PII leaving through tool argumentsSecrets Detection, PII
SQL, shell, file path, network (SSRF) and infrastructure abuseSQL, Shell, Path, Network and Infrastructure Guardians
Runaway tool loopsTool Budget / Loop

An MCP route without a policy is unprotected

Without a policy, the route still restricts which tools are published, but tool arguments and results travel exactly as they came, uninspected.


Create an MCP Route

  1. Open Routes and click Create Route.
  2. Enter a Route name and select the MCP type. The route URL is derived from the name.
  3. Under Published tools, check the tools this route serves. Filter by server with the chips above the list. Optionally set a Published as alias for each tool.
  4. Under Security, select an Agent-to-Tool policy.
  5. Under Advanced, choose the Authentication for callers, and the timeout and rate limits.
  6. Under Privacy, choose whether tool arguments and results are stored in incidences.
  7. Click Create Route.

The alias belongs to the route, not to the tool. If the upstream renames its tool, the alias you published does not move, and no MCP client has to be reconfigured.

Renaming the route changes its URL

The URL of an MCP route is derived from its name. Renaming the route changes the URL, and connected clients stop working until they are updated.


Connect an MCP Client

The route detail shows everything a client needs:

ByteHide AI Runtime MCP route with the endpoint URL and a ready-to-paste MCP client configurationClick to expand

The endpoint has this shape:

TEXT
https://gateway.bytehide.com/mcp/YOUR_ORG_ID/YOUR_ROUTE

Paste the client configuration into any MCP client with HTTP transport:

JSON
{
  "mcpServers": {
    "engineering-knowledge-tools": {
      "type": "http",
      "url": "https://gateway.bytehide.com/mcp/YOUR_ORG_ID/engineering-knowledge-tools",
      "headers": {
        "Authorization": "Bearer gwc_live_YOUR_TOKEN"
      }
    }
  }
}

Or test it with curl, starting with tools/list, the first call any MCP client makes:

Bash
curl -X POST https://gateway.bytehide.com/mcp/YOUR_ORG_ID/engineering-knowledge-tools \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "Authorization: Bearer gwc_live_YOUR_TOKEN" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'

The route speaks Streamable HTTP, POST only. A GET on the URL answers 405 on purpose: the route opens no server-to-client stream, which is what the MCP specification says to answer in that case.

Who Can Call the Route

The route detail lists the consumer credentials granted to it. Hand each third party its own consumer credential, granted only this route. The organization gateway key also reaches the route, but it reaches everything, so keep it for your own backend.

To authenticate callers with your own identity provider instead (Okta, Entra ID, Auth0), see MCP Authentication.

When a Call Is Blocked

A blocked tools/call still answers in MCP's own shape, so the client does not crash. The result text explains it, for example Blocked by ByteHide AI Gateway (prompt_injection). A call to a tool the route does not publish answers with a JSON-RPC error: unknown tool.


Next Steps

Connect an MCP Server

Register an upstream server and import its tools

MCP Authentication

Authenticate callers and reach upstreams as the right identity

MCP Incidences

Investigate tool calls

Previous
JavaScript