Skip to content

feat(mcp): add read-only attachments surface (pad_attachment)#875

Merged
xarmian merged 1 commit into
mainfrom
feat/mcp-attachments-surface
Jul 8, 2026
Merged

feat(mcp): add read-only attachments surface (pad_attachment)#875
xarmian merged 1 commit into
mainfrom
feat/mcp-attachments-surface

Conversation

@xarmian

@xarmian xarmian commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

What

Wires the existing (but previously unexposed) attachment HTTP dispatchers onto the MCP catalog as a new read-only pad_attachment tool with list / show actions, mirroring the CLI pad attachment list / pad attachment show.

Attachments had zero MCP surface even read-only, though internal/mcp/dispatch_http_attachments.go (+ its tests) already existed. Both dispatch paths now reach the surface:

  • ExecDispatcherpassThrough([]string{"attachment", "list"|"show"}) shells out to the CLI.
  • HTTPHandlerDispatcher — the existing dispatchAttachmentList / dispatchAttachmentShow (ref→UUID resolution, attached/unattached fold, HEAD-header extraction).

Decisions

  • New pad_attachment tool, not pad_item actions. An attachment is its own workspace-scoped resource (optionally item-linked), not an item property. A dedicated tool keeps pad_item's already-large action enum focused, and matches the HTTP dispatcher's first-class attachment list / attachment show cmdPaths.
  • Read-only only. upload / download / view stay CLI-only (filesystem-bound), excluded per the catalog's exclusion rules (same rationale as the noRemoteEquivalent table).
  • collection filter documented as collection UUID, not slug — matches the CLI flag and the server filter (Codex review catch).
  • Base64 image resource deferred. pad://workspace/{ws}/attachments/{id} returning base64 for small images is genuinely non-trivial (ResourceFetcher returns strings; no CLI base64-to-stdout path; needs a size gate + MIME allowlist + HTTP-dispatcher parity). Routed to TASK-2076 rather than expanding this PR.

Version bump

ToolSurfaceVersion 0.10 → 0.11. Updated in lockstep: internal/mcp/version.go changelog, instructions.md, README.md, CLAUDE.md, cmd/pad/mcp.go + catalog_meta.go help text, readOnlyActions, and the drift-guard test fixtures.

Gates

golangci-lint, go test ./..., go build ./cmd/pad, and go test ./internal/mcp/... (drift guard) all green. Codex review CLEAN.

TASK-2017

https://claude.ai/code/session_019knGmnHcx5rrgWXQ8V8DZS

Wire the existing attachment HTTP dispatchers onto the MCP catalog as a
new read-only pad_attachment tool with list/show actions, mirroring the
CLI `pad attachment list` / `pad attachment show`. Both dispatch paths
already existed (ExecDispatcher via passThrough, HTTPHandlerDispatcher
via dispatch_http_attachments.go) — this exposes them on the tool
surface.

- New tool rather than pad_item actions: an attachment is its own
  workspace-scoped resource, not an item property; a dedicated tool
  keeps pad_item's action enum focused.
- Read-only only: upload/download/view stay CLI-only (filesystem-bound),
  matching the catalog's exclusion rules.
- Bumps ToolSurfaceVersion 0.10 -> 0.11; updates instructions.md,
  README, CLAUDE.md, readOnlyActions, and the drift-guard fixtures.
- The base64 image RESOURCE for multimodal agents is deferred to
  TASK-2076 (ResourceFetcher returns strings; no CLI base64-to-stdout
  path exists — non-trivial, out of scope here).

TASK-2017

Claude-Session: https://claude.ai/code/session_019knGmnHcx5rrgWXQ8V8DZS
@xarmian xarmian merged commit 2e6538a into main Jul 8, 2026
3 of 4 checks passed
@xarmian xarmian deleted the feat/mcp-attachments-surface branch July 8, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant