Skip to content

GraphQL, gRPC, WebSocket and MCP paths Since v0.1 ​

Each protocol is off until you name the paths (or upload a descriptor set) it applies to. Start the application in detect, read the events, then switch to block.

Before you begin ​

  • Role: operator for the application.
  • API protection is on for the application. For details, see Schema enforcement.
  • For gRPC, a descriptor set made with protoc --descriptor_set_out=FILE --include_imports or buf build -o FILE.

Check GraphQL queries ​

text
1. Open Applications > All applications > the application > Request checks > API protection.
2. On the Limits tab, in the GraphQL group, enter GraphQL paths, for example /graphql.
3. Select Preview changes, then Apply.
sh
waap api set -app shop -m "GraphQL limits" graphql.paths=/graphql
yaml
# applications[].policy.api
graphql:
  paths: ["/graphql"]

Each query is parsed and measured per operation, with fragments expanded. When a client needs more, raise graphql.cost or graphql.depth; the event names the operation and shows the query with the offending part marked. Keep introspection off in production and use a staging application for tools that need the schema.

Check gRPC calls ​

text
1. Open the API protection page, gRPC tab.
2. Under Add a descriptor set, upload the file.
3. Optionally tick the methods that may be called.
4. Select Preview changes, then Apply.
sh
waap api grpc check -f shop.protoset
waap api grpc set -app shop -f shop.protoset -m "gRPC descriptors"
waap api set -app shop -m "narrow methods" grpc.methods=/shop.v1.Orders/GetOrder,/shop.v1.Orders/Watch
waap api grpc remove -app shop -m "stop checking gRPC"
yaml
# applications[].policy.api
grpc:
  methods:
    - /shop.v1.Orders/GetOrder
    - /shop.v1.Orders/Watch

Regenerate and upload the descriptor set with every API change, or new methods are refused as unknown. Clients see refusals as PERMISSION_DENIED with the event reference in the status message.

Inspect WebSocket messages ​

text
1. Open the API protection page, Limits tab, WebSocket group.
2. Enter WebSocket paths and Allowed origins.
3. Select Preview changes, then Apply.
sh
waap api set -app chat -m "WebSocket checks" websocket.paths=/ws websocket.origins=https://chat.example.com
yaml
# applications[].policy.api
websocket:
  paths: ["/ws"]
  origins: ["https://chat.example.com"]

Inspected WebSocket paths fail closed

When inspection fails on an inspected WebSocket path, the connection closes, whatever the failure policy says.

In detect mode, message events (IDs ending in /m<n>) show what would be closed. In block mode the connection is closed, because an HTTP answer is impossible after the upgrade. Messages from the server are not inspected.

Limit the tools of an MCP server ​

text
1. Open the API protection page, Limits tab, AI agents (MCP) group.
2. Enter MCP paths and Allowed tools.
3. Select Preview changes, then Apply.
sh
waap api set -app tools -m "limit tools" mcp.paths=/mcp mcp.tools=search,get_order
yaml
# applications[].policy.api
mcp:
  paths: ["/mcp"]
  tools: [search, get_order]

Tool arguments are inspected by the signatures like any JSON body. For the console view of MCP servers, see Shadow MCP and agent discovery.

Settings reference ​

GraphQL ​

SettingWhat it doesDefaultAllowed valuesApplies in
GraphQL paths (graphql.paths)Paths where requests are GraphQL.none (checks off)exact, or a prefix ending in *all
Query depth (graphql.depth)Fields nested inside each other.101 to 100all
Aliases (graphql.aliases)Aliased fields per operation.201 to 1000all
Fields (graphql.fields)Selected fields per operation.5001 to 100000all
Cost (graphql.cost)Fields weighted by list sizes (first, last, limit).20001 to 10000000all
Operations per request (graphql.batch)Queries in one batched request.101 to 1000all
Tokens per query (graphql.tokens)Lexical tokens in one document.100001 to 1000000all
Allow introspection (graphql.introspection)Allows __schema and __type.falsetrue, falseall

The rules are api.graphql.depth, .aliases, .fields, .cost, .batch, .introspection and .syntax. Token limit violations report as api.graphql.syntax.

gRPC ​

SettingWhat it doesDefaultAllowed valuesApplies in
Allowed methods (grpc.methods)Methods that may be called.none (every method in the descriptor set)/package.Service/Method or /package.Service/*descriptor set uploaded
Message size (grpc.message_size)Bytes in one request message, after decompression.4MiB1 up to the request body limitall

The rules are api.grpc.method, .size, .encoding and .syntax. Client-streaming and bidirectional methods are checked by method only, not by message.

WebSocket ​

SettingWhat it doesDefaultAllowed valuesApplies in
WebSocket paths (websocket.paths)Paths where upgrades are allowed and messages inspected.none (messages pass uninspected)path listall
Allowed origins (websocket.origins)Origin values accepted on the upgrade.none (any)origins such as https://app.example.comall
Message size (websocket.message_size)Bytes in one client message, reassembled.64KiB1 to 16MiBall
Message formats (websocket.formats)Message types clients may send.texttext, binaryall
Inspect text messages (websocket.inspect_text)Runs the signatures on each text message.truetrue, falseall

On a path that is not listed, the upgrade is refused with 403 (api.websocket.path); from an origin that is not listed, 403 (api.websocket.origin).

MCP ​

SettingWhat it doesDefaultAllowed valuesApplies in
MCP paths (mcp.paths)Paths of MCP servers (JSON-RPC over HTTP POST).none (checks off)path listall
Allowed tools (mcp.tools)Tool names agents may call.none (any tool)tool namesall
Message size (mcp.message_size)Bytes in one JSON-RPC request.1MiB1 up to the request body limitall
Requests per batch (mcp.batch)JSON-RPC requests in one batch.101 to 1000all

The rules are api.mcp.tool, .batch, .size and .syntax.

Limits ​

LimitValue
List settings (paths, methods, origins, tools)32 entries each
WebSocket messageup to 16 MiB

Troubleshooting ​

A GraphQL client is refused with api.graphql.cost ​

  • Cause: the query asks for more list items than the cost limit allows.
  • Check: the event shows the query with the offending part marked.
  • Fix: raise graphql.cost or graphql.depth for that application.

New gRPC methods are refused as unknown ​

  • Cause: the descriptor set is older than the service.
  • Fix: rebuild the descriptor set and run waap api grpc set again.