These guides are primarily for agent readers. They explain how agents use Sails. If you are a person, start at sails.app or Add Sails.

Connect an MCP server

External MCP tools show up as bash: mcp call SERVER TOOL. Config lives in the repository database, not in git, so it is platform metadata rather than a workspace file. Transport is HTTP streamable only. There is no stdio server.

This is not a published *.mcp.sh on your site. Those are tools you expose. This page is inbound: you call someone else's server.

Done looks like

mcp list --server NAME prints lines like mcp call NAME some_tool. mcp call NAME some_tool --json '{…}' returns that tool's result. mcp show NAME prints the name, URL, visibility, and auth_type (for example oauth). The connection still works after you leave the chat.

Pick a path

The server wantsUseWho can run it
A browser login (OAuth with dynamic client registration)mcp connect (worked example A)Repository owner
An API key or Bearer token in a headersecret open, then mcp add (worked example B)Repository owner creates the secret; anyone with write access can run mcp add with it

If the provider does OAuth but does not support dynamic client registration, mcp connect cannot finish. Ask the provider for an API key and use path B.

Worked example A: OAuth server (Resend)

Job: the server wants a browser login. You are a repository owner.

mcp connect resend --url https://mcp.resend.com

https://mcp.resend.com/mcp works too. OAuth uses the canonical resource URL from the server's metadata.

Expected shape:

Open this URL to authorize MCP server `resend`:
  https://…/sails/mcp/oauth/start/mcpsess_...
Session: mcpsess_...
Then run: mcp connect poll mcpsess_...
  1. Open the URL. Finish the provider login. The provider redirects back to the MCP host, and the done (or error) page is on the Sails admin app.
  2. Back in the shell:
mcp connect poll mcpsess_...

Expected shape:

Connected MCP server `resend`. Use `mcp list --server resend` or `mcp call resend TOOL`.
mcp list --server resend
mcp call resend list-api-keys --json '{}'

Pick tool names from mcp list. Do not pass --wait from bash_exec. Output is buffered until the command ends, so you never see the URL. Print it, then run mcp connect poll SESSION_ID. This is the same rule as secret open --wait.

--timeout SECS applies to mcp connect. OAuth tokens are stored encrypted and refresh when a connection is established. If authorization expires, run mcp connect again.

Worked example B: API key header (Exa)

Job: Exa wants its key in an x-api-key header. Store the key first, bound to the MCP server's origin. See Store a secret.

The origin is the scheme and host of the --url you will register, with no path. For https://mcp.exa.ai/mcp that is https://mcp.exa.ai.

Collect the key with browser intake. The person pastes it on a sails.app page, so it never passes through chat and the agent only sees the token. Do not send them to /admin, and do not ask them to paste the key in chat. Only a repository owner can run secret open, and the intake page asks the owner to sign in.

secret open --origin https://mcp.exa.ai \
  --note 'Get it from dashboard.exa.ai' \
  --help-url https://dashboard.exa.ai/api-keys \
  exa

--note and --help-url show under the field on the intake page, so the person knows where to find the key. Expected shape:

Open this URL in your browser to submit the secret (owner only).
Do not paste the value in chat.
  https://sails.app/admin/secrets/intake/…
Label: exa
Allowed origin: https://mcp.exa.ai
Token name: ssec_exa
Intake session: INTAKE_ID

The token name is ssec_ plus the label, so you know it before the person submits. Give them the URL, then:

secret poll INTAKE_ID
Secret tokens:
  exa  ssec_exa

Do not pass --wait to secret open from bash_exec, for the same buffering reason as mcp connect --wait.

Register the server with the token, not the raw key:

mcp add exa --url https://mcp.exa.ai/mcp \
  --header "x-api-key=ssec_exa" \
  --visibility owner

Bearer style (GitHub-like servers), with the secret bound to that server's origin:

secret open --origin https://mcp.example.com github-token
secret poll INTAKE_ID
mcp add github --url https://mcp.example.com/mcp \
  --header "Authorization=Bearer ssec_github-token" \
  --visibility owner

Two servers, one intake page

When a job needs keys for more than one server, collect them on one page with --field NAME:ORIGIN:LABEL. Quote each spec, because a label with spaces otherwise fails with a usage error.

secret open \
  --field 'exa:https://mcp.exa.ai:Exa API key' \
  --note 'Get it from dashboard.exa.ai' \
  --field 'github-token:https://mcp.example.com:GitHub token'
secret poll INTAKE_ID
Secret tokens:
  exa           ssec_exa
  github-token  ssec_github-token

Each field keeps its own origin, so ssec_exa only works against https://mcp.exa.ai.

When you already hold the value

secret set is only for a value a script already has, for example a key that another API returned. Never use it to ask a person for a key. Pass --as so the token name is stable:

secret set --origin https://mcp.exa.ai --as exa "$KEY_FROM_API"
# ssec_exa

Call the server

The platform swaps in the real value only when it calls a URL on the secret's origin. If the origin does not match, the secret has no origin, or you cannot use the token, the call fails closed and the error never shows the value.

mcp reload
mcp list --server exa
mcp call exa search --json '{"query":"sails static site"}'

Pick the real tool name from mcp list. mcp help also lists --auth K=ssec_... on mcp add. The skill's examples use --header, so start there.

secret help lists --as NAME on secret set. That flag picks the token name, so pass it in scripts and the ssec_ name stays predictable.

mcp add needs write access. Default --visibility owner means only the creator can call it. Repository owners can mcp chmod and mcp remove any server but cannot call it unless they are the creator or inside the visibility scope.

Who can use the server

mcp chmod exa --visibility members
mcp chmod exa --visibility group --group writers
mcp show exa
mcp remove exa
VisibilityWho can mcp call
owner (default)Creator only
groupCreator + --group NAME
membersAny repository member

Sharing the server does not share the key. The ssec_exa in its header is a separate secret with its own visibility (owner-only by default). When you widen the server, widen the secret too, or other members' calls fail closed:

secret chmod ssec_exa --visibility members

mcp remove is allowed for the creator or a repository owner. Migrate a one-time .sails/mcp.json with mcp import ~/.sails/mcp.json (owner).

Commands

mcp help
CommandWhat it does
mcp connect NAME --url URL [--timeout SECS]Owner. Print OAuth URL; then mcp connect poll SESSION_ID
mcp connect NAME --url URL --waitBlock until authorized. Avoid inside bash_exec
mcp add NAME --url URL [--header K=V]... [--auth K=ssec_...]... [--visibility ...] [--group NAME]Register static headers with ssec_... tokens (write access)
mcp list [--server NAME]Tools you can use (mcp call SERVER TOOL lines)
mcp call SERVER TOOL [--json '{}']Invoke a tool
mcp call SERVER TOOL --json '{}' --backgroundLong job, when the server supports MCP tasks
mcp task list SERVERBackground tasks on that server
mcp task get SERVER TASK_IDOne task's status, without waiting
mcp task wait SERVER TASK_ID [--timeout SECS]Block until that task finishes
mcp reloadRe-read config from the database and reset pooled connections
mcp show NAMEConfig (redacted if you cannot use it)
mcp chmod NAME --visibility owner|group|members [--group NAME]Change who can call it
mcp remove NAMEDelete (creator or repository owner)
mcp import [PATH]One-time import from .sails/mcp.json (owner)
mcp resource list SERVER / read SERVER URI / templates SERVERRead-only resources
mcp prompt list SERVER / get SERVER NAME [--json '{}']Prompts
mcp resource list github
mcp resource read github "file://docs/README.md"
mcp prompt list github
mcp prompt get github summarize --json '{"text":"..."}'
mcp call github heavy-job --json '{}' --background
mcp task list github
mcp task get github TASK_ID
mcp task wait github TASK_ID --timeout 600

Connections are pooled per server with a 5 minute idle timeout. mcp reload resets them, which helps after you change a header or visibility.

Failure modes

What you seeWhat it meansWhat to do
mcp connect deniedOwner-onlyAn owner runs it, or use mcp add with an API key
mcp connect cannot start OAuthProvider has no dynamic client registrationGet an API key; secret open --origin ...; mcp add --header
Poll times outNobody finished the browser stepmcp connect again; new session id
secret open or secret set errors on a missing flag--origin is requiredAdd --origin https://HOST (scheme and host, no path)
Call fails closed / header emptySecret origin does not match the server URL, it has no origin, or you cannot use that ssec_...secret list to see the allowed origin; secret chmod ssec_... --origin https://HOST; secret chmod ssec_... --visibility ... if it should be shared
Teammate's call fails but yours worksServer is shared, secret is still owner-onlysecret chmod ssec_exa --visibility members (or group)
secret: usage: secret open --field 'NAME:ORIGIN:LABEL' (quote the spec if LABEL contains spaces)Unquoted --field with spaces in the labelWrap each spec in single quotes
secret: unknown flag after secret open --helpThere is no --help flagRun secret help
mcp: --url is requiredmcp add or mcp connect without a URLAdd --url https://HOST/PATH
secret open is deniedOnly repository owners create secretsAn owner runs secret open; you then run mcp add with the token
mcp list omits the serverVisibility, or config not reloadedmcp show NAME; mcp chmod; mcp reload
mcp: invalid visibility foo (use owner, group, or members)Typo in --visibilityUse one of the three values
No MCP tools discovered. Servers may be unreachable or missing authmcp list found nothing you can use, or the server did not answermcp show NAME, then mcp reload, then mcp call NAME TOOL to see the real error
mcp: access denied to MCP server NAME on mcp callA misspelled name looks the same as a server you cannot use. Only mcp show says MCP server not foundmcp show NAME to tell the two apart; mcp list for real names; mcp chmod or ask the creator if it exists but is not yours
mcp: MCP server not found: NAMEmcp show, mcp chmod, or mcp remove with a name that is not registeredmcp list for real names; mcp add if it was never added
mcp: access denied to MCP server NAME on mcp resource, mcp prompt, or mcp taskSame as mcp call: a misspelled name looks like a server you cannot usemcp show NAME to tell the two apart
mcp: --group is required when visibility is groupmcp chmod NAME --visibility group without a groupAdd --group NAME
mcp: --auth requires KEY=VALUE--auth with no pair after itPass --auth K=ssec_..., or use --header K=V
mcp: usage: mcp call SERVER TOOL [--json '{}'] [--background]mcp call with the server name only, or nothingPass both names; copy them from mcp list
mcp: No authorization support detected (could not discover OAuth authorization server metadata)mcp connect to a server that has no OAuth, or a wrong URLUse an API key: secret open --origin ..., then mcp add --header
No such toolRight server, but the tool name is wrong or the list is stalemcp reload; mcp list --server NAME and copy the exact tool name
mcp add says Added MCP server for a private address, then mcp list says No MCP tools discoveredmcp add does not check the address. The block happens at call timemcp remove NAME; add again with a public HTTPS URL
mcp: network access denied: Network access denied: private or reserved endpoint: 10.0.0.1Same outbound policy as curl, applied on mcp callPublic HTTPS URL only
mcp: database error: ... duplicate key value violates unique constraint "repository_mcp_servers_repository_id_name_key"mcp add with a name that is already registered. It does not updatemcp remove NAME, then mcp add again
mcp: MCP client error: Mcp error: -32602: Unknown tool: NAME({"availableTools":[...]})The server answered. The tool name is wrong, and the reply lists the real namesCopy a name from availableTools or mcp list --server NAME
mcp: invalid --json: expected value at line 1 column 1--json is not valid JSONPass a JSON object in single quotes, for example --json '{}'
mcp: MCP client error: Mcp error: -32601: Method not found on mcp resource or mcp promptThat server does not offer that feature, and one of the two may work while the other errorsUse mcp list for tools instead
ship update NAME --mcp deniedOwner onlyA repository owner runs it
Outside client gets 401 with no body on your own /mcpWrong, rotated, or revoked ept_ token, or wrong headership token list NAME; ship token rotate ID and resend the new token
You started a stdio processNot supportedHTTP streamable URL only
You committed the API keyWrong storeRotate the leaked key, then secret open --origin ... and put ssec_NAME in --header

Sampling and elicitation are declined (headless bash). Progress for long calls prints [mcp progress] … on stderr.

The other direction: your own MCP endpoint

The mcp command only calls servers you do not run. To let an outside client (a voice agent builder, another team's agent) call tools you wrote as *.mcp.sh, publish a mount with MCP on. That is a ship job, not an mcp add job.

You haveRunWho
A new foldership create NAME --path PATH --mcpHostname needs an owner
A mount that is already live without MCPship update NAME --mcpOwner only
A mount where MCP should be offship update NAME --no-mcpOwner only
A client that cannot do OAuth and only sends a headership token create NAME --path /mcp --name LABELOwner only

ship update --mcp keeps the hostname, policy, path, and data. Do not delete and recreate a custom-domain mount just to turn MCP on. The endpoint is the mcp_url from ship list (https://HOST/mcp, or https://HOST/prefix/mcp on a path-prefixed hostname). tools/list always shows three tools (search_tools, describe_tool, call_tool) instead of every schema, so a client finds your tool with search_tools first.

The token JSON shows the plaintext token once. A token unlocks only that one path on that one mount, also on a private (600) mount. The client sends Authorization: Bearer ept_..., or the header you set with --header. A wrong, rotated, or revoked token gets HTTP 401 with an empty body. Never paste the token in chat, and never leave it in a workspace file, because autosave commits it. Full steps and a test matrix: Publish a site and Publish, endpoint tokens.

Secrets how-to: Store a secret.