Appearance
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:
operatorfor 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_importsorbuf 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=/graphqlyaml
# 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/WatchRegenerate 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.comyaml
# 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_orderyaml
# 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
| Setting | What it does | Default | Allowed values | Applies 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. | 10 | 1 to 100 | all |
Aliases (graphql.aliases) | Aliased fields per operation. | 20 | 1 to 1000 | all |
Fields (graphql.fields) | Selected fields per operation. | 500 | 1 to 100000 | all |
Cost (graphql.cost) | Fields weighted by list sizes (first, last, limit). | 2000 | 1 to 10000000 | all |
Operations per request (graphql.batch) | Queries in one batched request. | 10 | 1 to 1000 | all |
Tokens per query (graphql.tokens) | Lexical tokens in one document. | 10000 | 1 to 1000000 | all |
Allow introspection (graphql.introspection) | Allows __schema and __type. | false | true, false | all |
The rules are api.graphql.depth, .aliases, .fields, .cost, .batch, .introspection and .syntax. Token limit violations report as api.graphql.syntax.
gRPC
| Setting | What it does | Default | Allowed values | Applies 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. | 4MiB | 1 up to the request body limit | all |
The rules are api.grpc.method, .size, .encoding and .syntax. Client-streaming and bidirectional methods are checked by method only, not by message.
WebSocket
| Setting | What it does | Default | Allowed values | Applies in |
|---|---|---|---|---|
WebSocket paths (websocket.paths) | Paths where upgrades are allowed and messages inspected. | none (messages pass uninspected) | path list | all |
Allowed origins (websocket.origins) | Origin values accepted on the upgrade. | none (any) | origins such as https://app.example.com | all |
Message size (websocket.message_size) | Bytes in one client message, reassembled. | 64KiB | 1 to 16MiB | all |
Message formats (websocket.formats) | Message types clients may send. | text | text, binary | all |
Inspect text messages (websocket.inspect_text) | Runs the signatures on each text message. | true | true, false | all |
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
| Setting | What it does | Default | Allowed values | Applies in |
|---|---|---|---|---|
MCP paths (mcp.paths) | Paths of MCP servers (JSON-RPC over HTTP POST). | none (checks off) | path list | all |
Allowed tools (mcp.tools) | Tool names agents may call. | none (any tool) | tool names | all |
Message size (mcp.message_size) | Bytes in one JSON-RPC request. | 1MiB | 1 up to the request body limit | all |
Requests per batch (mcp.batch) | JSON-RPC requests in one batch. | 10 | 1 to 1000 | all |
The rules are api.mcp.tool, .batch, .size and .syntax.
Limits
| Limit | Value |
|---|---|
| List settings (paths, methods, origins, tools) | 32 entries each |
| WebSocket message | up 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.costorgraphql.depthfor 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 setagain.