ObjectStackObjectStack

MCP client setup — Claude, Cursor and IDEs

Point Claude Code, Claude Desktop, or any MCP client at your running app — OAuth or API key — and verify the agent can see and operate it.

Every ObjectStack deployment is already an MCP server. The runtime serves the Model Context Protocol at /api/v1/mcp — on by default, no plugin to install, no configuration step. Your objects and exposed actions become typed tools the moment you define them; this page is about the only thing left to do: connecting a client and proving it works.

To turn the surface off, set OS_MCP_SERVER_ENABLED=false — the endpoint then returns 404 to a caller with an API key or token (an anonymous caller still gets 401 first, with no OAuth metadata advertised), and the Connect an AI Assistant page disappears with it, along with both its Setup and Account navigation entries. See environment variables.

Claude Code (one command)

Interactive clients use OAuth — each deployment is its own OAuth 2.1 authorization server, so there are no admin-minted credentials to pass around. The first tool call opens a browser login and you connect as yourself.

With the ObjectStack CLI, os mcp connect runs the claude mcp add line for you. With no flags it registers your ObjectOS Cloud environment, picked as os deploy picks it, under that environment's name; --url takes a self-hosted or local server's base URL and registers it as objectstack. Claude Code is the only client it runs (--client claude-code); --print prints the endpoint and the line and runs nothing, for any other client. It stores no token: the client runs the server's own sign-in.

os mcp connect                              # your ObjectOS Cloud environment
os mcp connect --url http://localhost:3000  # a self-hosted or local server

Or type the line yourself:

# local dev server
claude mcp add --transport http my-app http://localhost:3000/api/v1/mcp

# a deployed instance
claude mcp add --transport http my-app https://your-deployment.example.com/api/v1/mcp

Then open a new Claude Code session and run /mcp — pick the server and choose Authenticate to complete the browser login. Two things to expect on this track:

  • Until that login has happened, claude mcp list / claude mcp get my-app report the server as ✘ Failed to connect. That is the health probe being answered with a 401, not a broken setup — the status flips once the session is authenticated.
  • A Claude Code session that was already running when you ran claude mcp add does not pick the server up; start a fresh one.

For headless use (CI, containers), or whenever you would rather not go through the browser login, skip OAuth and attach an API key instead — with a key the server reports ✔ Connected immediately, no login step:

claude mcp add --transport http my-app https://your-deployment.example.com/api/v1/mcp \
  --header "x-api-key: osk_..."

claude mcp add registers the server at local scope by default — visible only from the directory you ran it in. Add -s user to make it available from every project.

Claude Desktop and claude.ai

Settings → Connectors → Add custom connector, then paste the MCP URL (https://your-deployment.example.com/api/v1/mcp). The first use walks through the same browser login.

This track needs a publicly reachable HTTPS endpoint — it cannot reach localhost or an intranet address. Add custom connector is the same claude.ai connector system in both surfaces, and it connects to your deployment from Anthropic's servers, not from the machine the client is running on. Anthropic's custom-connector documentation requires the MCP server to be reachable over the public internet from Anthropic's IP ranges, and states that a server on a private corporate network, behind a VPN, or blocked by a firewall will not connect. A locally trusted TLS certificate does not make a private address reachable, and an http:// URL is refused before any of that.

For a local or intranet deployment, connect through Claude Code instead — claude mcp add runs on your own machine, so localhost and intranet addresses work there.

Codex, WorkBuddy, Doubao Work and QwenWork

These desktop assistants add a remote MCP server as a custom connector. Each one takes the same MCP URL; what differs is the menu path and how the client spells the Streamable HTTP transport. Where the client offers a browser sign-in, it is the same OAuth login as every other track. Where your client version offers none, add the request header Authorization: Bearer <API key> with a key from below.

ClientWhereWhat to enter
Codex (app)Settings → MCP servers → Add serverName objectstack, transport Streamable HTTP, URL <MCP URL>; restart, then Authenticate to sign in, and /mcp to check
WorkBuddyConnectors → Custom connector → Configure MCP (stored in ~/.workbuddy/mcp.json){ "mcpServers": { "objectstack": { "type": "streamableHttp", "url": "<MCP URL>" } } }, then click Trust on the connector — it stays inactive until trusted
Doubao Work (豆包工作)Skills · Connectors → New → New custom connectorName objectstack, transport HTTP, server URL <MCP URL>
QwenWork (千问办公)Extensions → Connectors → + Add → Paste JSON config{ "mcpServers": { "objectstack": { "type": "streamable-http", "url": "<MCP URL>" } } }

The Connect an AI Assistant page renders each of these with your deployment's URL filled in. A client task that runs in the vendor's cloud, rather than on your machine, reaches only a deployment on public HTTPS — the same constraint as claude.ai.

Any MCP client (.mcp.json)

Clients that read an mcpServers map connect the same way. With an API key:

{
  "mcpServers": {
    "objectstack": {
      "type": "http",
      "url": "https://your-deployment.example.com/api/v1/mcp",
      "headers": { "x-api-key": "osk_..." }
    }
  }
}

Headless: API keys

Mint a key from the Connect an AI Assistant page in the Console. One page, two doors — which one you have depends on your permissions:

  • Any signed-in user — open the account menu (your name at the foot of the sidebar; on a phone, the avatar at the top right) → Connect an AI Assistant. It opens the page in the Account app, whose sidebar lists it under AI Assistant. Direct link: /_console/apps/com.objectstack.account/page/connect_agent.
  • Platform admins — Setup → Overview → Connect an AI Assistant, at /_console/apps/com.objectstack.setup/page/connect_agent, reached from the Setup sidebar. The Setup app requires the setup.access permission, so this door alone is not enough for an ordinary member; the Account one needs none.

On the page, the Create key button sits at the bottom under API keys. The new key is shown once, together with a ready-to-paste x-api-key: osk_... header line and its Authorization: Bearer osk_... form — copy it before you dismiss the panel. The same page carries copy-paste connect snippets for claude.ai and Claude Desktop, Claude Code, Codex, Cursor, WorkBuddy, Doubao Work and QwenWork, and a download link for the app's SKILL.md.

Your own keys are listed (prefix only) and revoked under Account → Developer → API Keys. Platform admins get the tenant-wide list at Setup → Access Control → API Keys, which requires manage_platform_settings.

Or mint one over REST, from a signed-in session (the -b cookies.txt below). A request authenticated with an API key is refused 403 PERMISSION_DENIED:

curl -b cookies.txt -X POST https://your-deployment.example.com/api/v1/keys
# → { "success": true, "data": { "key": "osk_...", "prefix": "osk_...", "name": "API Key",
#                                "expires_at": "2027-01-12T09:30:00.000Z" } }
#   the raw key is shown once — store it in your secret manager

Key lifetime, inactivity and rotation

Personal API keys do not live forever. The policy is part of the Authentication settings (the auth namespace, group API keys), with these defaults:

RuleDefaultSetting
A key created without expires_at expires after90 daysapi_key_default_expiry_days
The furthest expires_at a new key may ask for1 year from creationapi_key_max_expiry_days
A key with no recorded use is refused after90 daysapi_key_inactivity_days (0 turns it off)
  • Creating a key. Pass { "expires_at": "<ISO date>" } to choose the expiry. A date further away than the maximum is refused with 400 API_KEY_EXPIRY_TOO_LONG, whose message names the latest date allowed; exactly the maximum is accepted. Without expires_at the key gets the default lifetime, and the response echoes the date it got.
  • Use is recorded. Each key's last_used_at is stamped when the key is used (at most once an hour) and shows on the API Keys page.
  • Keys created before the policy. A key that was created with no expiry date gets one year of grace from the moment the deployment started enforcing the policy (recorded once, as api_key_policy_started_at). The date is written onto the key's expires_at the first time it is used, so the API Keys page shows it, and the refusal after it names it. A key with no recorded use counts its inactivity from that same moment (or from its own creation, when that is later).

A key that stops working is refused with 403 and a code that says why — the message names the key's prefix, the date, and the remedy:

CodeMeaning
API_KEY_EXPIREDPast its expires_at (or past the grace of a key created with none).
API_KEY_INACTIVENo recorded use for longer than the inactivity window. The key is not revoked.
API_KEY_REVOKEDRevoked by its owner or an administrator. A key a platform administrator revoked for someone else is suspended: only a platform administrator can restore it.

The remedy is the same for all three: create a new key and replace the old one wherever it is configured — keys do not renew. To rotate without a gap, create the new key first, switch the integration over, then revoke the old one. An unknown key (a typo, a key that never existed) still gets the generic 401 UNAUTHENTICATED.

These codes reach the caller on every endpoint that accepts a key: the MCP HTTP endpoint (/api/v1/mcp) and the other endpoints the runtime serves, the REST data API (/api/v1/data/…), the settings, file-download, datasource admin and share-link routes, the marketplace install routes, and the MCP stdio transport.

Send it on every request in any of three equivalent forms:

HeaderExample
x-api-keyx-api-key: osk_...
Authorization: ApiKeyAuthorization: ApiKey osk_...
Authorization: BearerAuthorization: Bearer osk_... (recognized by the osk_ prefix)

OAuth requires TLS — plain-HTTP deployments (except localhost) fall back to API-key-only: the browser-login track is disabled rather than allowed to run insecurely.

Local stdio transport (opt-in)

Alongside the HTTP endpoint, the runtime can also speak MCP over a long-lived stdio transport — a local pipe for a client on the same host rather than a network surface. It is off by default and deliberately stricter than HTTP; turn it on at boot with two environment variables:

OS_MCP_STDIO_ENABLED=true OS_MCP_STDIO_API_KEY=osk_... os start

The HTTP surface authenticates each caller (OAuth as a person, or their own API key). A stdio pipe has no per-request identity to resolve, so it runs as a single principal you pin up front — the identity of OS_MCP_STDIO_API_KEY. That key is resolved through the same verify + authorization chain as an HTTP/REST request and re-checked on every call, so RBAC, row-level security, field-level security, and tenant isolation apply to the stdio session exactly as they would to that identity in the Console — and revoking the key stops the session on its next call.

The transport is fail-closed: a missing, unknown, revoked, expired, inactive, or owner-less key makes stdio refuse to start rather than fall back to an unscoped or system session — there is deliberately no bypass. For a full-authority local agent, mint the key on a platform-admin or dedicated service identity; for a scoped one, mint it on a user with exactly the access it should have. See environment variables for the switches and ADR-0101 for the decision.

What the agent gets

Thirteen tools, generated from your metadata, two more for files where the storage service is installed, two for governed metrics where the analytics service is installed, and one for knowledge search where the knowledge service is installed:

ToolWhat it does
list_objects / describe_objectDiscover which objects exist and their fields
validate_expressionCheck a CEL expression against an object's schema before authoring it into a formula, validation, or flow condition
query_records / get_recordRead data (list queries are capped at 50 rows per page by default); expand and related read related records in the same call
aggregate_recordsGrouped aggregation (registered when the active driver supports it)
create_record / update_record / delete_recordWrite data
delete_recordsDelete many records of one object, by a filter or an id list, at most 200 per call (an OAuth token needs both data:read and data:write)
list_actions / run_actionDiscover and invoke your business actions by name
resume_runFinish a flow action that paused on a screen, by submitting the screen's values
read_fileRead a file a record carries: its text (text files, PDF, Word .docx) or the image itself, with its size, the byte cap and a short-lived download link
create_upload_linkHand the user a single-use link that uploads a file onto a record's file field or its attachments (up to 10 files, sent together, for a multi-file field)
list_datasetsList the governed datasets (business metrics) you may query: their measures and dimensions with business labels, descriptions and synonyms, and which of the question's words each one matches exactly
query_datasetCompute a governed metric by the names list_datasets gives; the answer carries its provenance (the dataset and measures used)
search_knowledgeSearch the app's knowledge sources by meaning and answer the most relevant passages, each naming its source and, for an indexed record, that record. Only sources whose aiExposed is not false are searched, and a passage from a record the caller cannot read is dropped (registered with the data:read scope)

Each X with its latest Y: latestPer

"Each account with its latest deal" is one query_records call. latestPer names the groups and the order that picks each group's row:

{
  "objectName": "crm_opportunity",
  "where": { "stage": { "$ne": "closed_won" } },
  "latestPer": { "by": ["account"], "orderBy": [{ "field": "close_date", "order": "desc" }] }
}
  • by takes 1 to 3 fields; orderBy takes 1 to 3 keys, each asc or desc. The answer is one row per group: the group's first row in that order. A tie goes to the record id, in the direction of the last key; an empty order value ranks last.
  • The row is chosen among the rows the caller may read and the where admits: a group whose newest row is hidden from the caller answers its newest row the caller can read. Your own orderBy, fields and offset apply to the answered rows.
  • limit counts groups (capped at 50, like any list). The answer is { object, records, hasMore } with no total; when more groups exist than came back it also carries truncated: true.
  • A partition or order field the caller may not read is refused, as it is in orderBy. A computed, JSON or multi-value field, or a dotted path, is refused as a partition or order field.
  • The SQL drivers serve it (Postgres, MySQL, SQLite, and Turso on a local or embedded-replica database). Elsewhere (the in-memory driver, Turso's remote connection, MongoDB) the call is refused with INVALID_QUERY before anything is read, as it is for an object with an afterFind hook or object-scoped read middleware.

query_records takes expand: up to 3 of the object's lookup, master-detail, user or tree fields. Each one comes back as the record it names, one level deep:

{ "objectName": "crm_opportunity", "expand": ["account", "owner_id"] }

get_record takes related: up to 3 child objects that point at the record, each answered as a list of at most 20 rows (limit lowers it):

{
  "objectName": "crm_account",
  "recordId": "acc_1",
  "related": [
    { "object": "crm_opportunity", "orderBy": [{ "field": "close_date", "order": "desc" }] },
    { "object": "crm_activity", "field": "account", "limit": 5 }
  ]
}
  • The answer is then { record, related: [{ object, field, records, total, hasMore }] }. A list with more rows than came back also carries truncated: true.
  • field is the child's field that points at the record. It can be left out when the child has exactly one such field.
  • A related list is filtered only by the link to the record. It takes the child's own fields and orderBy, and no other filter.
  • Every expanded or related object is read as you, under that object's permissions, row-level security and field masking. A field you may not read is not offered for expand or as a link.
  • The record and each related list name the fields withheld from them in withheldFields, as a plain get_record and query_records do.
  • Every object a new read shape reaches is judged by the MCP read guard exactly as the object the call names. An object the guard refuses (a system object that is not opted into AI reads) refuses the whole call with PERMISSION_DENIED before anything is read. A related object that is not served to you refuses it too. An expanded field is different: when the guard admits its object but you may not read the record it names (no permission on that object, or a row it hides from you), the call is answered and the field keeps its stored id.
  • Each related list carries the delegation notice (delegationNarrowed, warning) that query_records carries when the agent ceiling narrowed the read.
  • A name that is not a relationship field, or a field that does not point at the record, is refused with INVALID_FIELD.

Governed metrics and the initialize instructions

list_datasets and query_dataset are registered with the data:read scope, and only where the analytics service is installed. Over HTTP, the server's initialize answer (result.instructions) tells the client how to choose between a governed metric and an object query, because a client reads a tool's description only after it has chosen that tool. Where both dataset tools are registered for the connection, the instructions say: look for a governed metric first by calling list_datasets with the question's business words; a word matches only when it equals a name, label or synonym; each word with exactly one measure match is answered with query_dataset, and two such words are two metrics computed both; several matches are a question for the user; a word with no match but with candidates in the answer (members offered as possible readings) is the same question, listing each candidate's label, dataset label and description, and is never treated as a match; no match and no candidates falls back to query_records / aggregate_records, saying the answer is not from a governed metric. A token without data:read gets neither tool and no such sentence.

The instructions also name the published skills package and the version to install, which is the server's own version (Published skills: @objectstack/skills <version>), with the command that installs it into your agent's skills directory, with or without a project: os skills install --version <version>, or npx -p @objectstack/cli@<version> os skills install --version <version> where the CLI is not installed. If you only connected an MCP client and have no project, run it in the directory your agent works in; it writes .claude/skills/ there (--dir names another). See Skills for updating and checking it. A deployment that sets the MCP plugin's instructions option serves that text as written instead, and the local stdio server's instructions carry neither part.

Both tools are registered only where the storage service is installed (they read and write through it), read_file with the data:read scope and create_upload_link with data:write. Neither judges access on its own: the record is read first, exactly as get_record reads it, so no access to the record means no file, refused with the same RECORD_NOT_FOUND.

  • read_file({ objectName, recordId, field?, fileId?, attachmentId? }) reads one file: the one a file field holds (field, plus fileId when the field holds several), or one attachment (attachmentId). Send neither to list the record's files with their ids. The file is then judged by the same rule as a download from the Console. The answer carries the file's name, type and size, the byte cap read_file reads (10 MiB), a download link that expires after five minutes, and the content: the text of a text file, a PDF or a Word document (cut at 100,000 characters or 200 PDF pages), or the image itself for PNG, JPEG, GIF and WebP up to 5 MiB. A larger file answers its facts and the link only; a damaged PDF or Word file answers a sentence saying so.
  • create_upload_link({ objectName, recordId, field? | attachments: true }) needs a record the caller may edit (and, for a field, a field they may write). It answers a link and its expiry (ten minutes). The user opens the link in a browser where they are signed in to this deployment, picks one file, and it lands on exactly that record and field, or as an attachment of that record. On a phone, they sign in there first. A link for a multiple: true file field takes several files in its one use: the user picks up to 10 and sends them together, every file of the send, however many, is checked (the maximum upload size, and the field's own accept and maxSize) before the link is spent, and the field gains all of them in one write, or none: one file the field cannot take, or more than 10 (400 VALIDATION_ERROR), refuses the whole send with the link still usable, and a failure after that leaves the record as it was. A single-file field link and an attachments link take one file. The link works only for the user it was made for, and only once: without a session it answers 401, and a second use, an expired link, an unknown link and another user's link all get the same 404. The upload is stored as that user, with their access checked again when the file arrives, and it meets the storage service's maximum upload size before the link is spent. A field that cannot take the upload now gets no link: a readonly field, or one whose readonlyWhen holds on this record as it stands (refused 403 FIELD_NOT_ACCESSIBLE, naming the lock in the words the engine update's strict refusal (strictReadonlyWrites) uses for it; update_record reports the same lock under droppedFields with reason readonly_when), and a record a pending approval locks (409 RECORD_LOCKED). Those are a field link's refusals: an attachments link asks only what attaching asks (the permission to create attachments and a record the caller may edit), so a record a pending approval locks still takes attachments. A field that becomes read-only, or a record that becomes locked, after the link was made refuses the upload when it arrives, attaching nothing. Sending a file's bytes through the MCP protocol itself is not supported yet.
  • A record not created yet. A record whose file field is required (an expense line and its invoice, say) cannot be created before the file exists, so create_upload_link also takes objectName and field with no recordId. That needs a user who may create records of the object and write the field, and a field that is not readonly; an attachments link still needs its record. The answer carries fileIds, the id the upload is stored under. For several files into a multi-file field, the agent sends count (up to 10): fileIds then holds that many ids, and the user must pick exactly that many. Once the user has uploaded (the page says the file was received), the agent calls create_record with the field set to fileIds[0], or the array for a multi-file field; before the upload that create is refused as an upload that never completed, as is every other write naming one of the ids. The field's own accept and maxSize are checked when the file arrives, before the link is spent. Until a record holds the file, the id works only for that user's own create_record or update_record into that field of that object, within one hour of the upload: the uploader's write into another field or object, or after the hour, is refused at the field with the reason, and another user's or a system write is refused as a file they cannot open. Within the hour, a second record naming it while the first holds it is refused too. After that it is the record's file like any other, and a file the record lets go is judged as any released file. Until a record has held the file, only the user who uploaded it can download it.

Reading a PDF or Word document's text runs on a pool of worker threads, so the server keeps answering other requests while it does. Two host settings bound it, so one caller's files cannot hold the process for everyone else (a shared deployment sets its own values):

VariableDefaultWhat it bounds
OS_MCP_READ_FILE_CPU_BUDGET_MS2000The CPU time one PDF or Word extraction may use, in milliseconds. It is checked between PDF pages and between Word paragraphs, never mid-page. When it runs out, read_file answers the text read so far with truncated: true and a note naming the budget; the rest is in the download link the answer already carries.
OS_MCP_READ_FILE_MAX_CONCURRENT4How many PDF and Word extractions may run at once in the process. One more is refused at once, never queued: SERVICE_UNAVAILABLE (503), with details.retryAfterSeconds saying how long to wait before trying again. Text files and images are not counted.

The defaults keep a self-hosted deployment reading files as before: a 9 MiB, 200-page PDF dense in drawing operators measured about 300 to 650 ms of CPU, well inside the budget. Both are read once when the server starts; a value that is not a positive whole number stops the start with a message naming the variable.

The tools are a fixed ~10-tool spine with the object name as a parameter (query_records(objectName, …)), not one tool per object — so the list stays usable on an app with hundreds of objects. Which objects and actions that spine can reach is the default exposure policy (v1):

  • Objects are exposed automatically — except sys_* system objects, which are blocked fail-closed. A system object whose author declared enable.aiReadable: true is open to the read tools only (list_objects, describe_object, query_records, get_record, aggregate_records), read as you under every gate a read already runs (your permissions, row-level security, the object's own read rules, field masking); no write tool opens it, and the stored-metadata tables stay refused. sys_approval_request declares it: every signed-in member reads the requests they take part in (submitted, waiting on them, or acted on) and no others, so an agent can list the approvals waiting on you with pending_approvers contains {current_user_id} — answered for a slot that names you by email, position or team too, not only by user id. sys_user declares it too, so an agent can fill a person field (an owner, an approver, an employee): it finds a colleague with query_records on sys_user, by email for exactly one person or by name ($contains), and gets their id. It reads exactly what your console's person picker shows you: your own row and your organization's members, never another organization's users, with the Admin field group (sign-in trail, lockout, ban reason, sign-in phone) withheld, on results and on filters. Names repeat, so where several people share one, the agent tells them apart by email. No write tool opens it.
  • Actions require the author's opt-in: ai: { exposed: true } plus an ai.description of at least 40 characters, and the action must be callable without a UI. In the open framework that means three types — script (with an inline body or a registered handler), flow (with the automation service registered), and api whose target is a same-origin path (starting with /): run_action dispatches it in-process through the action door to that target, after the door's gates. url, modal, and form have no headless dispatch here, and neither does an api action whose target is on another origin — the browser calls that origin directly, so it is not exposed. See Actions as Tools and Actions.
  • An action on a sys_* object follows the same opt-in, decided action by action: it is listed and runs only when the action itself declares ai.exposed: true, and then every gate behind the flag still runs (its requiredPermissions, the installation's action switch, its param contract, ai.requiresConfirmation, and the target's own authorization). The object being sys_* opens nothing, and no deployment switch opens an unflagged one. The stored-metadata tables (sys_metadata, sys_metadata_history) stay refused even when flagged. Each action list_actions returns carries aiExposed: true, the server's attestation of that opt-in.
  • The platform's own identity actions declare it by risk. Additive acts (inviting someone, adding a member to a team, creating or renaming a team or an organization, re-enabling an OAuth application) are exposed. Destructive lifecycle acts (banning a user, revoking a session or an API key, removing a member, deleting a team, leaving an organization) are exposed with ai.requiresConfirmation: true, so run_action runs them only once the person confirms: in the client when it supports elicitation and the connection can carry the question, and otherwise it hands each one to the person in the app, or refuses it (428) on a server with no pending-confirmation service. Acts that mint a credential or a session, change ownership or a sign-in factor, or destroy an account or an organization (impersonating a user, setting a password, creating an API key, transferring ownership, deleting an organization) declare nothing and are not listed. The full list is ADR-0011's 2026-10-30 addendum. These actions forward to identity routes that accept a signed-in session only, so an agent connected over OAuth sees them listed, but a call that reaches the identity route is refused there (401) and changes nothing.
  • An approver's decisions are exposed to the approver's agent. The four decisions on an approval request (sys_approval_request): approve, reject, reassign and send back, are exposed with ai.requiresConfirmation: true, so run_action decides only once the approver confirms: in the client when it supports elicitation and the connection can carry the question, and otherwise in the app, or the call is refused (428) on a server with no pending-confirmation service. Once confirmed, each forwards to its approvals route as the caller, and the approval service admits the same people the console's buttons admit: a current approver of the request, and, for approve, reject and reassign, the administrator who may override it. Anyone else, the submitter included, is refused and the request stays pending.
  • A submitter's recall and resubmit are exposed to the submitter's agent. Recall (withdraw a pending request, or abandon one sent back for revision) and resubmit (send a request that was sent back for revision into review again) are exposed the same way, with ai.requiresConfirmation: true, and forward to their approvals routes as the caller. The approval service admits the submitter, and for recalling a pending request the administrator who may override it; anyone else is refused and the request does not move. A caller who cannot read the request is answered 404 REQUEST_NOT_FOUND, exactly as for an id that names no request, so the refusal does not tell them the request exists; one who can read it (a pending approver, say) is answered 403 FORBIDDEN. A recalled request is closed: to send the record for approval again, the agent uses the app's own submit action. Remind, request-info and comments are not exposed.

This is the default policy, not a ceiling. A finer, metadata-declared exposure config (opt objects out, curate the exposed set, promote a few high-value actions to typed per-action tools) is the planned next step, consistent with ADR-0097's "what is exposed should itself be authorable" — tracked in #3167.

Prompts: your skills, served to the client

Tools are not the only primitive. A skill you author (*.skill.ts, defineSkill) that carries instructions is served as an MCP prompt — so a connected client can list your app's playbooks by name and pull one into the conversation, on a connection that serves the tools the skill binds (below):

export const CaseTriageSkill = defineSkill({
  name: 'case_triage',
  label: 'Case Triage',
  description: 'How this team triages an inbound support case',
  instructions: `Read the case, classify severity from the account tier and the
symptom, then propose the next action. Never close a case the customer has not
confirmed.`,
  tools: ['query_records', 'action_resolve_case'],
});
// prompts/list
{ "prompts": [ { "name": "case_triage", "title": "Case Triage",
                 "description": "How this team triages an inbound support case" } ] }
// prompts/get { "name": "case_triage" } → the instructions text, as a message

In Claude Code that surfaces as /mcp__my-app__case_triage; other clients show prompts in their own picker. Nothing to enable — the surface appears as soon as the app has a skill with instructions, and prompts/list simply returns an empty list until then.

A skill is offered only where its tools are. A skill's instructions teach the model to call the tools it binds, so prompts/list and prompts/get offer a skill only when the connection's own tool list carries every entry of its tools: a plain name by a tool of that name, a trailing wildcard (describe_*) by any listed tool it matches, and an action_<name> entry (or action_*) also by run_action. case_triage above is offered on a connection that lists query_records and run_action. A token without the actions:execute scope lists no run_action, so it is not offered case_triage, and prompts/get answers it as it answers an unknown prompt name. A skill that binds no tool is offered as before. When a prompt you expect is missing, connect with a grant that registers the skill's tools, or bind the skill only to tools its intended connections serve.

A skill written for the in-product agents opts out. The binding answers whether a connection can run a playbook, not whether the playbook is written for MCP: a skill can bind tools MCP serves under the same names (create_record, action_* through run_action) and still tell the model to call in-product tools or wait for the in-product approval card. Set mcpPrompt: false on such a skill and it is never offered as a prompt: prompts/list leaves it out and prompts/get answers it as an unknown prompt name, on every connection (HTTP and stdio) and whatever its tools. (The stdio server lists its prompts once, at boot, so a skill switched to mcpPrompt: false while it runs stays listed until restart; its prompts/get answers unknown at once.) Leave the key out, or set true, and the skill is offered as above. The key changes nothing on the in-product runtime: the ask / build agents resolve, bind and activate the skill exactly as before.

export const RecordWritingSkill = defineSkill({
  name: 'record_writing',
  label: 'Record Writing',
  instructions: 'Open the record, propose the change, and wait for the user to confirm on the card.',
  tools: ['create_record', 'update_record'],
  mcpPrompt: false, // written for the in-product agents only
});

Only the instructions half projects. A skill's tools / surface / triggerConditions are bound by the in-product agent runtime (the ask / build agents, cloud / Enterprise), which is the thing that composes a tool set and decides when a skill activates. MCP has neither step: the model lives in your client, driving one flat tool list, and your AI-exposed actions are already reachable there as list_actions / run_action. So on the open framework a skill contributes its judgment (as a prompt), not its wiring — its tools are read only to decide the offer above — and the same skill file keeps its full meaning when the app runs on the cloud runtime. See AI Agents.

Two different "skills" again. These are agent skills — defineSkill metadata inside your app. The SKILL.md file at GET /api/v1/mcp/skill (below) is the authoring skill that teaches an external coding agent how to drive this MCP server. Same word, different layer.

The security model

  • Every call runs as the caller. The MCP bridge resolves the same ExecutionContext as a REST request, so RBAC, row-level security, and field-level security apply to the agent exactly as they do to a person in the Console. Schema discovery is included: describe_object, list_objects' fieldCount and the fields validate_expression puts in scope name only the fields the caller can read, the same field set GET /api/v1/meta/object/:name serves that caller. list_actions follows the same projection: an action that object door withholds from the caller (one whose param binds a field the caller cannot read, judged on the object the param names, so an object-less action too) is not listed, and a listed action's params carry no label, help text or options of such a field. Nor can the caller run it: run_action and POST /api/v1/actions/... answer it as an action that does not exist, and resume_run refuses a run it would admit as it refuses a run no flow action could have started. Sparse results or denied writes usually mean governance is working, not that the connection is broken.
  • OAuth scopes narrow the toolset. Tokens carry data:read, data:write, and actions:execute scopes — tools outside the granted scopes are not even registered for that session. API-key and session callers get the full set, still permission-checked per call. A fourth scope, metadata:write, admits the authoring tools a hosted deployment may inject (build and change the app's metadata as drafts a person publishes in the UI); it is served only to a token that carries it, never to an API key or a session, and every authoring call is still checked against the caller's own metadata permission.
  • A person can withdraw an assistant they authorized, at any time. GET /api/v1/auth/authorized-clients lists the assistants the signed-in person authorized (each row's id is the grant), and POST /api/v1/auth/authorized-clients/withdraw with { "id": "…" } revokes one: the grant and the client's refresh tokens are deleted, so the assistant's token is refused on its very next call and the assistant must be authorized again to reconnect. Only the person's own grant is withdrawn; an id that is someone else's answers 404, exactly as one that names nothing. A platform administrator does the same for a person with GET /api/v1/auth/admin/authorized-clients?userId=… and POST /api/v1/auth/admin/authorized-clients/withdraw with { "userId": "…", "id": "…" }; a request with no session is refused 401, and anyone else who is signed in is refused 403. The SDK spells them oauth.authorizedClients.list() / withdraw(id) and listForUser(userId) / withdrawForUser(userId, id).
  • A platform administrator can pause an assistant for everyone. Disabling its client (the Disable action on the OAuth applications list, or POST /api/v1/auth/admin/oauth2/toggle-disabled with { "client_id": "…", "disabled": true }) refuses every access token the client already holds on its next call (401), and the client gets no new ones: a refresh is refused invalid_client. Disabling is a pause, not an end: the grants and refresh tokens stay, so enabling the client again serves them again. To end a grant, withdraw it. A completed password reset of the account that registered a client (its owner) disables that client the same way, and only a platform administrator enables it again (What a password reset ends).
  • Action bodies run as trusted app code once invoked (the ai.exposed gate and requiredPermissions are checked at invoke time). Treat writing an action as a code-review-worthy act — that's the real security boundary.
  • An action can also declare ai.requiresConfirmation; destructive-looking actions (confirmText, danger variants) are listed with requiresConfirmation: true by default, so a client asks its human first.
  • A person confirms a declared-gated action, in the client or in the app. When the author declared ai.requiresConfirmation: true, the agent's call on run_action or resume_run runs only once the person the agent acts for confirms it. When the client supports elicitation and the connection can carry the question (a stdio connection, today), the person is asked in the client: accept runs the call once; decline, dismissal or no answer in time refuses it (ACTION_CONFIRMATION_REQUIRED, details.reason declined, cancelled or timed_out). Otherwise the tools do not run the action on the call: they hand it to the person and answer status: "pending_confirmation" with a pendingId, and the person approves or rejects it in the app. A server with no pending-confirmation service refuses the call (428 ACTION_CONFIRMATION_REQUIRED, details.reason: "no_confirmation_service"), and the person performs the action in the app. Neither tool takes confirm: a call that carries it is refused, on every action, and the agent resends without it.
  • An AI service account does not confirm an action for itself. An action declaring ai.requiresConfirmation: true refuses an AI service account's key (428 ACTION_CONFIRMATION_REQUIRED) at run_action, resume_run and REST /actions, whatever the call carries; a person runs that action.
  • delete_record needs confirm: true on every call. A record delete over MCP is destructive, so the tool refuses a call without it with run_action's refusal (428 ACTION_CONFIRMATION_REQUIRED, its details.actionName naming delete_record) and deletes nothing. A request in which the human names the record to delete, with exactly one record matching, is the human's approval of that delete: the agent sends confirm: true on that call, without asking again. When the name matches more than one record, or the request does not identify one record, the agent does not delete yet: it lists the candidates, asks the human which one, and sends confirm: true only after the answer. The flag asserts an approval, it does not obtain one. A deleted business record goes to the recycle bin, where it can be restored until the deployment's retention ends (30 days by default); a record of a platform object (sys_, cloud_, ai_), or any record on a deployment with no recycle bin, is deleted permanently. The answer names the recycle-bin entry as recycleBinEntryId; an answer without one means the delete was permanent. REST DELETE /api/v1/data/:object/:id and update_record take no confirmation.
  • delete_records takes the same gate, and its refusal is the preview. A call without confirm: true reads the selection as the caller and deletes nothing: the same 428 refusal (details.actionName naming delete_records) arrives with a preview beside it, saying how many records match, how many a confirmed call attempts and a sample of their ids, for the agent to show its human. A confirmed call deletes at most 200 records, each exactly as delete_record would: under the caller's permissions and row-level security, and through the object's delete rules (a package's locking hook, a restricted relation), which no caller bypasses, an administrator included. Records a rule refuses stay, and the answer counts them grouped by reason with their ids; when more than 200 match it says how many remain, and the next call continues. On a deployment whose read page size or row budget (OS_DATA_MAX_PAGE_SIZE, OS_DATA_QUERY_ROW_BUDGET) is under 200, one call runs at that size instead, and the answer's cap says so. A fault (a store error, a crash) is not a refusal: it stops the call, and the error names the record it stopped at and how many were already deleted. Because the preview reads ids and a count, an OAuth token is offered the tool only when it carries both data:read and data:write.

Verify the connection

Before involving a client, prove the server itself is answering — the anonymous probe below must return 401, which is the surface saying "present, needs a credential" (a WWW-Authenticate header naming the OAuth resource metadata means the browser-login track is live too). Anything else is a server-side issue; see Troubleshooting.

curl -s -o /dev/null -w "%{http_code}\n" -X POST http://localhost:3000/api/v1/mcp \
  -H 'content-type: application/json' -d '{}'
# → 401

With an API key you can drive the whole protocol from the shell — a handshake, the tool list, and one real read:

MCP=http://localhost:3000/api/v1/mcp
KEY=osk_...
call() { curl -s -X POST "$MCP" -H "x-api-key: $KEY" \
  -H 'content-type: application/json' -H 'accept: application/json, text/event-stream' -d "$1"; }

call '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"probe","version":"0"}}}'
# → {"result":{"serverInfo":{"name":"objectstack",...},"capabilities":{"tools":{...},"prompts":{}}},...}

call '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | grep -o '"name":"[a-z_]*"'
# → the thirteen tools, list_objects … resume_run (plus read_file and create_upload_link where storage is installed,
#   list_datasets and query_dataset where the analytics service is installed,
#   and search_knowledge where the knowledge service is installed)

call '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"query_records","arguments":{"objectName":"crm_opportunity","limit":3}}}'
# → {"result":{"content":[{"type":"text","text":"{ \"object\": \"crm_opportunity\", \"records\": [ ... ], \"total\": 23, \"hasMore\": true }"}]}}

Two details that trip up a first attempt: the object argument is objectName, and its value is the object's API name as returned by list_objects (crm_opportunity, not opportunity) — a wrong name comes back as Object 'opportunity' not found.

Then, in the client, ask the agent something only the live schema can answer:

"What objects does this app have, and what fields does the main one carry?"

You should see list_objects and describe_object fire. The natural working pattern for an agent is list_objects → describe_object → query_records → run_action — if all four work, the connection is fully operational.

Agents work noticeably better with the app's skill file: download it from GET /api/v1/mcp/skill, or install the official Claude plugin (claude plugin marketplace add objectstack-ai/claude-plugin) which bundles the skill and a guided /objectstack:connect command.

Troubleshooting

SymptomCause → fix
claude mcp list says ✘ Failed to connect right after claude mcp add (OAuth track, no --header)Expected until you authenticate — open a new session, run /mcp, pick the server, Authenticate. Or attach an API key, which connects without a login step
✘ Failed to connect / ConnectionRefused on a server that used to workThe app is not running. Start it — the client reconnects on its own, no need to re-register
The server is missing from /mcp in a running sessionSessions read MCP config at start — open a new one. If it is still missing, you registered at local scope from another directory; re-add with -s user
Object 'x' not found on query_records / get_recordWrong object name — pass the API name from list_objects in objectName (crm_opportunity, not opportunity)
404 on /api/v1/mcpThe HTTP surface is disabled — unset OS_MCP_SERVER_ENABLED (default is on). A client with an API key or token sees the 404; an anonymous client, including an OAuth client before it signs in, sees a plain 401 with no resource_metadata in WWW-Authenticate
501 Not ImplementedThe MCP plugin isn't part of this build — check your stack's plugins. A client with an API key or token sees the 501; an anonymous client sees a plain 401 with no resource_metadata
mcp missing from GET /api/v1/discovery and no Connect-an-Agent card, but OS_MCP_SERVER_ENABLED is onThe same cause as the 501 above, seen from the other side: the surface is enabled but not serveable, so discovery declines to advertise a route that would 501 rather than over-promising it (declared === enforced). Load the MCP plugin — os serve / os dev do it for you; a host that embeds @objectstack/rest directly must add @objectstack/mcp itself
stdio won't start / boot fails closedOS_MCP_STDIO_ENABLED=true but OS_MCP_STDIO_API_KEY is missing, unknown, revoked, or expired — fail-closed by design (ADR-0101). Set a valid osk_ key; there is no unscoped or system fallback
401 on every callAnonymous or invalid credentials. Interactive clients: complete the browser login (the WWW-Authenticate header advertises the OAuth metadata). Headless: check the osk_ key and header spelling
403 insufficient_scopeThe OAuth token lacks the scope for that tool family (e.g. writes without data:write) — reconnect and grant the scope
An action is missing from list_actionsai.exposed is not true, ai.description is shorter than 40 characters, the type isn't headless-callable here (script with a body/handler, flow with an automation service, and api with a same-origin target are — url, modal, form, and an api action whose target is on another origin never appear), it targets sys_metadata / sys_metadata_history (refused even when flagged — use the metadata API), or the caller fails its requiredPermissions, or one of its params binds a field the caller cannot read
Reads return few rows / writes deniedWorking as designed — the caller's permissions and RLS apply. Verify with the same user in the Console

On this page