@withpica/mcp-server 2.23.0 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -8
- package/dist/config.js.map +1 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +6 -4
- package/dist/prompts/index.js.map +1 -1
- package/dist/resources/llms-primer.d.ts +1 -1
- package/dist/resources/llms-primer.d.ts.map +1 -1
- package/dist/resources/llms-primer.js +1 -1
- package/dist/server-instructions.d.ts +1 -1
- package/dist/server-instructions.d.ts.map +1 -1
- package/dist/server-instructions.js +13 -15
- package/dist/server-instructions.js.map +1 -1
- package/dist/tools/agent-identity.d.ts +36 -0
- package/dist/tools/agent-identity.d.ts.map +1 -0
- package/dist/tools/agent-identity.js +269 -0
- package/dist/tools/agent-identity.js.map +1 -0
- package/dist/tools/agreements.d.ts.map +1 -1
- package/dist/tools/agreements.js +6 -2
- package/dist/tools/agreements.js.map +1 -1
- package/dist/tools/collaborators.js +1 -1
- package/dist/tools/collaborators.js.map +1 -1
- package/dist/tools/discovery.d.ts.map +1 -1
- package/dist/tools/discovery.js +2 -12
- package/dist/tools/discovery.js.map +1 -1
- package/dist/tools/duplicates.d.ts.map +1 -1
- package/dist/tools/duplicates.js +2 -1
- package/dist/tools/duplicates.js.map +1 -1
- package/dist/tools/enrichment.d.ts +0 -17
- package/dist/tools/enrichment.d.ts.map +1 -1
- package/dist/tools/enrichment.js +35 -180
- package/dist/tools/enrichment.js.map +1 -1
- package/dist/tools/feedback.d.ts +22 -0
- package/dist/tools/feedback.d.ts.map +1 -0
- package/dist/tools/feedback.js +99 -0
- package/dist/tools/feedback.js.map +1 -0
- package/dist/tools/gap-hints.d.ts +53 -0
- package/dist/tools/gap-hints.d.ts.map +1 -0
- package/dist/tools/gap-hints.js +245 -0
- package/dist/tools/gap-hints.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +29 -9
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/integrations.d.ts +5 -1
- package/dist/tools/integrations.d.ts.map +1 -1
- package/dist/tools/integrations.js +56 -25
- package/dist/tools/integrations.js.map +1 -1
- package/dist/tools/metadata.d.ts.map +1 -1
- package/dist/tools/metadata.js +202 -24
- package/dist/tools/metadata.js.map +1 -1
- package/dist/tools/notes.d.ts.map +1 -1
- package/dist/tools/notes.js +1 -1
- package/dist/tools/notes.js.map +1 -1
- package/dist/tools/people.d.ts +0 -15
- package/dist/tools/people.d.ts.map +1 -1
- package/dist/tools/people.js +26 -109
- package/dist/tools/people.js.map +1 -1
- package/dist/tools/recordings.d.ts.map +1 -1
- package/dist/tools/recordings.js +1 -1
- package/dist/tools/recordings.js.map +1 -1
- package/dist/tools/recovery-hints.d.ts.map +1 -1
- package/dist/tools/recovery-hints.js +7 -101
- package/dist/tools/recovery-hints.js.map +1 -1
- package/dist/tools/search.js +1 -1
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/settings.d.ts +2 -0
- package/dist/tools/settings.d.ts.map +1 -1
- package/dist/tools/settings.js +93 -1
- package/dist/tools/settings.js.map +1 -1
- package/dist/tools/works.d.ts.map +1 -1
- package/dist/tools/works.js +27 -4
- package/dist/tools/works.js.map +1 -1
- package/package.json +3 -3
- package/server.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [2.25.0] - 2026-04-22
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **`openWorldHint: true` on 12 external-delivery tools.** Previously hardcoded `openWorldHint: false` on every tool annotation (`src/tools/index.ts` metadata + fallback paths). Tools that reach external recipients — email sends (`pica_collaborators_invite`, `pica_collaborators_invite_bulk`, `pica_collaborators_invite_resend`, `pica_send_message`, `pica_send_resend`, `pica_split_sheet_send`, `pica_submit_license_enquiry`), Telegram posts (`pica_notify_user`, `pica_notify_user_at`, `pica_notify_person`), team-comms routing (`pica_submit_feedback`), and publicly-reachable URL minting (`pica_share_links_create`) — now correctly signal `openWorldHint: true` per the MCP ToolAnnotations spec, letting MCP clients show appropriate confirmation UI for external side effects. Implementation: `ToolMetadata` gains optional `open_world?: boolean`; the annotation builder reads `metadata.open_world ?? false`. No behaviour change beyond the annotation payload. Addresses Anthropic directory-listing reviewer feedback.
|
|
19
|
+
- **ADR-154 F14 follow-up: six dangling `pica_enrich_*` references in `pica_integrations_status` response.** The F14 completion-hint sweep missed `mcp-server/src/tools/integrations.ts` — its `platformReads` list was pointing agents at six tool names that never existed or had already been removed (`pica_enrich_work_spotify`, `pica_enrich_recording_youtube`, `pica_enrich_work_musicbrainz`, `pica_enrich_work_mlc`, `pica_enrich_person_isni`, `pica_enrich_recording_discogs`). Repointed each entry at the correct post-ADR-179 resolver shape (e.g. `pica_resolve_work with sources: ['mlc']`), and updated the free-text summary's trailing "use the `pica_enrich_*` tools" sentence to name the three resolvers. No behaviour change beyond the string payload.
|
|
20
|
+
- **ADR-174 Phase 2c — inverse phantom in `pica_works_update` (works slice).** Three jsonb compliance fields (`ai_disclosure`, `provenance_attestation`, `training_rights`) are satellite-routed to `work_licensing` via `WORK_SATELLITE_FIELDS` and accepted by both the HTTP route allow-list and the service layer, but were missing from `WORK_WRITE_PROPERTIES`. Agents following the `pica_works_update with ai_disclosure: ...` completion hint at works.ts:577 were hitting schema-level silent-drop (or strict-validator 400s). Added all three properties to the write schema with shapes copy-pasted from the parallel fields on `pica_recordings_update` (recordings.ts:193). Tool description updated to distinguish audio-trait satellite fields (still not exposed) from the three compliance satellite fields (now exposed). Full audit of the other 22 customer-MCP write tools yielded zero further inverse phantoms — see `docs/audits/2026-04-21-mcp-inverse-phantom-audit.md`.
|
|
21
|
+
|
|
22
|
+
### Removed
|
|
23
|
+
|
|
24
|
+
- **ADR-154 F13: seven deprecated per-source enrich tools removed.** `pica_enrich_work_{mlc,musicbrainz,discogs,spotify,youtube}` and `pica_people_enrich_{isni,musicbrainz}` (tombstoned since ADR-179 Phase 1/2, 2026-04-17) are no longer registered — every call has returned a `-32070 TOOL_DEPRECATED` error for a full minor cycle, ending the one-minor deprecation window per ADR-179 Decision 2. Callers must use `pica_resolve_work(sources: [...])` or `pica_resolve_person(sources: [...])` instead; the `tools/list`, `metadata`, `recovery-hints`, and category-`discovery` surfaces shed the seven stale entries in this release. Downstream impact: clients that hardcoded the tool names now get `tools/list`-level absence rather than a deprecation envelope — fail-fast instead of fail-with-suggestion.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- **`pica_merge_duplicates` description + ADR-151 freshness gate response are now agent-parseable.** Tool description at `src/tools/duplicates.ts:47-49` now notes the 7-day `authenticated_at` re-auth window so agents can anticipate the gate before calling. The gate response body at `src/tools/index.ts:845-857` (shared across all 14 destructive tools) is now a structured JSON payload — `{ status: "reverification_required", message, retry_after: "pica_sign_in", retry_safe: true, reason: "session_older_than_7_days" }` — returned via both `content[0].text` and `structuredContent`. The natural-language `message` field also appends ", then retry this exact call" so a pure-text-reading client still gets the next-step signal. Agents no longer need to parse English to know that the next call will succeed after `pica_sign_in`. Gate logic is unchanged; ADR-151 behaviour is preserved. CEO-reported via Claude Desktop session 2026-04-21 (Item 5).
|
|
29
|
+
- **ADR-154 F14: completion-hint sweep for the seven removed tools.** Updated every `→ then:` and hint-string reference that pointed at the F13 tombstones across `enrichment.ts`, `people.ts` (3 sites), `collaborators.ts`, `works.ts` (2 sites), `search.ts`, `server-instructions.ts`, `prompts/index.ts` (3 sites), and `resources/llms-primer.ts`. Agents discovering tools via descriptions will no longer be trained toward dead tool names. The ADR-179 "Replaces the five/two per-source tools" phrasing is gone from the resolver descriptions too — resolvers stand on their own now.
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- **ADR-193 Surface 4: `pica_enrichment_propose` accepts `proposal_action: "create"`.** Closes the reserved-but-unwired create path from ADR-178 Phase 1. The tool schema now accepts `entity_type: "recording" | "agreement" | "person"` paired with `parent_entity_type` + `parent_entity_id` for create proposals. Apply-path branches on `rule_id === "agent_research"` and routes to `recordingsService.create` (parent required; `work_id` linkage), `agreementsService.create` (optional work parent, linked via `agreementWorksService.addWork` after create), or `peopleAdminService.create` (standalone — people have no parent FK). Recording creates seed `field_sources` verbatim from `proposal.sources[].url`, preserving URI schemes (gmail://, gdrive://, notion://, file://, telegram://, user://, web://) per ADR-193 AC 5. Agreements + people don't carry `field_sources` on the main table today; provenance URIs are captured in `resolution_note` until a follow-up migration adds the column. Work + publisher creation remain explicitly out of scope (dedup-critical — deferred to future ADR). Migration `20260422_01_adr193_proposal_parent_fields` adds nullable `parent_entity_type` + `parent_entity_id` columns with a CHECK pair + partial index for the review-queue scan. Legacy `artist_title_to_youtube` create rule is untouched (it continues to overload `entity_id` as the parent work id). 4 new service-layer tests green; total proposal-service suite 42/42.
|
|
34
|
+
|
|
35
|
+
## [2.24.0] - 2026-04-21
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- **`pica_integrations_status` no longer tells users to "connect Spotify".** Two real-user failures on Claude Desktop (2026-04-21) traced back to the tool lumping platform-level Spotify/YouTube (PICA has its own credentials; no per-user OAuth exists or has ever existed) into the same "Available to connect" list as genuine user-OAuth peer connectors (Google/Notion/Airtable/Telegram). Failure modes observed: (1) user pasted a Spotify track URL → agent replied "head to your Pica dashboard and add Spotify as an integration"; (2) user asked "what songs do I have in pica" with a catalog holding 1 work → agent replied "you currently have no connections set up in Pica — so there are no songs or any other data accessible." Reshape: the tool now returns `peerConnectors` (the 4 actual OAuth services) separately from `platformReads` (Spotify, YouTube, MusicBrainz, MLC, ISNI, Discogs, with the tool name for each). Summary leads with "PICA catalog is ALWAYS accessible via pica_works_query, pica_people_query, pica_dashboard_briefing, pica_search_all — no setup required." The dead `connectedProviders.includes("spotify")` check that could never evaluate true was removed.
|
|
40
|
+
- **Server instructions: catalog-is-always-accessible guidance.** Handshake now explicitly states (a) the catalog is always accessible via the read tools with zero setup, (b) `pica_integrations_status` showing "0 connected" refers to optional peer connectors, NOT the catalog — call `pica_works_query` to check, (c) Spotify/YouTube URLs go through `pica_import_streaming_link` / `pica_import_youtube_link` directly; no per-user Spotify/YouTube OAuth exists to set up, do not tell the user to "connect Spotify in your dashboard". Replaces earlier copy that left the agent free to hallucinate a dashboard-integration flow. `lib/mcp/server-instructions.ts` parity copy updated in lockstep; the HTTP transport at `/api/mcp` picks up the new text on next handshake without requiring a redeploy of this package. Under the 2000-char token budget at 1833 chars.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- **ADR-180 Phase 3: full TOOL_METADATA coverage.** 29 tools retrofitted in `mcp-server/src/tools/metadata.ts` across eight family-scoped commits — resolve (3), cascade (3), enrichment proposals (4), collaborators (4), notify-user scheduling (3), physical-assets links (4), misc singletons (5), and the ADR-185 Part 1 agent-identity drift (3). `scripts/mcp-tool-lint-baseline.json` is deleted; MCP Tool Lint now runs in fully-strict mode. No behaviour change — tool discovery, audit categorisation, and risk-tier gating now classify the same 29 tools they couldn't classify before. `credits_required` deliberately omitted from new entries (credit gating is a no-op pass-through since ADR-162). Retry-safety follows ADR-180's `risk × retry_safe` table — e.g. `pica_enrichment_proposal_apply` is `retry_safe: false` (writes to entity columns), `_reject` is `retry_safe: true` (content-hash suppression is set-once). ADR-180 flipped from `Proposed` to `Accepted`.
|
|
45
|
+
- **ADR-193 Surfaces 1+3: peer-connector coaching + URI source conventions (server-instructions addendum).** Handshake copy coaches agents to check peer MCPs (email / drive / notes / calendar / DAW) before asking users to paste or type data, and to cite findings via `pica_enrichment_propose` `sources[].url` using URI schemes — `gmail://` `gdrive://` `notion://` `file://` `telegram://` `calendar://` `daw://` `user://` `web://`. See `docs/mcp-source-uri-conventions.md` in the main repo for shapes. First concrete build for ADR-190 Principles 2 + 3 (Agent-Mediated Source Discovery). A latent HTTP-transport gap was fixed in the same develop commit (`63eef17f8`) — `/api/mcp/route.ts` was not wiring `SERVER_INSTRUCTIONS` into its Server constructor, so remote agentic clients (ChatGPT Apps, Claude Desktop remote, Cursor) saw zero coaching. The stdio transport in this package was always serving instructions correctly; only the remote transport was affected.
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
|
|
49
|
+
- **ADR-193 Surface 2: `gap_hints` envelope on 4 read tools.** `pica_works_inspect`, `pica_agreements_inspect`, `pica_people_inspect`, and `pica_enrichment_proposals_list` now emit an optional `gap_hints[]` field on `structuredContent` when a real gap is present. Each hint is capability-named (ADR-190 Principle 2 — `email_search` / `drive_search` / `filesystem_search` / `notes_search` / `calendar_search` / `web_search`, never vendor names), carries a concrete `query_shape`, and pre-fills the `then_call: "pica_enrichment_propose"` with the exact `then_args_shape` the agent should emit back (including URI-citation scaffolding from Surface 3). Gated by `MCP_GAP_HINTS_ENABLED=1` — off by default in prod. Empty array / omitted envelope when there's no real gap. Flat additive — the existing `CompletionHint` pipeline on `works_inspect` is untouched. Bundled: `enrich-metadata` prompt references the peer-connector pattern and points the agent at `gap_hints`.
|
|
50
|
+
- **ADR-185 Part 1: three new session-auth-only tools.** `pica_create_agent_identity`, `pica_issue_agent_grant`, `pica_list_my_agent_grants`. Back a user-issued agent-identity + scoped-grant primitive — the substrate for Parts 2 (settings UI) and 3 (per-write provenance stamping). All three require `write:agent_identity` scope AND session-auth (raw API key / OAuth); the HTTP MCP dispatcher refuses `pica_grant_` callers with a structured `reason: "session_auth_required"` error before execution per AC 12. Subject is always the authenticated user — caller-supplied `user_id` is dropped per ADR-184 rule 2 / ADR-185 rule 1. Grant tokens use the format `pica_grant_<64 hex>` and are hashed at rest with HMAC-SHA256 + `API_KEY_HASH_PEPPER` (same scheme as api_keys per ADR-185 line 193 + ADR-167 D-5).
|
|
51
|
+
- **ADR-185 Part 2: two new session-auth-only tools.** `pica_revoke_agent_grant` (DELETE `/admin/agent-grants/:id`, idempotent, 404 masks ownership failures) and `pica_get_agent_activity` (GET `/admin/agent-activity`, paginated, optionally filtered by identity or grant). Both appended to `SESSION_AUTH_ONLY_TOOLS` in the HTTP MCP dispatcher and to the `write:agent_identity` scope bucket. Together with the Part 1 trio this completes the five-tool agent-identity surface the ADR Scope requires. Revocation takes effect on the next request (AC: within 60s — `resolveGrantToken` checks `revoked_at` on every call, no cache layer).
|
|
52
|
+
- **ADR-185 Part 3 passes 1-5 (main-app wrappers consumed by this package's writes).** Part 3 layers two complementary wrappers (`withAgentActionStamp` / `withAgentActionStampFirst`) over existing admin-route write handlers so every per-grant write records a row in `mcp_agent_actions` for audit + revoke-replay. The wrappers live in the main app (`lib/services/agent-action-stamp.ts`); this package's stdio tools transparently inherit the behaviour when they call the wrapped admin routes. Families covered across the five passes: works/recordings/people/agreements/releases/notes creates; notes_delete; sessions_create; share_links_create; projects_create; multimedia_create; recording_splits_create; works_update; recordings_update; people_update; agreements_update; projects_update; notes_update; releases_update; people_delete; publishers_create; the six hard-delete families (works/recordings/agreements/projects/sessions/releases) via the stamp-first variant; and pass 5's `pica_projects_attach_works` (project_works insert wrapped, GET + POST migrated from `requireAuth` + `getUserProfile` to `withOrgContext` for consistency). `pica_sessions_update` remains deferred — action-branching route (start/complete/cancel + participant add/remove + regular update) needs a dedicated design slice before wrapping.
|
|
53
|
+
- **New tool** `pica_submit_feedback`: agent-native feedback submission. Routes bug_report→devops, feature_request→ceo, question→comms, other→category-mapped. Requires `write:feedback` scope. Subject is always the authenticated user per ADR-184 rule 2. (ADR-184 slice 8 — landed on develop 2026-04-19 post-2.23.0 publish.)
|
|
54
|
+
- **ADR-189 Phase 3: two new identity-capture tools.** `pica_update_my_identity` (stage_name / IPI / ISNI / IPN / PRO) and `pica_update_organisation_profile` (org_type / display_name / tagline / ipi_number). Both admin-scoped, both `retry_safe: true` (idempotent upserts — re-applying the same IPI leaves the row in the same state). Subject derived from auth (no `user_id` / `organisation_id` parameters — ADR-184 rule 2). After the identity write, `pica_update_my_identity` re-runs cross-org discovery and returns the count of newly-visible credits / custody / artist-link rows so the agent can surface "found N more — claim them?" in the same conversation turn. Rate-limited at 20 writes/hour/user via `checkActionRateLimit` (R1 mitigation). Admin routes (`POST /api/admin/my-identity`, `POST /api/admin/organisation-profile`) wrap in `withAgentActionStamp` when the caller presents an agent grant (ADR-185 Part 3) — UPDATE compensation captures pre-write state via read-before-write and PATCHes the row back on stamp failure, or deletes a lazy-created person row.
|
|
55
|
+
|
|
14
56
|
## [2.23.0] - 2026-04-19
|
|
15
57
|
|
|
16
58
|
### Added
|
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,OAAO,WAAW,CAAC;AAEhC,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,UAAU,IAAI,YAAY,CAwCzC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAWzD"}
|
package/dist/config.js
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
* MCP Server Configuration
|
|
4
4
|
*/
|
|
5
5
|
import { readCredentials, getDefaultCredentialsPath, } from "@withpica/mcp-utils";
|
|
6
|
+
// Single TS-side source of truth for the customer MCP server version.
|
|
7
|
+
// Keep in sync with mcp-server/package.json; scripts/lint-mcp-tools.ts
|
|
8
|
+
// enforces that and blocks literal version strings elsewhere. Surfaces
|
|
9
|
+
// on stdio via the boot banner + MCP `initialize` handshake (loadConfig
|
|
10
|
+
// below) and on HTTP via app/api/mcp/route.ts, which imports this const
|
|
11
|
+
// from mcp-server/dist/config.js. Past drift incidents: 2026-04-08
|
|
12
|
+
// (banner 2.5.0 vs npm 2.6.1), 2026-04-19 ADR-181 Phase 2 (banner 2.6.2
|
|
13
|
+
// vs npm 2.22.0). ADR-180 Phase 2 collapses the duplication.
|
|
14
|
+
export const VERSION = "2.25.0";
|
|
6
15
|
export function loadConfig() {
|
|
7
16
|
const credentialsPath = process.env.PICA_CREDENTIALS_PATH || getDefaultCredentialsPath();
|
|
8
17
|
const debug = process.env.DEBUG === "true" || process.env.DEBUG === "1";
|
|
@@ -30,14 +39,7 @@ export function loadConfig() {
|
|
|
30
39
|
picaApiKey,
|
|
31
40
|
picaApiUrl: process.env.PICA_API_URL || "https://withpica.com/api",
|
|
32
41
|
serverName: "pica-mcp-server",
|
|
33
|
-
|
|
34
|
-
// string surfaces in the boot banner ([MCP Server] Version: ...) and
|
|
35
|
-
// in the MCP `initialize` handshake response under `serverInfo.version`,
|
|
36
|
-
// which is what clients display in their connector UIs. Drift from
|
|
37
|
-
// package.json was caught 2026-04-08 — banner read 2.5.0 long after
|
|
38
|
-
// npm was on 2.6.1. Caught again 2026-04-19 during ADR-181 Phase 2 —
|
|
39
|
-
// banner read 2.6.2 long after npm was on 2.22.0; fixed here.
|
|
40
|
-
version: "2.23.0",
|
|
42
|
+
version: VERSION,
|
|
41
43
|
debug,
|
|
42
44
|
lobbyMode,
|
|
43
45
|
credentialsPath,
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;GA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C,uBAAuB;IA8B/B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA+B/B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAkC/B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAgC5B;;OAEG;IACH,OAAO,CAAC,4BAA4B;IA+BpC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAkC7B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAsChC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAuC7B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAmChC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IA+CnC;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAoChC"}
|
package/dist/prompts/index.js
CHANGED
|
@@ -192,7 +192,9 @@ For each enrichment opportunity:
|
|
|
192
192
|
- Suggest potential sources (ISNI, MusicBrainz, etc.)
|
|
193
193
|
- Prioritize the most impactful enrichment opportunities
|
|
194
194
|
|
|
195
|
-
Focus on people and works where enrichment would add the most value
|
|
195
|
+
Focus on people and works where enrichment would add the most value.
|
|
196
|
+
|
|
197
|
+
ADR-193 — before asking the user to paste facts, check your other connected MCPs (email, drive, notes, calendar) for evidence first. When you find it, cite the source via pica_enrichment_propose with a URI-style source (gmail://thread-id/..., gdrive://file-id/..., notion://page-id/..., file:///..., etc). PICA read tools surface gap_hints pointing at the exact capability + query shape to use — follow them when present.`,
|
|
196
198
|
},
|
|
197
199
|
},
|
|
198
200
|
],
|
|
@@ -325,7 +327,7 @@ Ask me what I've got and help me get started with whichever method I choose.
|
|
|
325
327
|
|
|
326
328
|
After importing, guide me through closing the loop on each work:
|
|
327
329
|
- Who wrote these songs? (pica_credits_update — add writers and set splits)
|
|
328
|
-
- Are there publishing details registered? (
|
|
330
|
+
- Are there publishing details registered? (pica_resolve_work with sources: ['mlc'] — check MLC)
|
|
329
331
|
- Do I have audio files to upload? (pica_audio_presigned_upload — for analysis)
|
|
330
332
|
- What identifiers are missing? (pica_works_inspect with sections: ["enrichment"] — check coverage)
|
|
331
333
|
|
|
@@ -366,7 +368,7 @@ For the work, check every aspect of completeness:
|
|
|
366
368
|
For each gap found, offer a specific action:
|
|
367
369
|
- Missing credits → "Want me to add writers? Who wrote this song?"
|
|
368
370
|
- Splits not set → "What's the split between the writers?"
|
|
369
|
-
- No ISWC → "Want me to check MLC for this work?" (
|
|
371
|
+
- No ISWC → "Want me to check MLC for this work?" (pica_resolve_work with sources: ['mlc'])
|
|
370
372
|
- No ISRC → "Do you have a recording with an ISRC for this?"
|
|
371
373
|
- No audio → "Got a master recording to upload?"
|
|
372
374
|
- Audio not analysed → "Want me to analyse the audio for BPM, key, and mood?"
|
|
@@ -397,7 +399,7 @@ Steps:
|
|
|
397
399
|
1. pica_works_query — list works, then use pica_works_inspect with sections: ["registration"] to check registration status across PROs (PRS, MCPS, PPL, MLC)
|
|
398
400
|
2. For works that aren't registered, use pica_works_inspect with sections: ["registration", "completeness"] on a sample to understand what's blocking registration
|
|
399
401
|
3. Identify common blockers:
|
|
400
|
-
- Missing ISWC (needed for PRS/MCPS) → suggest
|
|
402
|
+
- Missing ISWC (needed for PRS/MCPS) → suggest pica_resolve_work with sources: ['mlc']
|
|
401
403
|
- Missing ISRC (needed for PPL) → check if recordings have ISRCs
|
|
402
404
|
- Missing credits (needed for all) → suggest adding writers
|
|
403
405
|
- Missing identifiers on people (IPI needed for PRO registration) → suggest enrichment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AA6B7D,MAAM,OAAO,cAAc;IACzB;;OAEG;IACH,WAAW;QACT,OAAO;YACL;gBACE,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EACT,+FAA+F;gBACjG,SAAS,EAAE,EAAE;aACd;YACD;gBACE,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EACT,kEAAkE;gBACpE,SAAS,EAAE,EAAE;aACd;YACD;gBACE,IAAI,EAAE,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QAC3C,MAAM,eAAe,GAAG,MAAM;YAC5B,CAAC,CAAC,+BAA+B,MAAM,oCAAoC,MAAM,IAAI,KAAK,mCAAmC;YAC7H,CAAC,CAAC,iJAAiJ,CAAC;QAEtJ,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;;EAEhB,eAAe;;;;;;;;;;;;;;;;;;;uGAmBsF;qBAC5F;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,wBAAwB;QAC9B,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;mDAqBiC;qBACxC;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,2BAA2B;QACjC,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gIAiC8G;qBACrH;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,uBAAuB;QAC7B,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;0GAuBwF;qBAC/F;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const WITHPICA_PRIMER = "# PICA \u2014 Music Catalog Management Platform\n\nPICA helps music creators and publishers manage their catalog metadata,\ntrack royalties, and prepare works for registration with collection societies.\n\n## Core Entities\n\n### Work\nA musical composition (song, piece, library track). The central entity.\n- Has: title, ISWC, work_type (song/library/demo), genre, mood, BPM, key\n- Relationships: has many credits (writers/composers), has many recordings,\n has many agreements, may have audio files, may have multimedia\n- Identifiers: ISWC (global), Tunecode (PRS), CAE/IPI (writer)\n\n### Person\nA human involved in music \u2014 writer, composer, performer, producer, publisher.\n- Has: name, email, IPI number, ISNI, MusicBrainz ID, PRO affiliation\n- Relationships: credited on many works, may have recordings, may have agreements\n- Can be enriched via: ISNI, MusicBrainz, Wikidata\n\n### Recording\nA specific audio capture of a work \u2014 the master/sound recording side.\n- Has: title, ISRC, duration, artist, label\n- Relationships: belongs to one work, has credits (performers/producers)\n- Distinct from the work: a work is the composition, a recording is the performance\n\n### Agreement\nA contract governing rights to works \u2014 publishing, sync, distribution.\n- Has: title, type, parties, dates, territory, terms\n- Relationships: covers many works\n- Types: publishing_admin, co_publishing, master_recording, sub_publishing,\n admin_only, distribution, library_music, production, artist_contract,\n termination, report, other\n\n### Import Document\nA canonical representation of an ingested file (royalty statement, CSV import).\n- Has: source (16 formats \u2014 PROs: PRS, ASCAP, BMI, SESAC, SOCAN, APRA, GEMA, SACEM; NROs: PPL, SoundExchange, GVL; Mechanical: MCPS; Distributors: DistroKid, TuneCore, CD Baby; Revenue: YouTube Content ID), period, line items, field mappings, warnings\n- Immutable snapshot of the import event \u2014 not a live view\n- Use pica_import_documents_list to find them, pica_import_documents_get to read\n\n## First Connection\n\nIf you're connecting to this workspace for the first time or don't know where to start,\ninvoke the **workspace-autopilot** prompt. It reads the workspace state and routes you\nto the most valuable workflow automatically.\n\n## Recommended Workflows\n\n1. **Catalog audit**: pica_catalog_stats \u2192 pica_works_query({ health_filter: \"needs_attention\" }) \u2192 pica_works_inspect({ sections: [\"completeness\"] })\n2. **Enrichment**: pica_enrichment_candidates \u2192
|
|
1
|
+
export declare const WITHPICA_PRIMER = "# PICA \u2014 Music Catalog Management Platform\n\nPICA helps music creators and publishers manage their catalog metadata,\ntrack royalties, and prepare works for registration with collection societies.\n\n## Core Entities\n\n### Work\nA musical composition (song, piece, library track). The central entity.\n- Has: title, ISWC, work_type (song/library/demo), genre, mood, BPM, key\n- Relationships: has many credits (writers/composers), has many recordings,\n has many agreements, may have audio files, may have multimedia\n- Identifiers: ISWC (global), Tunecode (PRS), CAE/IPI (writer)\n\n### Person\nA human involved in music \u2014 writer, composer, performer, producer, publisher.\n- Has: name, email, IPI number, ISNI, MusicBrainz ID, PRO affiliation\n- Relationships: credited on many works, may have recordings, may have agreements\n- Can be enriched via: ISNI, MusicBrainz, Wikidata\n\n### Recording\nA specific audio capture of a work \u2014 the master/sound recording side.\n- Has: title, ISRC, duration, artist, label\n- Relationships: belongs to one work, has credits (performers/producers)\n- Distinct from the work: a work is the composition, a recording is the performance\n\n### Agreement\nA contract governing rights to works \u2014 publishing, sync, distribution.\n- Has: title, type, parties, dates, territory, terms\n- Relationships: covers many works\n- Types: publishing_admin, co_publishing, master_recording, sub_publishing,\n admin_only, distribution, library_music, production, artist_contract,\n termination, report, other\n\n### Import Document\nA canonical representation of an ingested file (royalty statement, CSV import).\n- Has: source (16 formats \u2014 PROs: PRS, ASCAP, BMI, SESAC, SOCAN, APRA, GEMA, SACEM; NROs: PPL, SoundExchange, GVL; Mechanical: MCPS; Distributors: DistroKid, TuneCore, CD Baby; Revenue: YouTube Content ID), period, line items, field mappings, warnings\n- Immutable snapshot of the import event \u2014 not a live view\n- Use pica_import_documents_list to find them, pica_import_documents_get to read\n\n## First Connection\n\nIf you're connecting to this workspace for the first time or don't know where to start,\ninvoke the **workspace-autopilot** prompt. It reads the workspace state and routes you\nto the most valuable workflow automatically.\n\n## Recommended Workflows\n\n1. **Catalog audit**: pica_catalog_stats \u2192 pica_works_query({ health_filter: \"needs_attention\" }) \u2192 pica_works_inspect({ sections: [\"completeness\"] })\n2. **Enrichment**: pica_enrichment_candidates \u2192 pica_resolve_work (fans out across Spotify/MLC/MusicBrainz/etc.) \u2192 pica_works_inspect (verify)\n3. **Statement reconciliation**: pica_import_documents_query \u2192 pica_import_documents_inspect({ sections: [\"diff\"] })\n4. **Duplicate cleanup**: pica_find_duplicates \u2192 review \u2192 pica_merge_duplicates\n5. **Registration readiness**: pica_works_inspect({ sections: [\"registration\"] }) \u2192 fix gaps \u2192 pica_export_song_registration\n\n## Key Concepts\n\n- **Organisation**: Multi-tenant \u2014 all data scoped to one org. Never cross org boundaries.\n- **PICA Score**: Composite catalog legibility index (0-100, grade A-F). Four pillars:\n identification, documentation, registration, completeness.\n- **Enrichment cascade**: When an identifier is added, external sources\n (MusicBrainz, ISNI, MLC) are queried automatically to fill gaps.\n- **Credits**: Work credits (writers/composers with splits) are distinct from\n recording credits (performers/producers). Different tables, different role enums.\n Work credit roles: writer, composer, arranger, lyricist, producer, performer.\n Recording credit roles: Writer, Composer, Producer, Performer (PascalCase).\n";
|
|
2
2
|
//# sourceMappingURL=llms-primer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llms-primer.d.ts","sourceRoot":"","sources":["../../src/resources/llms-primer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"llms-primer.d.ts","sourceRoot":"","sources":["../../src/resources/llms-primer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,0qHAiE3B,CAAC"}
|
|
@@ -48,7 +48,7 @@ to the most valuable workflow automatically.
|
|
|
48
48
|
## Recommended Workflows
|
|
49
49
|
|
|
50
50
|
1. **Catalog audit**: pica_catalog_stats → pica_works_query({ health_filter: "needs_attention" }) → pica_works_inspect({ sections: ["completeness"] })
|
|
51
|
-
2. **Enrichment**: pica_enrichment_candidates →
|
|
51
|
+
2. **Enrichment**: pica_enrichment_candidates → pica_resolve_work (fans out across Spotify/MLC/MusicBrainz/etc.) → pica_works_inspect (verify)
|
|
52
52
|
3. **Statement reconciliation**: pica_import_documents_query → pica_import_documents_inspect({ sections: ["diff"] })
|
|
53
53
|
4. **Duplicate cleanup**: pica_find_duplicates → review → pica_merge_duplicates
|
|
54
54
|
5. **Registration readiness**: pica_works_inspect({ sections: ["registration"] }) → fix gaps → pica_export_song_registration
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Block playbook: "document the high level of your server"
|
|
6
6
|
* Lowin: "instructions are context — design them as context"
|
|
7
7
|
*/
|
|
8
|
-
export declare const SERVER_INSTRUCTIONS = "PICA manages music catalog metadata \u2014 works, recordings, people, credits, agreements,
|
|
8
|
+
export declare const SERVER_INSTRUCTIONS = "PICA manages music catalog metadata \u2014 works, recordings, people, credits, agreements, rights.\n\nStart here:\n- pica_dashboard_briefing \u2014 daily summary of what needs attention\n- pica_search_all \u2014 find any entity by name, ISWC, ISRC, or IPI\n- pica_works_query / pica_people_query \u2014 browse the catalog\n\nThe catalog is ALWAYS accessible via the tools above \u2014 zero setup, no integration required. If pica_integrations_status shows \"0 connected\" that refers to optional peer connectors (Google/Notion/Airtable/Telegram), NOT the catalog; call pica_works_query to check what's there.\n\nSpotify/YouTube URLs: call pica_import_streaming_link (Spotify/Deezer) or pica_import_youtube_link directly. PICA reads these at platform level \u2014 there is no per-user Spotify/YouTube OAuth; do not tell the user to \"connect Spotify\".\n\nKey patterns:\n- Read tools are safe to call freely (readOnlyHint=true)\n- _inspect tools take sections (e.g., pica_works_inspect sections: [\"health\", \"completeness\"])\n- Write tools confirm what changed; destructive tools (delete/merge) need two-step confirmation with a token\n- Errors include \"suggestion\" and \"next_tool\" for recovery\n- Enrichment: use resolver tools (pica_resolve_work / pica_resolve_person / pica_resolve_recording) \u2014 fan-out across Spotify, MusicBrainz, MLC, ISNI, Discogs, YouTube; agent picks sources from available identifiers, follows recovery hints\n\nQuery endpoints accept \"limit\" (default 50) and paginate. IDs are UUIDs \u2014 use a _query tool first when unsure.\n\nWrite tools: announce intent, confirm result. Destructive tools: describe impact, require explicit user confirmation.\n\nPeer connectors (email, drive, notes, calendar, DAW MCPs): when PICA shows missing data, check peer MCPs before asking the user. Cite via pica_enrichment_propose sources[].url with URI schemes \u2014 gmail:// gdrive:// notion:// file:// telegram:// calendar:// daw:// user:// web://. See docs/mcp-source-uri-conventions.md.";
|
|
9
9
|
//# sourceMappingURL=server-instructions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../src/server-instructions.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../src/server-instructions.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,m+DAsB+R,CAAC"}
|
|
@@ -6,29 +6,27 @@
|
|
|
6
6
|
* Block playbook: "document the high level of your server"
|
|
7
7
|
* Lowin: "instructions are context — design them as context"
|
|
8
8
|
*/
|
|
9
|
-
export const SERVER_INSTRUCTIONS = `PICA manages music catalog metadata — works, recordings, people, credits, agreements,
|
|
9
|
+
export const SERVER_INSTRUCTIONS = `PICA manages music catalog metadata — works, recordings, people, credits, agreements, rights.
|
|
10
10
|
|
|
11
11
|
Start here:
|
|
12
12
|
- pica_dashboard_briefing — daily summary of what needs attention
|
|
13
13
|
- pica_search_all — find any entity by name, ISWC, ISRC, or IPI
|
|
14
14
|
- pica_works_query / pica_people_query — browse the catalog
|
|
15
15
|
|
|
16
|
+
The catalog is ALWAYS accessible via the tools above — zero setup, no integration required. If pica_integrations_status shows "0 connected" that refers to optional peer connectors (Google/Notion/Airtable/Telegram), NOT the catalog; call pica_works_query to check what's there.
|
|
17
|
+
|
|
18
|
+
Spotify/YouTube URLs: call pica_import_streaming_link (Spotify/Deezer) or pica_import_youtube_link directly. PICA reads these at platform level — there is no per-user Spotify/YouTube OAuth; do not tell the user to "connect Spotify".
|
|
19
|
+
|
|
16
20
|
Key patterns:
|
|
17
|
-
- Read tools are safe to call freely (
|
|
18
|
-
-
|
|
19
|
-
- Write tools (
|
|
20
|
-
-
|
|
21
|
-
-
|
|
21
|
+
- Read tools are safe to call freely (readOnlyHint=true)
|
|
22
|
+
- _inspect tools take sections (e.g., pica_works_inspect sections: ["health", "completeness"])
|
|
23
|
+
- Write tools confirm what changed; destructive tools (delete/merge) need two-step confirmation with a token
|
|
24
|
+
- Errors include "suggestion" and "next_tool" for recovery
|
|
25
|
+
- Enrichment: use resolver tools (pica_resolve_work / pica_resolve_person / pica_resolve_recording) — fan-out across Spotify, MusicBrainz, MLC, ISNI, Discogs, YouTube; agent picks sources from available identifiers, follows recovery hints
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
Use pica_dashboard_attention for items needing action.
|
|
25
|
-
Use pica_works_inspect with sections: ["health", "completeness"] to check data quality.
|
|
26
|
-
Enrichment tools (pica_enrich_work_*) pull from external sources — Spotify, MusicBrainz, MLC, ISNI, Discogs, YouTube.
|
|
27
|
-
The agent orchestrates enrichment — try sources based on available identifiers, follow recovery hints.
|
|
27
|
+
Query endpoints accept "limit" (default 50) and paginate. IDs are UUIDs — use a _query tool first when unsure.
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
IDs are UUIDs. When unsure of an ID, use a _query tool first.
|
|
29
|
+
Write tools: announce intent, confirm result. Destructive tools: describe impact, require explicit user confirmation.
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
When calling destructive tools: describe exactly what will be deleted/merged and get explicit user confirmation before calling.`;
|
|
31
|
+
Peer connectors (email, drive, notes, calendar, DAW MCPs): when PICA shows missing data, check peer MCPs before asking the user. Cite via pica_enrichment_propose sources[].url with URI schemes — gmail:// gdrive:// notion:// file:// telegram:// calendar:// daw:// user:// web://. See docs/mcp-source-uri-conventions.md.`;
|
|
34
32
|
//# sourceMappingURL=server-instructions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../src/server-instructions.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG
|
|
1
|
+
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../src/server-instructions.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;+TAsB4R,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Identity Tools — MCP surface for ADR-185 Parts 1+2.
|
|
3
|
+
*
|
|
4
|
+
* Five session-auth-only tools (Part 1 shipped 1-3, Part 2 adds 4-5):
|
|
5
|
+
* - pica_create_agent_identity
|
|
6
|
+
* - pica_issue_agent_grant
|
|
7
|
+
* - pica_list_my_agent_grants
|
|
8
|
+
* - pica_revoke_agent_grant (Part 2)
|
|
9
|
+
* - pica_get_agent_activity (Part 2)
|
|
10
|
+
*
|
|
11
|
+
* All five route through the PICA HTTP API. The backing routes refuse
|
|
12
|
+
* `pica_grant_` callers with 403 `session_auth_required` per AC 12, so
|
|
13
|
+
* the session-auth-only guarantee is enforced once at the API layer and
|
|
14
|
+
* honoured by both stdio and HTTP MCP transports automatically. The
|
|
15
|
+
* HTTP dispatcher in app/api/mcp/route.ts also rejects at the tool layer
|
|
16
|
+
* via the SESSION_AUTH_ONLY_TOOLS set (belt-and-braces).
|
|
17
|
+
*
|
|
18
|
+
* Subject (user_id) is derived from the auth context — never from tool
|
|
19
|
+
* arguments (ADR-184 rule 1 / ADR-185 rule 1).
|
|
20
|
+
*/
|
|
21
|
+
import { PicaClient } from "@withpica/mcp-sdk";
|
|
22
|
+
import { ToolDefinition, ToolExecutor } from "./index.js";
|
|
23
|
+
export declare class AgentIdentityTools {
|
|
24
|
+
private pica;
|
|
25
|
+
constructor(pica: PicaClient);
|
|
26
|
+
getTools(): Array<{
|
|
27
|
+
definition: ToolDefinition;
|
|
28
|
+
executor: ToolExecutor;
|
|
29
|
+
}>;
|
|
30
|
+
private createIdentity;
|
|
31
|
+
private issueGrant;
|
|
32
|
+
private listMyGrants;
|
|
33
|
+
private revokeGrant;
|
|
34
|
+
private getActivity;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=agent-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-identity.d.ts","sourceRoot":"","sources":["../../src/tools/agent-identity.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAa/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAEtE,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,IAAI,CAAa;gBAEb,IAAI,EAAE,UAAU;IAI5B,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;YAsE3D,cAAc;YAmCd,UAAU;YAsEV,YAAY;YAmCZ,WAAW;YA8BX,WAAW;CAgD1B"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
// Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
import { CREATE_AGENT_IDENTITY_WRITE_PROPERTIES, CREATE_AGENT_IDENTITY_REQUIRED, ISSUE_AGENT_GRANT_WRITE_PROPERTIES, ISSUE_AGENT_GRANT_REQUIRED, LIST_MY_AGENT_GRANTS_WRITE_PROPERTIES, LIST_MY_AGENT_GRANTS_REQUIRED, REVOKE_AGENT_GRANT_WRITE_PROPERTIES, REVOKE_AGENT_GRANT_REQUIRED, GET_AGENT_ACTIVITY_WRITE_PROPERTIES, GET_AGENT_ACTIVITY_REQUIRED, } from "@withpica/mcp-utils";
|
|
3
|
+
export class AgentIdentityTools {
|
|
4
|
+
pica;
|
|
5
|
+
constructor(pica) {
|
|
6
|
+
this.pica = pica;
|
|
7
|
+
}
|
|
8
|
+
getTools() {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
definition: {
|
|
12
|
+
name: "pica_create_agent_identity",
|
|
13
|
+
description: "Create a named agent identity (e.g. 'Claude on laptop') that grants can be issued against. Session-auth only — refused if called with a pica_grant_ token. Subject is the authenticated user; caller-supplied user_id is dropped.",
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: CREATE_AGENT_IDENTITY_WRITE_PROPERTIES,
|
|
17
|
+
required: CREATE_AGENT_IDENTITY_REQUIRED,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
executor: this.createIdentity.bind(this),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
definition: {
|
|
24
|
+
name: "pica_issue_agent_grant",
|
|
25
|
+
description: "Issue a capability grant against an identity you own. Returns a one-time grant_token (format pica_grant_<random>) — save it immediately; it is never shown again. Default expiry 90 days, max 365. Session-auth only.",
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: ISSUE_AGENT_GRANT_WRITE_PROPERTIES,
|
|
29
|
+
required: ISSUE_AGENT_GRANT_REQUIRED,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
executor: this.issueGrant.bind(this),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
definition: {
|
|
36
|
+
name: "pica_list_my_agent_grants",
|
|
37
|
+
description: "List your active agent grants. Returns non-secret fields only — tokens are never re-exposed after issue. Session-auth only.",
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: LIST_MY_AGENT_GRANTS_WRITE_PROPERTIES,
|
|
41
|
+
required: LIST_MY_AGENT_GRANTS_REQUIRED,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
executor: this.listMyGrants.bind(this),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
definition: {
|
|
48
|
+
name: "pica_revoke_agent_grant",
|
|
49
|
+
description: "Revoke one of your agent grants. Idempotent — revoking an already-revoked grant returns the same row. Revocation takes effect on the next request (within 60s). Session-auth only.",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: REVOKE_AGENT_GRANT_WRITE_PROPERTIES,
|
|
53
|
+
required: REVOKE_AGENT_GRANT_REQUIRED,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
executor: this.revokeGrant.bind(this),
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
definition: {
|
|
60
|
+
name: "pica_get_agent_activity",
|
|
61
|
+
description: "List agent_action_log rows whose grant's identity you own — your own provenance-stamped agent writes, sorted newest first. Optionally narrow by agent_identity_id or agent_grant_id. Paginated (default 50, max 500 per call). Session-auth only.",
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: "object",
|
|
64
|
+
properties: GET_AGENT_ACTIVITY_WRITE_PROPERTIES,
|
|
65
|
+
required: GET_AGENT_ACTIVITY_REQUIRED,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
executor: this.getActivity.bind(this),
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
async createIdentity(args) {
|
|
73
|
+
const displayName = typeof args.display_name === "string" ? args.display_name.trim() : "";
|
|
74
|
+
if (!displayName) {
|
|
75
|
+
return {
|
|
76
|
+
content: [{ type: "text", text: "Error: display_name is required." }],
|
|
77
|
+
isError: true,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const clientFingerprint = typeof args.client_fingerprint === "string" &&
|
|
81
|
+
args.client_fingerprint.trim()
|
|
82
|
+
? args.client_fingerprint.trim()
|
|
83
|
+
: null;
|
|
84
|
+
const result = await this.pica.agentIdentity.createIdentity({
|
|
85
|
+
displayName,
|
|
86
|
+
clientFingerprint,
|
|
87
|
+
});
|
|
88
|
+
const data = result?.data ?? result;
|
|
89
|
+
return {
|
|
90
|
+
content: [
|
|
91
|
+
{
|
|
92
|
+
type: "text",
|
|
93
|
+
text: `Agent identity created: "${displayName}" (id: ${data?.id ?? "unknown"}). Issue a grant with pica_issue_agent_grant to start using it.`,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
structuredContent: {
|
|
97
|
+
kind: "pica.card.agent_identity_created",
|
|
98
|
+
version: 1,
|
|
99
|
+
data,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
async issueGrant(args) {
|
|
104
|
+
const agentIdentityId = typeof args.agent_identity_id === "string"
|
|
105
|
+
? args.agent_identity_id.trim()
|
|
106
|
+
: "";
|
|
107
|
+
if (!agentIdentityId) {
|
|
108
|
+
return {
|
|
109
|
+
content: [
|
|
110
|
+
{ type: "text", text: "Error: agent_identity_id is required." },
|
|
111
|
+
],
|
|
112
|
+
isError: true,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (!Array.isArray(args.scopes) || args.scopes.length === 0) {
|
|
116
|
+
return {
|
|
117
|
+
content: [
|
|
118
|
+
{
|
|
119
|
+
type: "text",
|
|
120
|
+
text: "Error: scopes must be a non-empty array of strings.",
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
isError: true,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const scopes = args.scopes.filter((s) => typeof s === "string");
|
|
127
|
+
if (scopes.length !== args.scopes.length) {
|
|
128
|
+
return {
|
|
129
|
+
content: [{ type: "text", text: "Error: scopes must be strings." }],
|
|
130
|
+
isError: true,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const expiresAt = typeof args.expires_at === "string" && args.expires_at.trim()
|
|
134
|
+
? args.expires_at
|
|
135
|
+
: null;
|
|
136
|
+
const result = await this.pica.agentIdentity.issueGrant({
|
|
137
|
+
agentIdentityId,
|
|
138
|
+
scopes,
|
|
139
|
+
expiresAt,
|
|
140
|
+
});
|
|
141
|
+
const data = result?.data ?? result;
|
|
142
|
+
// The plaintext token is in data.grant_token and is shown once.
|
|
143
|
+
// Surface it prominently in the text block so the caller (and
|
|
144
|
+
// through it the user) sees it without having to drill into the
|
|
145
|
+
// structured card.
|
|
146
|
+
return {
|
|
147
|
+
content: [
|
|
148
|
+
{
|
|
149
|
+
type: "text",
|
|
150
|
+
text: `Grant issued (id: ${data?.id ?? "unknown"}). ` +
|
|
151
|
+
`Expires: ${data?.expires_at ?? "n/a"}. ` +
|
|
152
|
+
`Scopes: ${scopes.join(", ")}.\n\n` +
|
|
153
|
+
`grant_token: ${data?.grant_token ?? ""}\n\n` +
|
|
154
|
+
`Save this token now — it will not be shown again. ` +
|
|
155
|
+
`Present it as Authorization: Bearer <token> on MCP requests.`,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
structuredContent: {
|
|
159
|
+
kind: "pica.card.agent_grant_issued",
|
|
160
|
+
version: 1,
|
|
161
|
+
data,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
async listMyGrants(_args) {
|
|
166
|
+
const result = await this.pica.agentIdentity.listMyGrants();
|
|
167
|
+
const data = result?.data ?? result;
|
|
168
|
+
const rows = Array.isArray(data) ? data : [];
|
|
169
|
+
const lines = rows.length
|
|
170
|
+
? rows
|
|
171
|
+
.map((row) => {
|
|
172
|
+
const name = row?.identity?.display_name ?? "unnamed";
|
|
173
|
+
const scopes = Array.isArray(row?.scopes)
|
|
174
|
+
? row.scopes.join(", ")
|
|
175
|
+
: "";
|
|
176
|
+
const expiry = row?.expires_at
|
|
177
|
+
? `expires ${row.expires_at}`
|
|
178
|
+
: "no expiry";
|
|
179
|
+
const revoked = row?.revoked_at ? " [revoked]" : "";
|
|
180
|
+
return `- ${name} (${row?.id ?? "unknown"}): ${scopes}; ${expiry}${revoked}`;
|
|
181
|
+
})
|
|
182
|
+
.join("\n")
|
|
183
|
+
: "(no grants)";
|
|
184
|
+
return {
|
|
185
|
+
content: [
|
|
186
|
+
{
|
|
187
|
+
type: "text",
|
|
188
|
+
text: `Your agent grants (${rows.length}):\n${lines}`,
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
structuredContent: {
|
|
192
|
+
kind: "pica.card.agent_grants_list",
|
|
193
|
+
version: 1,
|
|
194
|
+
data: rows,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
async revokeGrant(args) {
|
|
199
|
+
const grantId = typeof args.grant_id === "string" ? args.grant_id.trim() : "";
|
|
200
|
+
if (!grantId) {
|
|
201
|
+
return {
|
|
202
|
+
content: [{ type: "text", text: "Error: grant_id is required." }],
|
|
203
|
+
isError: true,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
const result = await this.pica.agentIdentity.revokeGrant({ grantId });
|
|
207
|
+
const data = result?.data ?? result;
|
|
208
|
+
return {
|
|
209
|
+
content: [
|
|
210
|
+
{
|
|
211
|
+
type: "text",
|
|
212
|
+
text: `Grant ${data?.id ?? grantId} revoked at ${data?.revoked_at ?? "now"}. ` +
|
|
213
|
+
`The next request using this token will be refused with 401 ` +
|
|
214
|
+
`within 60 seconds.`,
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
structuredContent: {
|
|
218
|
+
kind: "pica.card.agent_grant_revoked",
|
|
219
|
+
version: 1,
|
|
220
|
+
data,
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
async getActivity(args) {
|
|
225
|
+
const agentIdentityId = typeof args.agent_identity_id === "string" &&
|
|
226
|
+
args.agent_identity_id.trim()
|
|
227
|
+
? args.agent_identity_id.trim()
|
|
228
|
+
: null;
|
|
229
|
+
const agentGrantId = typeof args.agent_grant_id === "string" && args.agent_grant_id.trim()
|
|
230
|
+
? args.agent_grant_id.trim()
|
|
231
|
+
: null;
|
|
232
|
+
const limit = typeof args.limit === "number" ? args.limit : undefined;
|
|
233
|
+
const offset = typeof args.offset === "number" ? args.offset : undefined;
|
|
234
|
+
const result = await this.pica.agentIdentity.getActivity({
|
|
235
|
+
agentIdentityId,
|
|
236
|
+
agentGrantId,
|
|
237
|
+
limit,
|
|
238
|
+
offset,
|
|
239
|
+
});
|
|
240
|
+
const data = result?.data ?? result;
|
|
241
|
+
const rows = Array.isArray(data) ? data : [];
|
|
242
|
+
const lines = rows.length
|
|
243
|
+
? rows
|
|
244
|
+
.map((row) => {
|
|
245
|
+
const name = row?.grant?.identity?.display_name ?? "unnamed";
|
|
246
|
+
const action = row?.action ?? "?";
|
|
247
|
+
const table = row?.target_table ?? "?";
|
|
248
|
+
const tool = row?.tool_name ?? "?";
|
|
249
|
+
const when = row?.created_at ?? "";
|
|
250
|
+
return `- ${when} ${name} ${action} ${table} via ${tool}`;
|
|
251
|
+
})
|
|
252
|
+
.join("\n")
|
|
253
|
+
: "(no activity yet — provenance is stamped once Part 3 wraps write tools)";
|
|
254
|
+
return {
|
|
255
|
+
content: [
|
|
256
|
+
{
|
|
257
|
+
type: "text",
|
|
258
|
+
text: `Your agent activity (${rows.length}):\n${lines}`,
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
structuredContent: {
|
|
262
|
+
kind: "pica.card.agent_activity",
|
|
263
|
+
version: 1,
|
|
264
|
+
data: rows,
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=agent-identity.js.map
|