Connect AI Tools (MCP)
Point Claude Code, Claude Desktop, or any MCP client at your ObjectOS app and let agents work with your data under your permission model.
Every ObjectOS 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; the only thing left to do is connect a
client and prove it works.
To turn the surface off, set
OS_MCP_SERVER_ENABLED=false— the endpoint then returns 404 and the Setup → Connect an Agent page disappears with it.
On ObjectOS Cloud each environment has its own switch: a new environment's MCP endpoint starts on, an owner or admin can turn it off at any time, and every plan has a request limit. See On ObjectOS Cloud.
This page is about connecting external AI tools to your app. For the server-side AI stack — chat providers, embedders, RAG, and registering the MCP server plugin explicitly in code — see AI Service.
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:
# 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/mcpOn a local dev server you don't even have to type this: since 16.0 the
os devstartup banner prints the MCP endpoint, the agent-skill URL, and a ready-to-pasteclaude mcp addcommand.
For headless use (CI, containers) skip OAuth and attach an API key instead:
claude mcp add --transport http my-app https://your-deployment.example.com/api/v1/mcp \
--header "x-api-key: osk_..."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.
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 Setup → Connect an Agent (which also shows copy-paste-ready connect snippets per client), or over REST:
curl -b cookies.txt -X POST https://your-deployment.example.com/api/v1/keys
# → { "key": "osk_..." } — shown once; store it in your secret managerSend it on every request in any of three equivalent forms:
| Header | Example |
|---|---|
x-api-key | x-api-key: osk_... |
Authorization: ApiKey | Authorization: ApiKey osk_... |
Authorization: Bearer | Authorization: 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.
For a long-lived integration, bind the key to a dedicated service user with a minimal permission set — see Service accounts & API keys.
The stdio transport (16.0)
Besides HTTP, the runtime can serve MCP over stdio for hosts that spawn the server as a child process. Since 16.0 (ADR-0101) stdio has its own switch and always runs under a real identity:
OS_MCP_STDIO_ENABLED=trueturns stdio auto-start on (default off).OS_MCP_SERVER_ENABLEDnow governs only the HTTP surface — the legacy behavior whereOS_MCP_SERVER_ENABLED=truealso started stdio still works for one release, with a deprecation warning.- Stdio requires
OS_MCP_STDIO_API_KEY=osk_.... The key is resolved through the same verify + authorization chain as HTTP and REST, so object permissions, record access, field-level security, and tenant scoping apply to stdio calls exactly as on/api/v1/mcp— and the key is re-resolved per read, so revoking it takes effect immediately. - The transport is fail-closed: enabling auto-start without a
resolvable key refuses to boot, and there is deliberately no unscoped
fallback and no
systembypass. For full authority, mint the key on a platform-admin or dedicated service identity.
What the agent gets
Eleven data, action, and authoring tools, generated from your metadata:
| Tool | What it does |
|---|---|
list_objects / describe_object | Discover which objects exist and their fields |
query_records / get_record | Read data (list queries are capped at 50 rows per page by default) |
validate_expression | Lint a formula against the real object schema before saving it (16.0): errors (bare field refs, unknown fields with did-you-mean), warnings (type-soundness, date-equality pitfalls), the in-scope field/function inventory, and the inferred result type. Read-only, data:read-scoped, fail-closed on sys_* |
aggregate_records | Grouped aggregation (registered when the active driver supports it) |
create_record / update_record / delete_record | Write data |
list_actions / run_action | Discover and invoke your business actions by name |
Two exposure rules to know:
- Objects are exposed automatically — except
sys_*system objects, which are blocked fail-closed. - Actions require the author's opt-in:
ai: { exposed: true }plus anai.descriptionof at least 40 characters, and the action must be callable without a UI (scriptwith a body or registered handler, orflow).
Permission enforcement
- Every call runs as the caller. The MCP bridge resolves the same execution context as a REST request, so object permissions, record access, and field-level security apply to the agent exactly as they do to a person in the UI. 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, andactions:executescopes — 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, serves build tools only where the deployment provides them: on ObjectOS Cloud, see Build with an agent. - Action bodies run as trusted app code once invoked (the
ai.exposedgate andrequiredPermissionsare 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 default to requiring it.
Verify the connection
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:connectcommand.
On ObjectOS Cloud
Everything above applies to an ObjectOS Cloud environment once its endpoint is on. Four things differ: the switch, the limits, where the connection details live, and that an agent can build the app as drafts.
Turn on AI agent access
Exposing an environment's data to an outside AI client is the organization's decision, so each environment has its own switch, on every plan (ruled on cloud#1248). A new environment starts with it on, and an owner or admin can turn it off at any time (ruled on cloud#3628). An environment created before that keeps the switch it had, so an older environment may still be off.
The steps below are needed only for an environment whose endpoint is off: an older one, or one that was turned off.
- In the cloud console, open the environment's page and its Settings tab. Under Access and sign-in, the AI agent access (MCP) row reads Now: off.
- Choose Enable AI Agent Access and confirm. Only the organization's owners and admins are offered it.
- Give it a few seconds: the environment picks up the change on its own, with no redeploy. The row then reads Now: on, and the environment's Overview shows the same state.
Once it is on, Connect an Agent appears inside the environment's own
console, in two places that open the same page: Account → Developer, for
every signed-in user, and Setup → Integrations, for users with Manage
Platform Settings. That page shows the environment's endpoint URL — its
address followed by /api/v1/mcp — a connect card per client, the skill file,
and the API-key minter.
Connect
Interactive clients use the browser sign-in described above: the agent then acts as you, inside your own permissions, row-level security and field access. Headless clients — CI, scripts — use an API key minted on Connect an Agent in the card API keys · headless; a key acts as the person who minted it and can never be minted for someone else.
Build with an agent
An agent can also build the app: create and change its objects, fields, views, pages, dashboards, flows and actions, not only its records. Everything it builds is a draft until a person publishes it.
Ask for metadata:write. The build tools are served only to a browser
sign-in whose grant includes the metadata:write scope. The environment
advertises it beside data:read, data:write and actions:execute, so a
client that asks for the scopes an environment advertises gets it when you
sign in. If your client asks for scopes by name, add metadata:write; if you
signed in without it, reconnect. An API key never opens
the build tools. The scope opens the tools and nothing more: every call runs as
you, and needs the manage_metadata or studio.access permission in that
environment, the same as the AI Builder.
What the tools do.
| Tools | What they do |
|---|---|
get_authoring_rules, get_metadata_schema | The rules this environment builds by, and the shape of a metadata type |
list_metadata, describe_metadata, list_packages, get_package | What the environment holds now |
propose_blueprint, apply_blueprint | Design an app or a feature from a description, then stage the whole design |
create_object, add_field, modify_field, delete_field | Change objects and fields |
create_metadata, update_metadata, apply_edit | Create any type the environment builds, change one, or apply a structured edit to an existing app |
create_seed | Add sample data |
create_package | Create a package to build in |
verify_build | Check the drafts against the platform's rules and report what it refuses |
Each call names its package (packageId or targetApp); nothing carries a
working package from one call to the next. toggle_flow and test_flow are
not served here, because a flow an agent stages is a draft that does not run.
Every write is a draft, in every environment. That includes production.
No tool publishes and no tool discards. Each write's result says the change is
not live and carries a staged block naming the drafts and the address where
they are published.
A person publishes in Studio → Changes. Open the package in Studio and its
Changes view (/_console/studio/<package>/data in the environment), review
what the agent staged, and publish or discard it. An agent that tells you it
has created something has drafted it; the app shows it once it is published.
Removing or narrowing needs confirm: true. delete_field,
modify_field, apply_edit and update_metadata take a confirm argument. A
call that would remove a field, change a field's type or drop a step from a
flow stages nothing without confirm: true, and the answer names what
publishing it would lose. A change that only adds never needs it.
How much an agent can build. Build calls are MCP requests, so the request limits apply to them. Two more limits count building (Storage and Limits):
| Free | Team and above | |
|---|---|---|
| Build writes through MCP, per environment per UTC day | 200 | 2,000 |
| Unpublished drafts per environment, made any way | 500 | 500 |
Reads and verify_build do not count as writes. Past either limit the tool
call is refused with RATE_LIMIT_EXCEEDED, the count, and what resets it: the
next UTC day for writes, a publish or a discard for drafts.
Why is my flow refused? It uses something an agent cannot build here, and the refusal names which: a scheduled or time-relative flow on Free, an approval step on Free, or a kind that is built in source and published as a package.
An agent builds flows started by a record change or a button, from create, update and delete record, assignment, decision, loop and wait steps. Scheduled and time-relative flows are built on Team and above, and approval steps on Team and above (plans). Scripts, webhooks, API-triggered and screen flows, and the types script, webhook, API, job, email template, translation, theme, plugin, agent, skill and data source are built in source on any plan.
Limits
Each environment's endpoint accepts a set number of requests, shared by every agent connected to it (ruled on cloud#3203):
| Plan | Per minute | Per UTC day |
|---|---|---|
| Free | 20 | 1,000 |
| Team and above | 120 | No daily cap |
Past a limit the endpoint answers 429 with Retry-After and the code
RATE_LIMIT_EXCEEDED; the message says which limit was hit and when it
resets. What counts as a request, and the draft and authoring-write limits
beside it, are on Storage and Limits.
The switch is kept across a plan change, so a downgrade or upgrade never
turns it on or off.
Turn it off
In the same row, Disable AI Agent Access stops the environment serving the endpoint within seconds, cutting off every connected agent — browser sign-ins and API keys alike. It does not revoke anything else:
- API keys keep working for the REST API. To retire a key itself, delete it from Account → Developer → API Keys (your own) or Setup → Access Control → API Keys (everyone's, with Manage Platform Settings).
- Browser sign-ins are not revoked, but their tokens are accepted only by the MCP endpoint, so while it is off they reach nothing.
On ObjectOS Cloud: troubleshooting
| Symptom | Cause |
|---|---|
| No AI agent access (MCP) row on the environment's Settings | Only owners and admins of the organization see it |
| Connect an Agent is in neither Account → Developer nor Setup → Integrations | AI agent access is off (an older environment, or one that was turned off) — turn it on; if it was turned on a moment ago, reload |
| Connect an Agent is under Account → Developer only | You lack Manage Platform Settings in that environment; the Account entry opens the same page |
429 from the client | The environment's agents went past its limit; wait the Retry-After seconds, and look for an agent repeating the same call |
| No build tools on the connection | The sign-in did not grant metadata:write, or the client uses an API key; reconnect with the browser sign-in and grant it |
A build tool answers PERMISSION_DENIED | You lack manage_metadata and studio.access in that environment |
| The agent built something the app does not show | It is a draft; publish it in Studio → Changes |
A build tool answers RATE_LIMIT_EXCEEDED naming build writes or drafts | The day's build writes or the draft limit is used up; wait for the next UTC day, or publish or discard drafts |
Troubleshooting
| Symptom | Cause → fix |
|---|---|
404 on /api/v1/mcp | The surface is disabled — unset OS_MCP_SERVER_ENABLED (default is on) |
501 Not Implemented | The MCP plugin isn't part of this build — check your stack's plugins |
| Boot refuses with stdio enabled | Stdio is fail-closed (16.0) — set OS_MCP_STDIO_API_KEY to a resolvable osk_ key, or turn OS_MCP_STDIO_ENABLED off |
401 on every call | Anonymous or invalid credentials. Interactive clients: complete the browser login. Headless: check the osk_ key and header spelling |
403 insufficient_scope | The 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_actions | ai.exposed is not true, ai.description is shorter than 40 characters, the type isn't headless-callable (url / modal / form never appear), it targets a sys_* object, or the caller fails its requiredPermissions |
| Reads return few rows / writes denied | Working as designed — the caller's permissions and record access apply. Verify with the same user in the UI |
Where to go next
| Task | Page |
|---|---|
| Configure AI providers, embedders, and the MCP server plugin | AI Service |
| Create service users and API keys | Users & Organization |
| Understand what the agent is allowed to see | Permissions |
| REST API and key management | API Access |
| Verify a specific user's access | Managing Access |