Agent guide
Porter is built to be handed to an agent. Give it the skill, connect its MCP server, or copy the prompt on any API page. The agent finds the API, checks it, and builds a private Guild draft on your machine. Publishing stays with you, unless you ask for Full throttle.
Already built integrations? See which ones need updating.Ask your agent “which of my Guild integrations need updating?”. Porter compares each one with its API today and lists what was added, removed, or changed, with the command that updates it.Install the Porter skill
One file with the whole workflow: rules, steps, script flags, outcomes, and endpoints. Copy it into your agent once, and ask for things like “add Linear to Guild”.
| Agent | Where it goes |
|---|---|
| Claude Code | ~/.claude/skills/porter-guild-integrations/SKILL.md (or .claude/skills/ in a project) |
| Cursor | .cursor/rules/porter.mdc in your project |
| Codex CLI | AGENTS.md in your project, or ~/.codex/AGENTS.md |
| Gemini CLI | GEMINI.md in your project, or ~/.gemini/GEMINI.md |
| Any other agent | Paste it into the system prompt or project instructions |
---
name: porter-guild-integrations
description: Turn a public API or MCP server into a private Guild integration draft with Porter. Use when the user wants to add, import, or connect an API, MCP server, or GraphQL endpoint to Guild (guild.ai), or asks whether Guild can take an API.
---
# Porter: carry an API into Guild
Porter (https://porter-guild.dev) searches integrations.sh, checks what Guild's importer accepts, and gives you one command that builds a **private** Guild integration draft (or, when the user asks, builds and publishes it) on this machine with the user's `guild` CLI. It supports OpenAPI, GraphQL, and MCP surfaces with API-key, no-auth, and OAuth 2.0 sign-in.
## Rules
- Publish only when the user asks for it, and then only by adding `--publish` to the script. Without it, the run stops at a private draft and the user publishes.
- Never connect a provider credential, and never ask for an API key or OAuth client secret in chat or put one on a command line.
- Never read, print, or send the Guild token. Porter never needs it.
- Read https://porter-guild.dev/v1/apply.ts before running it the first time.
## Workflow
1. **Check the machine.** `guild auth status` must say authenticated; if not, ask the user to run `guild auth login`. Node 18+ must be installed.
2. **Find the API.** MCP tool `search_apis`, or `GET https://porter-guild.dev/v1/search?q=<name>`. Each result has a `domain`, `surfaceSlug`, and `kind` (openapi, graphql, mcp).
3. **Check it.** MCP tool `resolve_api`, or `GET https://porter-guild.dev/v1/resolve?domain=<domain>&surface=<surfaceSlug>&kind=<kind>`. If `supported` is false, tell the user the `reason` and stop. If it is true, note `authScheme` (api-key, none, or oauth) and, for OAuth, the `oauth` block: install and token URL, scopes, and whether the provider registers clients itself (`registrationEndpoint`). Also read:
- `guildViolations`: what Guild would still reject after Porter's repairs. It is normally empty; if not, tell the user before building.
- `authNote`: a catch about the credential, such as App Store Connect tokens expiring after 20 minutes. Pass it on.
- `tags[].largestSchema`: the largest schema each tag carries, in characters. Porter simplifies any schema over 100,000 to an open object, so leaving that tag out keeps its types exact.
- `integrationName`: the name to build under. Keep it. It is the brand alone for an OpenAPI API (`attio`, never `attio-com` or `attio-openapi`); only MCP and GraphQL names end in `-mcp` or `-graphql` (`attio-mcp`), so they don't collide with the same brand's REST API. On a domain with several APIs (Microsoft Graph, Google Cloud), it is the surface's name, such as `microsoft-excel`. Pass `--name` only when that name is taken, the user picks one, or to keep using an integration made under an older name.
4. **Build the draft.** Save the script, read it, and run that file:
```
curl -fsSL https://porter-guild.dev/v1/apply.ts -o porter-apply.mjs
node porter-apply.mjs <domain> <surfaceSlug> [--kind=mcp|graphql]
```
In PowerShell, save it with `irm https://porter-guild.dev/v1/apply.ts -OutFile porter-apply.mjs`. Add `--dry-run` to print the `guild` commands without creating anything, or `--publish` when the user asked to publish once it builds. The MCP tool `get_apply_command` returns the exact command and a ready-made prompt. (`npx -y https://porter-guild.dev/porter.tgz …` does the same on npm 10 and older; npm 11 refuses it with `EALLOWREMOTE`.)
5. **Read the outcome.** Every run ends with one line `porter-result: {...}`:
- `built`: the draft exists. Report the integration name, what was imported, and the publish command it printed.
- `published`: only with `--publish`. The version is live in Guild. Report the integration name and version.
- `needs-subset` (exit 2): the API has over 500 operations. It lists the largest tags. Ask the user which part they need and rerun with `--tags`, `--paths`, or `--operations`; use `--all` only if they want everything.
- `needs-oauth-app` (exit 2): the provider has no self-registration, or its registration refused Guild. Tell the user where to create an OAuth app, the redirect URL (`https://app.guild.ai/api/credentials/callback`), and the scopes. When they give you the client ID, run the same command with `--client-id=<id>`. For the secret, ask them to set `PORTER_OAUTH_CLIENT_SECRET` or save it to a file for `--client-secret-file=<path>`.
- `needs-connection` (exit 2): an OAuth MCP server needs the user to sign in from the Guild dashboard (Access & setup > Credentials > Connect, or the integration's Versions > draft > Test > Connect) before Guild can read its tools. Wait until they say they are connected, then run the same command again. Porter reuses the integration.
- `failed` (exit 1): report `message`, which carries Guild's own reason when it rejects a spec or a build. A key-based MCP server that needs a key first prints the `guild integration connect` command for the user.
Running the same command again is safe. It reuses the integration and draft, skips an import of the same spec, and rebuilds. It refuses an integration that holds another API's operations; rerun with a new `--name`. A Porter server error and a Guild build killed for memory (exit 137) are already retried once, so report a failure instead of looping.
## Keep integrations current
APIs change after an integration is built. `--check` compares each integration Porter built in the user's Guild account with the same API today. It only reads: it creates, imports, and publishes nothing.
```
node porter-apply.mjs --check # every integration Porter built in the account
node porter-apply.mjs --check <integration> # one integration
```
It ends with one `porter-result: {"status":"checked", "needsYou": n, "integrations": [...]}` line, and exits 3 when `needsYou` is above 0 (0 when nothing needs the user). Each integration has a `status`; act on it like this:
| status | What to do |
| - | - |
| `current` | Nothing. |
| `drifted` | Tell the user what was `added`, `removed`, and `changed` (`counts` has the totals). If only `added` is non-empty, offer to run `update`. If anything was removed or changed, agents using those operations may break: run `update` only once the user agrees. `update` puts the new spec on a new draft and stops there. When there is no `update`, the integration took part of the API before Porter recorded which part: follow `next` and ask the user for the command it was built with. |
| `draft-ready` | The update is built and only publishing is left. Ask the user, then run `publish`. |
| `source-changed` | Most imported operations are missing from the spec Porter reads today, which usually means integrations.sh now links a different spec, not that the API changed. Never update it on your own; tell the user and ask which spec it should follow. |
| `needs-new-integration` | The API's base URL or auth changed, which Guild can't change on a published integration. Explain `reason`; `update` builds it under a new `--name` once the user agrees. |
| `unlabelled` | Imported before Porter labelled its imports. If `candidates` is set, ask which one; otherwise find the API with `search_apis`. Then run `--check <integration> --source=<domain>/<surface>`. |
| `unavailable` | Porter can't read the API right now. Report `reason` and try again later. |
| `skipped` | Nothing to compare (an MCP server, or nothing imported). Report `reason`. |
On a schedule, stay quiet when `needsYou` is 0, and otherwise send one message that lists each integration that needs the user. `--owner=<account>` checks an organization's integrations. Without a terminal, the MCP tool `check_integration_drift` (or `POST https://porter-guild.dev/v1/drift`) checks one imported spec and answers with the same statuses.
## Script flags
| Flag | Use |
| - | - |
| `--kind=openapi\|graphql\|mcp` | Surface kind; openapi is the default |
| `--name=<integration>` | Integration name, if the default is taken. No `-openapi` suffix; `-mcp` and `-graphql` only for those kinds |
| `--dry-run` | Print commands only |
| `--auth=oauth\|api-key` | Choose when both are offered; a key wins by default |
| `--client-id=<id>` | OAuth app client ID |
| `--client-secret-file=<path>` | OAuth client secret from a file (or `PORTER_OAUTH_CLIENT_SECRET`) |
| `--public-client` | OAuth app with no secret |
| `--no-register` | Skip automatic client registration |
| `--scopes=a,b` | Override OAuth scopes |
| `--token-auth=basic\|body` | How the token endpoint takes client credentials |
| `--pkce=on\|off` | Override PKCE |
| `--auth-param=key=value` | Extra authorize URL parameter, repeatable |
| `--install-url=<url>` `--token-url=<url>` | OAuth URLs from the provider's docs when Porter cannot find them |
| `--base-url=<url>` | One concrete host, instead of the `{subdomain}` or `https://{host}` placeholder filled in at connect time. For GraphQL and MCP, the full endpoint URL |
| `--tags=a,b` `--paths=/zones,/users/*` `--operations=id` | Import only part of an API; `/v1/resolve` lists its `tags` with counts |
| `--all` | Import every operation of an API with over 500 |
| `--check [<integration>]` | Read-only: which integrations their API has moved on from. `--owner=<account>`, `--source=<domain>/<surface>` |
## Porter endpoints
- MCP (streamable HTTP): `https://mcp.porter-guild.dev/mcp`. Tools: `search_apis`, `resolve_api`, `list_operations`, `get_apply_command`, `get_porter_skill`, plus catalog tools.
- `GET https://porter-guild.dev/v1/search?q=` search integrations.sh
- `GET https://porter-guild.dev/v1/resolve?domain=&surface=&kind=[&auth=oauth][&base_url=][&tags=][&paths=][&operations=]` recipe or rejection reason
- `GET https://porter-guild.dev/v1/openapi?domain=&surface=&kind=` the normalized OpenAPI document Guild imports
- `POST https://porter-guild.dev/v1/drift` with `{ spec, source?, integration? }`: an imported spec compared with the API today
- `GET https://porter-guild.dev/v1/prompt?domain=&surface=&kind=` a plain-text agent prompt
- `GET https://porter-guild.dev/v1/apply.ts` the script you save and run
- `GET https://porter-guild.dev/llms.txt` a short map of Porter for agents
Guild's own docs: https://docs.guild.ai/integrations/overview and https://docs.guild.ai/services/create-an-integration
Connect the MCP server
Porter's MCP server runs on the Porter API and lets an agent search and check APIs itself. It is read-only and needs no login: building the draft still runs on your machine through the command it returns.
https://mcp.porter-guild.dev/mcpClaude Code
claude mcp add --transport http porter https://mcp.porter-guild.dev/mcpCursor (~/.cursor/mcp.json)
{
"mcpServers": {
"porter": {
"url": "https://mcp.porter-guild.dev/mcp"
}
}
}Any other client that speaks streamable HTTP takes the same URL.
| Tool | What it does |
|---|---|
| search_apis | Search integrations.sh live for OpenAPI, GraphQL, and MCP surfaces. |
| resolve_api | Check whether Guild can take a surface, how it signs in (key, none, or OAuth), and what Guild would still reject. |
| list_operations | The operations Guild would import for an OpenAPI or GraphQL surface. |
| get_apply_command | The exact command and agent prompt that build the draft. |
| check_integration_drift | One imported spec compared with its API today, for agents without a terminal. |
| get_porter_skill | This guide as SKILL.md. |
| search_catalog, get_catalog_entry | Porter's small reviewed catalog. |
| check_guild_drift, generate_guild_commands | Drift and guild CLI plans for catalog entries. |
How a run goes
1. Find
search_apis or /v1/search returns each surface's domain, surface slug, and kind.
2. Check
resolve_api says whether Guild can take it, how it signs in, and anything Guild would still reject after Porter's repairs. Unsupported surfaces come with a reason.
3. Build
The agent saves /v1/apply.ts as porter-apply.mjs, reads it, then runs node porter-apply.mjs <domain> <surface> [--kind=…] with your logged-in guild CLI.
4. Hand back
The script stops after building the draft and prints its publish command. Publish and credential connect are yours.
Every run ends with a porter-result: JSON line, so the agent knows what to ask you for:
| Status | Meaning |
|---|---|
| built | The draft exists. The agent reports the integration, what was imported, and the publish command. |
| published | Only with --publish. The version is live in Guild. The agent reports the integration and version. |
| needs-subset | Exit 2. The API has over 500 operations. You pick the part you need; the agent reruns with --tags, --paths, or --operations. |
| needs-oauth-app | Exit 2. The provider has no self-registration: you create an OAuth app, the agent reruns with --client-id. |
| needs-connection | Exit 2. An OAuth MCP server needs your sign-in on the Guild dashboard before Guild can read its tools; then rerun. |
| failed | Exit 1. The agent reports the message, such as the failed build step. A Porter server error and a build killed for memory are already retried once. |
Check which integrations need updating
APIs change after an integration is built. node porter-apply.mjs --check compares every integration Porter built in your Guild account with the same API today, and --check <integration> checks one. It only reads. It lists the operations added, removed, and changed (parameters, request body, responses, and the schemas they use), exits 3 when something needs you, and gives each integration a status the agent acts on. Run it on a schedule and it stays quiet until an API moves.
With the Porter skill installed, you don't need to remember the flag. Ask your agent “which of my Guild integrations need updating?”, or “has the Stripe API changed since I built it?” for one.
node porter-apply.mjs --check # every integration Porter built
node porter-apply.mjs --check stripe # one integration| Status | What the agent does |
|---|---|
| current | Nothing to do. |
| drifted | Operations were added, removed, or changed. The agent lists them and, once you agree, runs the update command, which puts the new spec on a new draft. An integration that took part of the API before Porter recorded which part has no update command: you rerun the command it was built with. |
| draft-ready | The update is built; only publishing is left. The agent asks you, then publishes. |
| source-changed | Most imported operations are missing from the spec Porter reads today: integrations.sh links a different spec now. The agent asks you which one it should follow and never updates it on its own. |
| needs-new-integration | The base URL or auth changed, which Guild fixes at first publish. The update builds it under a new name. |
| unlabelled | Imported before Porter labelled its imports. The agent asks which API it is and reruns with --source. |
| unavailable, skipped | Porter can't read the API right now, or there is nothing to compare (an MCP server). |
Check every week, and hand it to a Guild agent
The check reads the spec each integration was imported from, and Guild shows that only to a logged-in guild CLI. Account API keys and Guild agents can't read it yet, so a Guild time trigger can't run the check on its own. The schedule runs where you are logged in, and a Guild agent takes over when something needs you.
1. Schedule
Once a week, cron or Task Scheduler runs porter-weekly.mjs on a machine where guild auth login was done. It downloads the latest script and runs --check.
2. Stay quiet
When nothing needs you (exit 0), it prints the porter-result line and stops.
3. Ping the agent
When something does (exit 3), it starts a chat with your Guild agent through Guild's public API, with the porter-result line as the first message.
4. Act
The agent explains what changed in each API, says which agents may break, and gives the update or publish command. Running it stays with you.
// Weekly Porter check. Run it where the guild CLI is logged in.
import { spawnSync } from "node:child_process";
import { writeFileSync } from "node:fs";
const res = await fetch("https://porter-guild.dev/v1/apply.ts");
if (!res.ok) throw new Error(`Porter answered ${res.status}`);
writeFileSync("porter-apply.mjs", await res.text());
const run = spawnSync(process.execPath, ["porter-apply.mjs", "--check"], { encoding: "utf8" });
const report = run.stdout.split("\n").find((line) => line.startsWith("porter-result:"));
if (!report) throw new Error(run.stderr || "no porter-result line");
console.log(report);
if (run.status !== 3) process.exit(run.status ?? 1); // 0: nothing needs you
// Something needs you: start a chat with your Guild agent, if one is set up.
const { GUILD_KEY_ID, GUILD_KEY_SECRET, GUILD_WORKSPACE, GUILD_AGENT } = process.env;
if (GUILD_KEY_ID && GUILD_KEY_SECRET && GUILD_WORKSPACE && GUILD_AGENT) {
const auth = Buffer.from(`${GUILD_KEY_ID}:${GUILD_KEY_SECRET}`).toString("base64");
const chat = await fetch(`https://api.guild.ai/v1/workspaces/${GUILD_WORKSPACE}/sessions`, {
method: "POST",
headers: { authorization: `Basic ${auth}`, "content-type": "application/json" },
body: JSON.stringify({ session_type: "chat", agent_id: GUILD_AGENT, initial_prompt: `Weekly Porter check:\n${report}` }),
});
console.log(`Guild agent: ${chat.status}`);
}
process.exit(3);0 9 * * 1 cd ~/porter && node porter-weekly.mjs >> porter-weekly.log 2>&1$action = New-ScheduledTaskAction -Execute "node" -Argument "porter-weekly.mjs" -WorkingDirectory "$HOME\porter"
$trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Monday -At 9am
Register-ScheduledTask -TaskName "Porter weekly check" -Action $action -Trigger $triggerTo create the agent, run guild agent init --name integration-keeper --template LLM, use the prompt below as its system prompt, then save and publish it and add it to a workspace. Then create a key it can be reached with: guild api-key create --name porter-weekly --scopes sessions:write. Put the key's id and secret, the workspace, and the agent in the environment the schedule runs in. Without them, the script only prints the report.
You keep the user's Guild integrations current. Each message starting "Weekly Porter check:" holds one porter-result line: JSON with needsYou and an integrations list.
For each integration whose status is not "current":
- Name it and its status, and say in plain words what changed in the API: the operations added, removed, and changed, with counts.
- Removed or changed operations can break agents that use them. Say so.
- drifted: quote its "update" command, or its "next" note when there is none.
- draft-ready: quote its "publish" command.
- needs-new-integration: explain "reason" and quote "update".
- source-changed: never suggest updating; ask which spec it should follow.
- unlabelled, unavailable, skipped: quote "reason".
The commands run on the user's machine with their guild CLI. You can't run them, so never say you did. Keep it to one message, with the integrations that need the user first.OAuth
Porter reads the authorize and token URLs, scopes, PKCE support, and token auth method from the spec or the provider's /.well-known metadata. If the provider registers clients itself, the script registers one for Guild's redirect URL on your machine. If not, it stops with the redirect URL, the scopes, and where to create the app; you create it, and the agent reruns with --client-id.
The client secret goes in PORTER_OAUTH_CLIENT_SECRET or a file passed with --client-secret-file. It never goes in chat or on the command line, and Porter never receives it. OAuth sign-in happens in the Guild dashboard, because the guild CLI cannot do it.
Script flags
| Flag | Use |
|---|---|
| --kind=openapi|graphql|mcp | Surface kind; openapi is the default. |
| --name=<integration> | Integration name, if the default is taken, or to keep using one made under an older name. On a domain with several APIs the default is the surface's name. The default is the brand (attio); only MCP and GraphQL names add -mcp or -graphql (attio-mcp). |
| --dry-run | Print the guild commands without creating anything. |
| --publish | Publish the version once it builds. Only when you asked: Guild then fixes the integration's name, base URL, and OAuth URLs. |
| --auth=oauth|api-key | Choose when both are offered. A key wins by default. |
| --client-id=<id> | OAuth app client ID. |
| --client-secret-file=<path> | OAuth client secret from a file, or set PORTER_OAUTH_CLIENT_SECRET. |
| --public-client | OAuth app with no secret. |
| --no-register | Skip automatic OAuth client registration. |
| --scopes=a,b | Override OAuth scopes. |
| --token-auth=basic|body | How the token endpoint takes client credentials. |
| --pkce=on|off | Override PKCE. |
| --auth-param=key=value | Extra authorize URL parameter; repeatable. |
| --install-url, --token-url | OAuth URLs from the provider's docs, when Porter cannot find them. |
| --base-url=<url> | Your own host for a self-hosted or per-customer API. For GraphQL and MCP, the full endpoint URL. |
| --tags=a,b, --paths=/a,/b/*, --operations=id | Import only part of an API. Over 500 operations, one of these or --all is required. |
| --all | Import every operation of a very large API. |
What the agent may do
- Use the guild CLI already logged in on this machine. Logging in is your step.
- Create a private draft and build it. Publish only when you asked, with --publish. Never connect a provider credential.
- Never ask for an API key or client secret in chat, and never put one on a command line.
- Leave the Guild token on this machine. Never print it, upload it, or pass it to Porter.
Endpoints
| URL | Returns |
|---|---|
| https://mcp.porter-guild.dev/mcp | MCP over streamable HTTP, served by the Porter API. |
| https://porter-guild.dev/v1/search?q= | Search integrations.sh. |
| https://porter-guild.dev/v1/resolve?domain=&surface=&kind= | Recipe or rejection reason, with guildViolations: what Guild would still reject. Add &auth=oauth to prefer OAuth. |
| https://porter-guild.dev/v1/openapi?domain=&surface=&kind= | The normalized OpenAPI document Guild imports. |
| https://porter-guild.dev/v1/prompt?domain=&surface=&kind= | A plain-text agent prompt. |
| https://porter-guild.dev/v1/apply.ts | The script that builds the draft. Save it, read it, then run it with node. |
| https://porter-guild.dev/skill.md | The skill below. |
| https://porter-guild.dev/llms.txt | A short map of Porter for agents. |