# trigger.mcp

Publishes this pipeline as one tool of an MCP server on a route of its own, for outside agents (ChatGPT, Claude, any MCP client)

# trigger.mcp

```
trigger.mcp --route TEXT --name TEXT [--description TEXT] [--parameter TEXT] --auth none|jwt|api_key|oauth [--credential TEXT] [--role TEXT…] [--login TEXT] [--errors show|hide] → mcp
```

Publishes this pipeline as one tool of an MCP server on a route of its own, for outside agents (ChatGPT, Claude, any MCP client). Every active trigger.mcp with the same `--route` is one tool of that route's server; another route is another server. The server answers on the mcp surface, off by default — `/_mcp/ROUTE` on the project's hosts, `/mcp/{owner}/{project}/ROUTE` on the platform — and never on the project's dev MCP. `--auth` is required (`none` publishes openly) and is the app's own — a key or a token from its credentials, never a Zebflow account or session; `--auth oauth --login /auth/login` lets ChatGPT and claude.ai connectors sign people in through the app's own login page (which ends in [`auth.oauth.approve`](/nodes/auth/auth.oauth.approve.md)). Answers one key, `mcp`: `{ route, tool_name, arguments, auth }` — an argument is `input.mcp.arguments.<name>` (`$trigger.arguments.<name>` later); `auth` is the caller's verified token claims on a jwt or oauth route (`input.mcp.auth.sub`), as `webhook.auth` is. The tool result is what [`web.response.send`](/nodes/web/web.response.send.md) answers (its `--body`); a status of 400 or more is a tool error with that body, and a run that reaches no [`web.response.send`](/nodes/web/web.response.send.md) answers an empty result — the run's value is never sent. A refused credential is 401 (403 for a role the route does not admit), and 20 refusals a minute from one client answer 429.

## Flags

- `--route` (required): The server's path under the mcp surface: `--route /shop` answers at /_mcp/shop on the project's hosts. Every active trigger.mcp with this route is one tool of that one server.
- `--name` (required): The tool name agents call (letters, digits, `_`, `-`, `.`), unique on its route.
- `--description`: What the tool does and when an agent should call it — the agent reads this to decide.
- `--parameter`: One argument of the tool, repeated: name:type! plus an optional description, as on trigger.function. Example: --parameter q:string! "The words to look for."
- `--auth` (required): Who may call the server: none (open — must be written), jwt or api_key (each needs --credential), or oauth — people sign in through the app's own --login page and the client gets the app's tokens (ChatGPT, claude.ai connectors; needs a jwt_signing_key --credential). Every trigger.mcp on one route declares the same.
- `--credential`: The credential (its id) that verifies --auth: a JWT signing key, an hmac signature check (help pipeline/examples/webhook-signatures) or an API key.
- `--role`: A role allowed in, repeated (`--role editor --role admin`): one entry of the JWT `roles` claim must match. None: any authenticated caller.
- `--login`: With --auth oauth: the app's own login path on its pages, e.g. /auth/login — never a URL. A person who connects is sent there with ?oauth=<ticket>&client=<name>&redirect_host=<host>; the login pipeline ends in auth.oauth.approve.
- `--errors`: show or hide: what a failed run reveals in the tool error, overriding the project's errors switch (Settings → Addressing). Absent: the project decides.

## Examples

### A tool on a protected server

```
| trigger.mcp --route /shop --name stock_lookup --description "Current stock level for one SKU. Use before promising availability." --parameter sku:string! "The SKU to look up." --auth api_key --credential shop-mcp-key
```

Then `| sekejap.query.run --param "1={{ input.mcp.arguments.sku }}" -- "SELECT sku, on_hand FROM stock WHERE sku = $1" | web.response.send --body "{{ input.query.rows }}"`. An MCP client connects to `/_mcp/shop` on the project's host with an `X-API-Key` header, once the mcp surface is switched on.

Input:

```json
{
  "route": "/shop",
  "tool_name": "stock_lookup",
  "arguments": {
    "sku": "MUG-01"
  }
}
```

It answers:

```json
{
  "mcp": {
    "route": "/shop",
    "tool_name": "stock_lookup",
    "arguments": {
      "sku": "MUG-01"
    }
  }
}
```

## Used in

- [Let an app build inside its own project (control door)](/examples/app-control-door.md)
- [Sign in to a published MCP server (OAuth)](/examples/mcp-oauth-login.md)
