MCP and A2A
Publish selected service operations, tools, and agents through a deployment's MCP endpoint. External clients discover only the capabilities their current access permits. Connecting a downstream service does not publish it.
Start with a service operation, a tool, or an agent, then connect a client. To let your Amodal agent use someone else's MCP server, see upstream connections.
Publish all supported OpenAPI operations
To publish an entire native OpenAPI connection without listing each operation, set expose.mcp to "all" in its owner-local spec.json:
{
"baseUrl": "https://cases.example.com",
"auth": { "type": "bearer", "token": "env:CASE_SERVICE_KEY" },
"openapi": { "source": "./openapi.json" },
"expose": { "mcp": "all" }
}This publishes supported GET, HEAD, POST, PUT, PATCH, and DELETE operations in the connection's filtered catalog. Operations without a derivable output schema and those rejected by public input/output validation are omitted. Writes still require a matching endpoint policy and the caller's capability permission; publication does not grant permission to execute them. An incompatible public schema is logged per operation and does not hide compatible operations. Native OpenAPI preparation and public-schema limits still apply. Use the existing connection filter to select tags or exclude paths. The connection still needs its policy.json and configured credentials.
For example, operation ID getApplicationStatus on connection cases becomes cases_getapplicationstatus_be661d09b2d6de17_v1, with permission cases_getapplicationstatus_be661d09b2d6de17. Bulk names use a normalized prefix (up to 31 characters) followed by a stable 16-character hash of the connection and operation IDs. This keeps base names within 48 characters and distinguishes IDs that differ only in case or punctuation. Names do not depend on catalog order or other operations. Each operation uses version 1, its OpenAPI description, and derived input/output schemas. Signed callers still need each operation's permission in their grant and token; "all" does not grant caller access. Public anonymous clients can use every published operation. Confirmation requirements, field restrictions, and caller isolation remain enforced.
New matching operations become eligible when the catalog is compiled again, such as on deployment. This is an explicit opt-in to publishing future matching reads and writes too. This broadens the earlier read-only behavior of "all"; use an explicit operation map to keep a fixed read-only surface. Use the operation map for individual names, versions, permissions, output overrides, or object-ID restrictions. Switching publication modes or changing the pinned OpenAPI contract can invalidate earlier receipts; plan upgrades accordingly.
A bundled OpenAPI file lets the runtime recover saved contracts without downstream credentials after restart. With a remote source and "all", a cold runtime must successfully prepare the connection to discover its operation IDs; result retrieval then depends on that source and credential service being available. Use a bundled file or the explicit operation map when offline contract recovery is required.
Publish a connected service operation
Select operations in the connection's spec.json, alongside its existing OpenAPI source and credentials. For example, in amodal/connections/cases/spec.json (or the legacy connections/ directory):
{
"baseUrl": "https://cases.example.com",
"auth": { "type": "bearer", "token": "env:CASE_SERVICE_KEY" },
"openapi": { "source": "./openapi.json", "exposure": "discovery" },
"expose": {
"mcp": {
"getApplicationStatus": {
"name": "read_application_status",
"description": "Read the current status of an application.",
"permission": "cases.read",
"inputObjectFields": ["/path/id"],
"outputObjectFields": ["/data/id"]
}
}
}
}When using an operation map, its keys are OpenAPI operation IDs. This example assumes getApplicationStatus has a path parameter named id and returns a JSON object containing that same ID. Include a policy.json, such as {"endpoints": {}}, beside the specification. Only selected operations are published. Connecting a service, installing a package, or setting openapi.exposure does not publish its operations. openapi.exposure controls tools inside agent turns; expose.mcp controls the external contract. To publish a packaged connection, provide an owner-local spec.json.
For this example, save the following contract as openapi.json beside spec.json. The service at your configured baseUrl must implement this operation; publishing a contract does not create the downstream API.
{
"openapi": "3.1.0",
"info": { "title": "Application cases", "version": "1.0.0" },
"paths": {
"/applications/{id}": {
"get": {
"operationId": "getApplicationStatus",
"summary": "Read application status",
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
"responses": {
"200": {
"description": "Current status",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": { "id": { "type": "string" }, "status": { "type": "string" } },
"required": ["id", "status"]
}
}
}
}
}
}
}
}
}The deployment's existing /mcp endpoint can combine selected operations from several connections with published tools and agents. A connection call goes directly to the service through the normal connection executor and durable runner. It needs no LLM or model configuration.
For a signed provider identity, discover read_application_status_v1, then call it with:
{
"requestKey": "status-check-123",
"input": { "path": { "id": "application-123" } }
}For Public + Anonymous identity, omit requestKey entirely:
{ "input": { "path": { "id": "application-123" } } }Save the returned runId, then call read_application_status_v1_result with {"runId":"…"}. A completed run contains output: {"data": {"id":"application-123", "status":"pending"}}, assuming that matches the service response. The same receipt supports reconnecting, retrieving the result after a runtime restart, opening the authorized trace, and cancelling through amodal_run_cancel. A signed caller's identical requestKey and input reuse the existing run; a changed input conflicts. Anonymous submissions each create a new run.
Each durable run retains its public contract. After a restart, the runtime can restore that contract for discovery and saved-result retrieval even when the credential broker or remote OpenAPI source is unavailable. For "all" with a remote source, cold-start discovery still requires successful connection preparation as described above. Restoration requires the same deployment, selected operation's publication settings, shared connection settings, policy, and (for a bundled file) OpenAPI contents. Adding or changing another operation's publication, or changing the connection's internal agent discovery mode, preserves existing receipts. Current caller permissions and trusted identity claims still apply. New service calls always resolve credentials and check the live OpenAPI contract. Operations without a saved contract may remain unavailable during an outage and are retried on subsequent requests.
Input schemas come from the selected OpenAPI operation's path, query, and body groups. Output defaults to an object with a data field whose schema comes from the documented successful JSON responses; HEAD and 204 responses use null. For an undocumented or unsupported response schema, set output on the operation's publication entry to a closed object schema describing the entire {data: ...} result. This can also describe a result after field restrictions remove sensitive fields. The runtime validates the scrubbed output before releasing it. Published result objects are limited to 64 KiB.
name defaults to the connection name plus operation ID, normalized to lowercase underscores; version defaults to 1; permission defaults to the public name. Set a short explicit name if the generated name would exceed 48 characters. Duplicate public names at the same version are rejected. OpenAPI source changes after discovery block execution against the pinned contract; deploy contract changes with a new version. Pin a reviewed OpenAPI file in the deployment for stable contracts. Removing an entry removes discovery, invocation, and access to its saved results under that publication.
Connection access and limits
The hosted access settings apply to service operations too. The caller must have the capability's permission. inputObjectFields and outputObjectFields can contain top-level field names or JSON Pointers such as /path/id and /data/id; each referenced ID must belong to the signed caller's object grant. Public anonymous operations intentionally have no per-user object grant.
Downstream requests use the owner's configured service credential. The caller's MCP token is not forwarded as a service credential. Scope-based context injection uses string claims from the server's caller grant, and callers cannot override injected query identity. Connection endpoint restrictions, field scrubbing, and blocking preToolUse hooks still apply. Required confirmations and approval-requesting hooks park the same durable run until the caller submits an explicit decision through amodal_run_confirm. A review or never policy still blocks execution; MCP confirmation cannot override either.
Changing a signed caller's trusted claims revokes access to runs created under the previous claims, including results, traces, cancellation, and retries. Submit a new request key to start a run under the updated identity.
Connection publication supports native REST/OpenAPI GET, HEAD, POST, PUT, PATCH, and DELETE operations. Native connection filters, supported-schema limits, and JSON request/response restrictions still apply; this is not support for every OpenAPI feature or media type. SQL, generic request connections, upstream MCP passthrough, delegated service OAuth, and direct A2A publication of connections are not included. Use separately defined tools or agents for composed capabilities.
Publish writes and handle confirmation
Select a write operation in the same expose.mcp map, or use "all". For example, if the OpenAPI source declares updateApplicationStatus as PATCH /applications/{id}, with a string path parameter id, a JSON body containing status, and a documented JSON response, merge this into the connection's spec.json:
{
"expose": {
"mcp": {
"updateApplicationStatus": {
"name": "update_application_status",
"permission": "cases.write",
"inputObjectFields": ["/path/id"]
}
}
}
}Add a matching entry to policy.json:
{
"endpoints": {
"PATCH /applications/{id}": {
"returns": [],
"body": ["status"],
"confirm": true
}
}
}Signed callers need cases.write in both their grant and token scope, plus the application ID in their object grant. The ordinary native rules apply: writes without a matching policy are denied; body restricts allowed fields; thresholds can escalate the decision; confirm: true requires approval; review, never, and delegated-confirm escalation to review remain blocked. An allowed policy without a confirmation requirement can execute immediately. Public anonymous callers use the same downstream policy, with the random receipt authorizing subsequent confirmation.
- Call
update_application_status_v1with{"requestKey":"update-123","input":{"path":{"id":"application-123"},"body":{"status":"approved"}}}. Anonymous clients omitrequestKey. - Read
update_application_status_v1_resultusing itsrunId. When confirmation is required, the status isawaiting-inputandconfirmationcontainsconfirmationId,question, and apreviewwith the connection, method, concrete endpoint, and effective parameters. No downstream operation has been sent. - Show the preview to the user and obtain an explicit decision. Call
amodal_run_confirmwith{"runId":"…","confirmationId":"…","approved":true}to approve orapproved:falseto deny. Submitting an operation is not itself approval. The runtime authenticates the confirming caller; the client is responsible for obtaining the user's decision. - Read the same run's result. Approval resumes it; denial ends it as
failedwithout sending the operation. A client can disconnect or the runtime can restart while approval is pending.
Approval is bound to the persisted request preview. Permissions and hooks are checked again on resume; if a hook changes the effective request, the old approval cannot authorize it and the run fails. Confirmation accepts no argument edits. Repeating the same decision is idempotent; a conflicting decision is rejected. Only the caller owning the run (or the holder of an anonymous receipt) can confirm it. Agent _answer tools cannot approve connection operations.
Signed retries with the same request key reattach to the existing run, including after completion, rather than sending another write. Use a new key only for a deliberately new operation. Anonymous submissions always create a new run; save the receipt and retry confirmation or retrieval instead of resubmitting. Cancellation cannot roll back a request the service has already received. A timeout or failure can likewise follow a committed downstream write; inspect the service state before starting a new run. The durable runner does not automatically replay an effect whose persisted start has an unknown outcome; its existing recovery path applies.
Publish a tool
Put the public contract alongside the implementation. In amodal/tools/count_values/tool.json (or the legacy tools/ directory), the same description and parameter definitions tell the agent and external clients how to call the tool. Add an output schema and choose the protocols under expose.
{
"name": "count_values",
"description": "Count the supplied integers.",
"execution": "durable",
"triggers": [{ "kind": "invoke" }],
"confirm": false,
"parameters": {
"type": "object",
"additionalProperties": false,
"required": ["values"],
"properties": { "values": { "type": "array", "items": { "type": "integer" } } }
},
"output": {
"type": "object",
"additionalProperties": false,
"required": ["count"],
"properties": { "count": { "type": "integer" } }
},
"expose": { "protocols": ["mcp", "a2a"], "permission": "samples.count" }
}This exposes count_values_v1 to MCP and as a skill on the deployment’s A2A card. Eligible tools are read-only durable invoke tools that run without caller confirmation. The runtime also blocks ctx.store() writes from nested custom tools during a published run. Each child tool or agent needs its own declaration for direct external calls.
Published agent calls use the owner’s model configuration. A client answers a clarification on the original run ID. The runtime keeps the model, reasoning effort and thinking budget that asked the question even if the owner changes the configuration before the reply.
Publish the main agent and specialists
Add an agent.json beside the private AGENT.md of each agent you want callers to reach. For example, put this definition in agents/reviewer/agent.json.
{
"description": "Review a sample and ask which revision to use if needed.",
"output": {
"type": "object",
"additionalProperties": false,
"required": ["review"],
"properties": { "review": { "type": "string" } }
},
"expose": { "protocols": ["mcp", "a2a"], "permission": "samples.review" }
}To also publish the main agent, put its own description and protocol selection in agents/main/agent.json.
{
"description": "Answer questions about the sample.",
"expose": { "protocols": ["mcp", "a2a"] }
}Agent input defaults to {"task":"…"} and output defaults to {"text":"…"}. Set input and output on the definition for structured tasks and results. Bundle loading checks the input and output schemas for both protocols. Local $ref references retain their scope inside MCP input and result envelopes. For example, a string with "format": "date-time" must contain a valid date and time when a client calls the agent or receives its result. A delegation supports one clarifying question. Native tool approvals stay with the operator.
| Owner setting | Effect |
|---|---|
expose.protocols | Choose ["mcp"], ["a2a"], or both. Omit expose to keep a new definition private. |
expose.name, expose.version | Override the public identifier and version. They default to the target name (with hyphens converted to underscores) and version 1. The MCP tool and A2A skill IDs append _v1. |
expose.permission | Defaults to the public name. Set an explicit value to match an existing caller grant. |
expose.input, expose.output | Specify a distinct public shape if the native definition needs additional fields. Public schemas are closed JSON objects. Put field types, descriptions, bounds and required fields in the schema. |
expose.inputObjectFields, expose.outputObjectFields | List top-level fields or JSON Pointers containing object IDs that the runtime must check against the authenticated caller’s allowed IDs. |
Earlier deployments can still read amodal.json.publications. When moving an entry, remove it from that array and preserve the public name, version, target, description, permission, schemas and object-field lists so existing receipts still resolve. Duplicate public names at the same version fail validation.
Call a published agent
MCP. Connect to /mcp and list tools. For the reviewer above, call reviewer_v1 with input and, for a signed provider identity, a unique requestKey. Save the returned runId. Call reviewer_v1_result to read the result or a pending question. If the status is awaiting-input, send the returned questionId, the same runId and a text answer to reviewer_v1_answer. Poll the original run for the final output.
A2A. Discover authorized skills at /.well-known/agent-card.json. Each exposed agent has its own card and address. For these definitions the cards are /.well-known/main/agent-card.json and /.well-known/reviewer/agent-card.json, and their addresses are /a2a/main and /a2a/reviewer. An expose.name override changes the address. The root card’s contract extension includes each visible agent’s card URL. Each named endpoint starts the highest version that the caller can invoke and that still accepts new runs.
Send a nonblocking message/send to the chosen agent with a text part for a task, or a data part containing its structured input. Poll tasks/get using the returned task ID. If the state is input-required, read the question in status.message.parts. Send a new text message on the same endpoint with the original taskId and contextId. After reconnecting, the same task returns the completed artifact and metadata.traceUrl. To invoke a specific version or a durable tool, use the deployment endpoint /a2a with a data part containing skillId and input.
Connect an MCP client
- Save and deploy the owner definitions. For the service example, store
CASE_SERVICE_KEYin the deployment's credential storage and replace the examplebaseUrlwith your service URL. - Choose hosted access. For a first public test, use Public + Anonymous identity. For a signed provider identity, configure the provider and caller grant before connecting.
- Copy the deployment's canonical URL and append
/mcp, for examplehttps://your-agent.example.com/mcp. Use the preview deployment URL when testing a preview. - List tools, invoke an advertised operation, save its
runId, and poll its result tool. A successful submission is a receipt, not necessarily the final result.
Claude Code
For a public anonymous endpoint:
claude mcp add --transport http amodal https://your-agent.example.com/mcpFor a signed provider identity, set AMODAL_CALLER_TOKEN to a valid access token from the configured provider, then register the endpoint with its bearer header:
claude mcp add --transport http amodal https://your-agent.example.com/mcp --header "Authorization: Bearer $AMODAL_CALLER_TOKEN"These are alternatives; use one registration for the name amodal. In Claude Code, open /mcp to check the connection. Ask: “Use Amodal to read the status of application-123. Save the run ID and retrieve the result.” Claude receives the authorized tool descriptions and schemas through discovery. Agent-backed capabilities also advertise an answer tool for a pending clarification.
The bearer-header example uses a preissued token; update it when the token expires. Interactive OAuth depends on the selected identity provider's discovery, login, and client-registration support. Amodal advertises that provider through /.well-known/oauth-protected-resource/mcp; the runtime does not issue the provider's access tokens. The downstream service credential is configured separately and is never the caller's MCP bearer token.
TypeScript SDK from a JavaScript client
The following standalone Node client uses the official TypeScript SDK. Install the tested SDK and validators in your client directory:
npm install @modelcontextprotocol/sdk@1.32.1 ajv@8 ajv-formats@3Save this as mcp-client.mjs. It keeps output validation enabled with JSON Schema 2020-12 and standard formats, matching Amodal's public contracts.
import { Ajv2020 } from 'ajv/dist/2020.js';
import addFormats from 'ajv-formats';
import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv';
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
const [command, name, arg] = process.argv.slice(2);
const headers = process.env.AMODAL_CALLER_TOKEN ? { Authorization: 'Bearer ' + process.env.AMODAL_CALLER_TOKEN } : {};
const endpoint = new URL(process.env.AMODAL_MCP_URL);
if (command === 'trace') {
const response = await fetch(new URL(endpoint.pathname + '/runs/' + encodeURIComponent(arg) + '/trace', endpoint), {
headers,
});
console.log(JSON.stringify({ status: response.status, body: await response.json() }));
} else {
// Match the publication dialect and formats while retaining SDK output validation.
const ajv = new Ajv2020({ strict: false, allErrors: true });
addFormats(ajv);
const client = new Client(
{ name: 'amodal-publication-example', version: '1.0.0' },
{ jsonSchemaValidator: new AjvJsonSchemaValidator(ajv) },
);
try {
await client.connect(new StreamableHTTPClientTransport(endpoint, { requestInit: { headers } }));
// Cache the advertised output validators before invoking a tool.
const listing = await client.listTools();
const result = command === 'list' ? listing : await client.callTool({ name, arguments: JSON.parse(arg) });
console.log(JSON.stringify(result));
} finally {
await client.close();
}
}Set AMODAL_MCP_URL to your full endpoint. For Public + Anonymous identity, leave AMODAL_CALLER_TOKEN unset and run:
export AMODAL_MCP_URL="https://your-agent.example.com/mcp"
unset AMODAL_CALLER_TOKEN
node mcp-client.mjs list
node mcp-client.mjs call read_application_status_v1 '{"input":{"path":{"id":"application-123"}}}'For a signed provider identity, set AMODAL_CALLER_TOKEN to the provider token, then use a request key:
node mcp-client.mjs list
node mcp-client.mjs call read_application_status_v1 '{"requestKey":"status-check-123","input":{"path":{"id":"application-123"}}}'Each command starts a fresh client. Replace <run-id> below with structuredContent.runId from the submission:
node mcp-client.mjs call read_application_status_v1_result '{"runId":"<run-id>"}'
node mcp-client.mjs call amodal_run_trace '{"runId":"<run-id>"}'Repeat the result call while the run is active. A completed result has structuredContent.status: "complete" and the validated data in structuredContent.output. Inspect isError before reading structuredContent: a protocol tool error is returned in the text content. Trace access for signed callers requires runs.trace in both the grant and token scope. The same client works with team-only anonymous identity when supplied an agent-bound Amodal team session token; its submission shape still omits requestKey.
Runs, retries, and errors
MCP discovery advertises these tools when the caller has access:
| Tool | Arguments | Purpose |
|---|---|---|
<name>_v<version> | input, plus requestKey for signed provider identity | Start a run and return its receipt. Hidden when starts are disabled. |
<name>_v<version>_result | runId | Read status, final output, a pending agent question, or a connection confirmation preview. |
<name>_v<version>_answer | runId, questionId, answer | Answer an agent's one pending clarification on the original run. Not advertised for direct tools or connections. |
amodal_run_trace | runId | Read timing, span status, and available usage/cost data. Requires runs.trace. |
amodal_run_confirm | runId, confirmationId, approved (boolean) | Approve or deny the exact pending connection-operation preview on your own run. |
amodal_run_cancel | runId | Cancel an active run. Requires runs.cancel. |
Signed callers need the operation's permission for every interaction, including results. Trace and cancellation permissions must be present in both the server grant and token's space-separated scope. Anonymous callers receive those helper permissions automatically; team-only receipts additionally require the original member's session. Traces exclude messages, raw inputs, evidence bodies, and credentials; unavailable usage or cost data is null.
| MCP run status | Client action |
|---|---|
queued, running | Poll the result tool. |
awaiting-input | Use _answer for clarification. For confirmation, show the preview and send the explicit decision with amodal_run_confirm on the same run. Other native waits require the operator. |
awaiting-child | Wait for the child execution and poll again. |
scheduled, awaiting-webhook, review-pending | Wait for the native schedule, event, or operator review; poll for a state change. |
complete | Read output. |
failed | Read the error and authorized trace; inspect native execution details as an operator. |
cancelled | Stop polling. Cancellation does not undo downstream work already performed. |
A2A maps queued work to submitted, running or parked native work to working, a clarification to input-required, and terminal states to completed, failed, or canceled. Use tasks/get and tasks/cancel; a clarification answer is another message/send on the same task.
For signed MCP callers, reuse the same requestKey and identical input to reattach after a disconnect. A changed input conflicts; use a new key for new work. The key is 1–128 characters. Signed A2A submissions use messageId for duplicate protection. Anonymous submissions reject an MCP requestKey and always create a new run; losing the first receipt means that submitting again can repeat the service call. Save receipts before closing the client.
Run receipts are separate from MCP transport sessions and ordinary chat sessions. There is no MCP session-listing or chat-history tool. There are no MCP resources or prompts in this implementation: tool descriptions, input/output schemas, and result, answer, and confirmation tools describe the protocol. Use Amodal's native operator interfaces for broader session inspection. See the runtime endpoint reference.
| Error or symptom | Meaning and next step |
|---|---|
HTTP 401 / invalid_token | Check the bearer token, expiry, issuer, audience, and configured identity provider. |
HTTP 403 / access_denied | Check the subject's grant, tenant claim, and required token scopes. |
| HTTP 404 on the endpoint | Check deployment, publication definitions, and supported identity settings. |
invalid_arguments | Use the discovered schema; omit requestKey for anonymous calls. |
unknown_capability | Rediscover tools with the current identity and public name/version. |
object_access_denied | An input ID is outside the caller's allowed objects. |
run_not_found | The receipt is unknown or no longer accessible to this caller/contract. This also hides another caller's runs. |
request_key_conflict / answer_conflict / confirmation_conflict | A retry changed the input or a previously accepted answer or confirmation decision. |
confirmation_not_pending | Read the result again; the confirmation ID is stale or the run is no longer awaiting that decision. |
not_eligible_answerer | The native approval restricts who may answer; this caller is not eligible. |
starts_disabled | New work is stopped for that version; existing authorized receipts can still be read. |
usage_limit_exceeded / submission_limit | Billing or admission blocked new work. Keep receipts for accepted work. |
execution_unavailable / start_failed | Check runtime availability, credentials, and OpenAPI preparation before retrying with the same signed request key. |
run_not_cancelable / run_changed_retry | The run is terminal or changed concurrently. Read its current state before retrying cancellation. |
Admission is limited to four active runs/answers and 30 new submissions per minute per caller per worker. Anonymous callers share the deployment's anonymous principal. Direct connection calls with confirm: true or an approval-requesting hook wait for amodal_run_confirm; review, never, and blocking hooks still fail before dispatch. A write with no matching policy entry also fails.
Hosted access
Deploy the definitions and select Deploy protection and End-user identity on the agent’s Auth page.
| Hosted settings | Caller access |
|---|---|
| Public + Anonymous identity | Anyone with the URL can discover and call published operations. Each submission creates a new run. Its random receipt grants access to the result, clarification, confirmation and trace, so share it only with people who should have that access. |
| Team-only + Anonymous identity | Use an Amodal team session for this agent. The receipt also requires the original member’s session. |
| Hosted JWKS preset | Use the selected identity provider. Grant subjects their permissions and object IDs under Access → MCP and A2A access. Use the canonical /mcp or /a2a URL as the token audience, including for named A2A agents. The token must identify the organization in tenant and grant the required permissions in scope. |
Hosted billing limits apply when a caller starts a new run or answers a pending clarification. Callers who retain access can still discover operations, retrieve results and open traces when the limit is reached.
Other end-user identity strategies currently leave inbound publication disabled.
Caller grants
For a signed provider identity, configure the agent's JWKS preset, then use Access → MCP and A2A access as an administrator with members.manage. Match subject to the token's sub; scopeId is the account scope assigned by the owner. For the service example, the access object can be:
{
"callers": [
{
"subject": "external-reviewer",
"scopeId": "customer-123",
"permissions": ["cases.read", "runs.trace", "runs.cancel"],
"objects": ["application-123"],
"claims": { "account": "customer-123" }
}
],
"disabledStarts": [],
"observeDeployments": []
}The provider must issue an ES256 or RS256 JWT with iss, sub, exp, aud equal to the canonical endpoint URL, tenant equal to the Amodal organization ID, and scope containing the requested permissions. For this grant, sub is external-reviewer and scope can be cases.read runs.trace runs.cancel. Use /a2a as the audience for every A2A address, including named agents. Caller claims are trusted values from the saved grant, not client-supplied MCP arguments; direct service context injection uses their string values.
For advanced settings, GET and PUT /api/orgs/{orgId}/agents/{agentId}/publication-access with an authorized Amodal user session. GET returns revision, issuer, jwksUrl, resetRequired, and access. PUT replaces the access object and requires the last-read revision, issuer, and jwksUrl alongside access. A stale revision returns 409; reload and reconcile before saving. If the provider changes, clear the old grants before granting access under the new provider. These are platform management calls, not calls using the external MCP token.
Preview, drain, and upgrade
- The default access-management target is
production; production grants follow promotion of the active deployment. To manage an isolated preview, add?target={deployId}to both GET and PUT. Previews require their own grants and tokens for their canonical URLs. - To drain a version for signed callers, put its versioned public name, such as
read_application_status_v1, indisabledStarts. Its start tool disappears from discovery. Result, trace, cancellation, and identical accepted-request retries remain available under existing permissions. Remove the entry to reopen starts. This grant setting does not apply to anonymous publication. - Removing a subject or permission revokes the corresponding access on the next request. Removing allowed object IDs fences runs whose configured input/output ID checks need them. Changing trusted identity claims fences prior agent and connection runs. Removing a publication or changing its contract also prevents old receipts from resolving through that contract.
- For signed callers,
observeDeploymentscan allow reading specified prior deployments belonging to the same agent. The tenant, environment, issuer, caller/account identity, and exact public contract must still match. Prior-deployment runs are read-only: the new deployment cannot answer, confirm, or cancel them. - Keep the old contract published with starts disabled while its receipts are needed. A version bump alone does not preserve access to the previous version. Each definition's
exposeentry (and each connection operation's map entry) represents one version; do not overwrite it and assume historical contracts stay discoverable. Legacypublicationscan retain a full old declaration for observation. For connection operations, preserve the original definition and pinned source for receipt compatibility, or drain outstanding work before replacing them.
Connect to an upstream MCP server
Define an MCP connection in amodal/connections/<name>/spec.json:
{
"protocol": "mcp",
"transport": "http",
"url": "https://tools.example.com/mcp",
"auth": {
"type": "bearer",
"token": "env:TOOLS_TOKEN"
}
}Set TOOLS_TOKEN to the token alone; bearer authentication adds the Bearer prefix. This is the format generated by Studio's static bearer option and amodal connections add tools --mcp <url> --auth bearer.
An explicit header such as "headers": {"Authorization": "env:TOOLS_AUTHORIZATION"} also works. In that form, set TOOLS_AUTHORIZATION to the complete header value, including Bearer if required. Header references replace the whole value without adding a prefix.
For OAuth over http or sse, declare "auth": {"type": "oauth2"} and follow OAuth connections. Studio and CLI MCP creation default to OAuth, and Studio ships presets for common remote servers.
MCP connections need no baseUrl, format, or policy.json. The model receives the server's own tool descriptions and schemas. Connection policies, field restrictions, and surface.md do not apply to MCP calls.
Servers can also be defined under mcp.servers in amodal.json with the same command, args, env, url, and headers fields; transport is required there. A connection with the same name takes precedence.
Transports
| Transport | Fields | Requirement |
|---|---|---|
stdio | command, args, env | The default when transport is omitted. The runtime environment must contain the executable and its dependencies. |
sse | url, optional headers | An accessible MCP server using SSE transport. |
http | url, optional headers | An accessible MCP server using Streamable HTTP. |
Credential-like env and headers entries, such as names ending in token, key, secret, or password, must be env:NAME references. A scope:KEY reference passes validation but is not resolved for MCP servers, so the server receives the literal string:
{
"protocol": "mcp",
"transport": "stdio",
"command": "node",
"args": ["/opt/tools/server.mjs"],
"env": { "SERVICE_TOKEN": "env:SERVICE_TOKEN" }
}Tool Discovery
Tools are named <server>__<tool>, using the connection directory name or the mcp.servers key:
internal-tools__lookup_ticket
internal-tools__add_commentA named root agent must declare the server in its mcp list:
{
"mcp": ["internal-tools"]
}Use mcp for MCP servers, including servers defined as connections. Use connections for REST connections. In schema version 2, chat uses the mcp declarations in agents/main/agent.json. A delegated specialist declares individual inherited MCP tool names in tools.
Tools are discovered when the server connects. A server that fails to connect is logged and skipped, and the agent starts without its tools. Test connection in Studio lists a connected server's tools.