Skip to content

feat(mcp): read_acl / write_acl convenience tools #496

Description

@melvincarvalho

Follow-up to #490 (the MCP capstone in v0.0.200).

Why

The most common owner operation in a bot world is granting an agent access to a specific resource. Today, that requires the owner (or a delegated tool) to:

  1. `read_resource` the existing `.acl` (which is JSON-LD)
  2. Parse it
  3. Add a new `acl:Authorization` block with the right `acl:agent` / `acl:mode` shape
  4. `write_resource` the modified `.acl` back

For the headline ergonomic — delegation to an agent is one ACL edit — that pipeline is ergonomically painful. It's also error-prone (hand-rolled JSON-LD is the #1 thing humans get wrong about WAC).

Two convenience tools eliminate this.

What

```
read_acl — Return the effective ACL for a resource, including inherited
rules from parent containers. Returns a structured form:
{ authorizations: [{ agents, agentClasses, modes, isDefault }] }

write_acl — Write a structured ACL to a resource. Accepts the same
shape read_acl returns. Server serializes to JSON-LD.
arguments:
path: string
authorizations: array of { agent | agentClass, modes, isDefault }
```

The structured form abstracts away the JSON-LD-quirks: `acl:agent` vs `acl:agentClass`, `acl:Read|Write|Append|Control` mode URIs, `acl:default` propagation. Bots can grant/revoke without ever touching turtle or JSON-LD syntax.

Scope

  • Both tools in `src/mcp/tools.js`
  • Structured ↔ JSON-LD round-trip using existing `src/wac/parser.js`
  • WAC check: `acl:Control` required to write_acl
  • Test: read_acl an existing resource, grant a new agent, verify they now have access
  • Doc with worked example

Estimated ~100-150 lines including tests.

Why structured (not just `write_resource` to `.acl`)

Three reasons:

  1. Discoverability — agents see `write_acl` in the tool list and know to use it for delegation. Without it, they'd `write_resource` to a path that happens to be an ACL.
  2. Correctness — the existing JSON-LD parsers in `src/wac/` already handle the corner cases; surfacing that as a tool means bots don't reinvent them badly.
  3. Future-proofing — if WAC evolves (Append vs Write distinction, new agent classes, conditional rules), the tool surface stays stable while the JSON-LD shape evolves.

Acceptance

  • `read_acl` returns structured authorizations (own + inherited)
  • `write_acl` accepts the same structure and persists correctly
  • WAC: only callers with Control can write_acl
  • Tested with grant/revoke round-trip
  • Documented in `docs/mcp.md`

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    agenticIssues and PRs related to agentic / LLM-builder / agent-friendly use casesmcpModel Context Protocol (MCP) server, tools, federationpluginCould be implemented as a plugin (#206); core/plugin line defined in #564

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions