Agent access and grants
How an and-harness agent, rather than a person, gets access to the MCP gateway's tools, and the switches that cut and-harness off. Read this page if you are registering an agent, granting it a tool or working out why an agent sees no tools. For principals and status codes, see the overview; for full protocol detail, see the gateway README.
The agent registry
An agent is a record in the agent registry, the <env>-harness-agents-table DynamoDB table the auth service owns. The record is keyed by agentId (an and-harness service-account id, or platform) and holds:
| Field | What it is |
|---|---|
harnessClientId | the only and-harness client allowed to assert this agent, such as and-harness-dev |
ownerAndiId, name, purpose | the ANDi who owns the agent and what it is for |
roles | the Luna roles the agent's delegated identity carries |
status | active or suspended |
expiresAt | when the registration lapses, at most 90 days after it is set |
grants or listGrant | what the agent may call, see Grants |
The luna harness-agents CLI writes the registry. register creates a record that is active with no grants; update, suspend and resume change its details or status and leave its grants alone; list shows every agent with its status and grants.
luna harness-agents register <agentId> --owner <andiId> --name <name> --purpose <purpose> \
--harness-client-id <clientId> --roles HarnessAgent --expires-at <date>The gateway reads an agent's record on every agent request and never writes it. Before that, the delegated identity mint refuses an agent that is unknown, suspended, expired or asserted by a client other than its harnessClientId, with 403 not_permitted.
Grants
A record holds either per-tool grants or a list grant, never both. Each grant records the ANDi who approved it and the and-harness request that asked for it.
- Per-tool grants (
grants) map a tool name to a grant. Each grant may carry its own data scope:engagementIds,businessUnits,organisationIdsandbillableOnly. Every field the scope sets must match the tool's answer, and an unset field limits nothing, so a grant with no scope covers all of the tool's data. - A list grant (
listGrant) lets an agent see the gateway's tools without calling any of them. It exists for catalogue agents such as and-harness'ssvc-catalog, which lists the tools on offer.
A tool is grantable only once its definition allows the agent principal. A scoped grant also needs the tool to map its answer onto the scope's fields; a scoped grant of a tool that cannot is never satisfied. get_invoicing_calendar maps its answer to nothing: the calendar names no engagement, business unit or organisation, so it is within every scope and a scoped grant of it may call it. Of the tools on the Tools page, only list_engagements_for_billing, list_invoices_for_billing, get_invoice_readiness, list_engagement_budgets, get_invoicing_calendar, get_billable_amounts_time_and_materials, get_engagement_billable_amounts and find_organisations allow the agent principal, so a per-tool grant can list only those eight.
What an agent sees
| Registry record | tools/list | tools/call |
|---|---|---|
| per-tool grants | the granted tools that allow an agent | a granted tool runs; an answer outside the grant's scope is not_permitted; any other tool is Unknown tool |
| a list grant | every tool the gateway implements, the people tools included | every call is not_permitted |
no record, suspended or expired | nothing | every call is Unknown tool |
malformed grants or listGrant, or a missing or non-numeric expiresAt | nothing | every call is Unknown tool |
| the registry cannot be read | nothing | every call is Unknown tool |
A tool the agent is not listed is answered exactly like one that does not exist, so an agent cannot discover tools it has not been granted. A registry read that fails is logged and grants nothing; it never fails the request and never falls back to a person's view. Unknown tool is a JSON-RPC -32602 error, and not_permitted is the tool's own error result inside a 200, as on the Tools page.
Cutting and-harness off
Three switches stop and-harness without a deploy. Each is an SSM parameter under /luna/<env>/mcp-gateway/, read through a 60-second cache, so a change takes effect within a minute.
| Parameter | Effect | Refusal |
|---|---|---|
enabled | false refuses every request. Missing means enabled. | 403 gateway_disabled |
allowed-source-cidrs | a JSON list of CIDRs; a request from any other address is refused. Read in production only, where a missing list refuses everything. | 403 source_not_allowed |
harness-issuers | an issuer whose status is not active has its calls refused, cutting off that one and-harness client | 403 harness_suspended |
The two kill switches, enabled and allowed-source-cidrs, run before the assertion is read, so a switched-off gateway does no work for a caller. and-harness treats gateway_disabled and source_not_allowed as an outage, not a refusal of the caller. All three fail closed: a parameter that cannot be read, or a kill switch holding a malformed value, answers 503 luna_unavailable rather than letting the request through.
To stop a single agent rather than a whole client, suspend it with luna harness-agents suspend <agentId>.
