Karyo
Documentation/ More documentation

Live agent proof - Claude Code on the Karyo MCP endpoint

Karyo 2.1.1rendered at build time
On this page

Release evidence for the outside-agent endpoint. Claude Code 2.1.301 was proved live once, on a disposable local stack. Nothing on Atlas or the public demo was touched, and Grok Bot and OpenAI dots were not tried.

What was verified

Date 2026-10-15 (UTC; 2026-10-16 in IST)
Code branch fm/karyo-agent-a3-live-proof on top of commit b6f0fc4e2e2494462fa164c879491e48e627325a (main). The defect fixes listed below are in the same change as this record
Agent Claude Code 2.1.301 (claude --mcp-config with one http server at https://localhost:18443/mcp, --strict-mcp-config)
Agent client id https://claude.ai/oauth/claude-code-client-metadata (a client ID metadata document, no dynamic registration)
Identity provider the managed Keycloak 26.8.0 container of the prod-profile Compose stack, karyo-realm-prod.json imported on a fresh database, features resource-indicators,cimd
Stack scripts/deploy-server.sh --quick --reset-db with COMPOSE_PROJECT_NAME=karyo-a3proof NGINX_HTTP_PORT=18088, fresh volumes, demo data seeded by the setup account. A local Caddy with tls internal in front gave the HTTPS origin https://localhost:18443; the application refuses an HTTP issuer outside loopback
Agent access off at the start. The installation switch karyo.agent.enabled was turned on by an Administrator, and the per-person switch by the same Administrator on the Users page. The seed data and the default install were not changed
People a3-admin (Administrator, Company), a3-manager (Manager, Company), a3-receiver (Receiver, Facility Hillcrest DC, id 1000001)
Result steps 1, 3, 4 and 5 of the proof script passed live. Step 2 showed Karyo refusing the pick read and the agent then reading the open delivery orders; a pick-list answer was not demonstrated live

Claude Code trusted the local Caddy authority through NODE_EXTRA_CA_CERTS. It ran on a model subscription outside Karyo: Karyo calls no model.

The five steps

The transcript lines are verbatim from the Claude Code session, saved in session-transcript.txt. Times are UTC from the Karyo tables.

1. Connect and sign in as a demo receiver. Claude Code listed the server as "needs authentication". The browser sign-in as a3-receiver ended on Keycloak's consent page, which named the client and the two Karyo scopes:

The Keycloak consent page for Claude Code listing read and prepare access for Karyo

After consent Claude Code reported "Got new credentials, but karyo rejected them on reconnect", because the first call of a new client records a pending access row and Karyo refuses it until an Administrator approves. After the Administrator enabled the row, /mcp Re-authenticate ended with "Authentication successful. Reconnected to karyo." Claude Code negotiated protocol version 2026-07-28 and offered the Karyo tools to the model.

2. Ask "what is open to pick in Hillcrest DC". The Receiver holds no fulfillment.read, so Karyo refused listPickOrders, and the agent said so and fell back to what the person may read:

I can't tell you what is open to pick in Hillcrest DC, because your Karyo account lacks the permission that the pick order list needs. Karyo rejected the call with this message: "The fulfillment.read action is required for this tool."

  1. listOpenOrders for Hillcrest DC returned 3 open delivery orders. These are customer orders, not pick orders ... - DEMO-XD-DO-00001 for Frontier Logistics ...

This step shows grants being enforced, not a pick list. No existing demo principal holds fulfillment.read, and none was created for this proof, so no live answer to the pick question was obtained. The refusal named the action in the proof build. That naming was removed afterwards, so the shipped refusal reads the generic text "The mirrored REST action is required".

The agent mapped the Facility name to its id with whoami, which names each Facility the person may use (a fix made during this proof, see below).

3. Ask it to receive 5 units, follow the approval link and approve. The agent called searchProducts, getStockForProduct, prepareReceiveStock and getProposalStatus, and replied:

I prepared the receipt, and it is waiting for your approval. Nothing changes in Karyo until you approve it. Approval link: https://localhost:18443/approvals/9e7177f5-4249-4ea3-8ef6-c3376481f13c

Claude Code did not take part in Karyo's URL elicitation (see "What was not exercised"), so the agent carried the link in its reply. The Receiver opened the link in the console, read the change and pressed Approve:

The Approvals page showing a Receive stock change from the agent, waiting for the Receiver, with Approve and Decline

The same change after approval: state Approved, with the stock unit, unit load and location it produced

4. Check that the journal row names the user and the agent client. One new row in karyo.inventory_journals (journal-rows.txt):

Column Value
id 3083
activity_code AGENT
operator_name a3-receiver
actor_type PRINCIPAL
actor_principal_id ff72774e-e8e6-40d3-ae09-4f0fb234b461 (the Receiver)
actor_client_id https://claude.ai/oauth/claude-code-client-metadata
facility_id, amount, stock_unit_id 1000001, 5.0000, 72
created 2026-10-15 21:13:48 UTC

karyo.agent_tool_calls recorded the eight calls with their outcome: whoami, listPickOrders (DENIED), listOpenOrders, myWorkInbox, searchProducts, getStockForProduct, prepareReceiveStock, getProposalStatus.

5. Switch the agent off and see the next call refused. The Receiver opened the account menu, Connected agents, and pressed Disable access:

The Connected agents dialog for the Receiver showing the Claude Code client as Access disabled, with Administrator approval required to re-enable

The next whoami in the same Claude Code session returned the historical response below. The quote and the saved transcript retain the original wire bytes; current versions use https://karyowms.com/errors/agent-access-disabled (403).

Error POSTing to endpoint: {"type":"https://karyo.com/errors/agent-access-disabled","title":"agent-access-disabled","status":403,"instance":"/mcp"}

Defects found and fixed

The first attempts to connect found five product defects. Each was reproduced live first. Four have an automated test, named in the last column. The 404 half of the fifth has none.

Symptom in Claude Code Cause Fix and test
Sign-in stopped with "JSON Parse error: Unrecognized token '<'" The nginx single-page fallback answered the path-inserted authorization-server discovery URL with HTML infrastructure/docker/nginx/nginx.conf proxies /.well-known/{oauth-authorization-server,openid-configuration}/auth/realms/<realm> to Keycloak and answers 404 for any other /.well-known/. Tests in tests/e2e/fixtures/nginx-upstream-resolve.test.ts
403 agent-insufficient-scope after consent: the token lacked karyo.read The realm role-scope-mapping on karyo.read dropped the scope from users who hold only default-roles-karyo, which is every person Karyo provisions default-roles-karyo added to the karyo.read scope mapping in both realm files. AgentRealmBootstrapTest now signs in a person with only the realm default role
Claude Code rejected every tool result as malformed structuredSuccess results carried no content array AgentToolInterceptor adds the same JSON as one text block. AgentMcpRuntimeTest
whoami failed client-side validation: "nextPage must be string" A null nextPage against a string schema @JsonInclude(NON_NULL) on AgentReadResult. AgentMcpRuntimeTest validates results against the advertised schema
/.well-known/oauth-protected-resource/mcp returned 404 when the app started before Keycloak, and text/plain otherwise Quarkus registered it only once the tenant was ready, and with no JSON content type A JAX-RS /mcp resource plus a route filter that sets application/json. AgentMcpRuntimeTest checks the JSON content type and the document on that path. The 404 before Keycloak was reproduced live and has no automated test, because the test runs with the agent tenant already ready

Two smaller changes came from the same run. whoami now returns each Facility's name and code, so an agent can map "Hillcrest DC" to an id. The Keycloak image in docs/operations/deploying.md, docs/operations/container-images.md and docs/architecture/runtime-and-configuration.md was corrected to the 26.8.0 the shipped realm requires.

The agent-tool mirror guard (AgentToolMirrorTest) now pins each of the 21 tools to its catalogue action (null for the four self-service tools) and has a planted-mismatch test that fails on a tool mapped to another action, to no row or to an unknown action.

What was not exercised

  • Elicitation. Claude Code 2.1.301 negotiates the 2026-07-28 stateless protocol, with its capabilities inline, and Karyo sends URL elicitation only on a session that declared it. The agent therefore carried the approval link in its reply. Karyo's elicitation is covered by ProposalElicitationTest, not by this live run.
  • Grok Bot and OpenAI dots. Not yet proved live. No account for either was created or signed in to.
  • offline_access. Claude Code requests it. The refresh-token path was not exercised beyond one re-authentication.
  • The live demo and Atlas. Not touched. This record proves a local installation behind a local certificate authority.

Observations, not fixed here

  • The Users page shows a Facility grant as "Facility 1000001", not by name.
  • The Approvals detail shows the changed fields as ids ("Product 1", "Unit load 54") and the names only under "From outside Karyo".
  • Keycloak's consent page title is low contrast on the dark theme.
  • The session clock of the model (2026-10-16 IST) was later than the proposal expiry stamped in UTC (2026-10-15 21:28), and the agent flagged it; the proposal was still PROPOSED.
  • Claude Code says "karyo rejected them on reconnect" while the person's agent access is pending approval. The Connect section of connecting an agent describes it.

Scope notes

  • The stack and the local certificate authority were torn down after the run. The record and the sibling directory are the only artifacts kept.
  • The Keycloak realm change is a token-scope change. A realm imported earlier is not changed by --import-realm, and needs the same by-hand edit (see connecting an agent).