@withpica/mcp-server 2.7.0 → 2.9.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.
Files changed (261) hide show
  1. package/dist/__mocks__/mppx-mcp-sdk-server.d.ts +6 -0
  2. package/dist/__mocks__/mppx-mcp-sdk-server.d.ts.map +1 -0
  3. package/dist/__mocks__/mppx-mcp-sdk-server.js +6 -0
  4. package/dist/__mocks__/mppx-mcp-sdk-server.js.map +1 -0
  5. package/dist/__mocks__/mppx-server.d.ts +12 -0
  6. package/dist/__mocks__/mppx-server.d.ts.map +1 -0
  7. package/dist/__mocks__/mppx-server.js +12 -0
  8. package/dist/__mocks__/mppx-server.js.map +1 -0
  9. package/dist/apps/download.d.ts +2 -0
  10. package/dist/apps/download.d.ts.map +1 -0
  11. package/dist/apps/download.js +125 -0
  12. package/dist/apps/download.js.map +1 -0
  13. package/dist/apps/generated/shared-bundle.d.ts +5 -0
  14. package/dist/apps/generated/shared-bundle.d.ts.map +1 -0
  15. package/dist/apps/generated/shared-bundle.js +7 -0
  16. package/dist/apps/generated/shared-bundle.js.map +1 -0
  17. package/dist/apps/shared.d.ts +15 -0
  18. package/dist/apps/shared.d.ts.map +1 -0
  19. package/dist/apps/shared.js +480 -0
  20. package/dist/apps/shared.js.map +1 -0
  21. package/dist/apps/upload.d.ts +2 -0
  22. package/dist/apps/upload.d.ts.map +1 -0
  23. package/dist/apps/upload.js +280 -0
  24. package/dist/apps/upload.js.map +1 -0
  25. package/dist/config.d.ts +9 -30
  26. package/dist/config.d.ts.map +1 -1
  27. package/dist/config.js +36 -12
  28. package/dist/config.js.map +1 -1
  29. package/dist/index.js +3 -3
  30. package/dist/index.js.map +1 -1
  31. package/dist/prompts/index.js +24 -24
  32. package/dist/prompts/index.js.map +1 -1
  33. package/dist/resources/index.d.ts +4 -2
  34. package/dist/resources/index.d.ts.map +1 -1
  35. package/dist/resources/index.js +133 -54
  36. package/dist/resources/index.js.map +1 -1
  37. package/dist/resources/llms-primer.d.ts +2 -0
  38. package/dist/resources/llms-primer.d.ts.map +1 -0
  39. package/dist/resources/llms-primer.js +68 -0
  40. package/dist/resources/llms-primer.js.map +1 -0
  41. package/dist/server-instructions.d.ts +9 -0
  42. package/dist/server-instructions.d.ts.map +1 -0
  43. package/dist/server-instructions.js +34 -0
  44. package/dist/server-instructions.js.map +1 -0
  45. package/dist/server.d.ts +17 -0
  46. package/dist/server.d.ts.map +1 -1
  47. package/dist/server.js +103 -14
  48. package/dist/server.js.map +1 -1
  49. package/dist/tools/agreement-types.d.ts +27 -0
  50. package/dist/tools/agreement-types.d.ts.map +1 -0
  51. package/dist/tools/agreement-types.js +387 -0
  52. package/dist/tools/agreement-types.js.map +1 -0
  53. package/dist/tools/agreements.d.ts +20 -0
  54. package/dist/tools/agreements.d.ts.map +1 -0
  55. package/dist/tools/agreements.js +363 -0
  56. package/dist/tools/agreements.js.map +1 -0
  57. package/dist/tools/analytics.d.ts +20 -0
  58. package/dist/tools/analytics.d.ts.map +1 -0
  59. package/dist/tools/analytics.js +124 -0
  60. package/dist/tools/analytics.js.map +1 -0
  61. package/dist/tools/app-tools.d.ts +21 -0
  62. package/dist/tools/app-tools.d.ts.map +1 -0
  63. package/dist/tools/app-tools.js +248 -0
  64. package/dist/tools/app-tools.js.map +1 -0
  65. package/dist/tools/assets.d.ts +25 -0
  66. package/dist/tools/assets.d.ts.map +1 -0
  67. package/dist/tools/assets.js +631 -0
  68. package/dist/tools/assets.js.map +1 -0
  69. package/dist/tools/audio-files.d.ts +20 -0
  70. package/dist/tools/audio-files.d.ts.map +1 -0
  71. package/dist/tools/audio-files.js +384 -0
  72. package/dist/tools/audio-files.js.map +1 -0
  73. package/dist/tools/auth.d.ts +22 -0
  74. package/dist/tools/auth.d.ts.map +1 -0
  75. package/dist/tools/auth.js +210 -0
  76. package/dist/tools/auth.js.map +1 -0
  77. package/dist/tools/bulk.d.ts +16 -0
  78. package/dist/tools/bulk.d.ts.map +1 -0
  79. package/dist/tools/bulk.js +85 -0
  80. package/dist/tools/bulk.js.map +1 -0
  81. package/dist/tools/calendar.d.ts +15 -0
  82. package/dist/tools/calendar.d.ts.map +1 -0
  83. package/dist/tools/calendar.js +67 -0
  84. package/dist/tools/calendar.js.map +1 -0
  85. package/dist/tools/collaborators.d.ts +21 -0
  86. package/dist/tools/collaborators.d.ts.map +1 -0
  87. package/dist/tools/collaborators.js +311 -0
  88. package/dist/tools/collaborators.js.map +1 -0
  89. package/dist/tools/comparisons.d.ts +22 -0
  90. package/dist/tools/comparisons.d.ts.map +1 -0
  91. package/dist/tools/comparisons.js +78 -0
  92. package/dist/tools/comparisons.js.map +1 -0
  93. package/dist/tools/credits.d.ts +17 -0
  94. package/dist/tools/credits.d.ts.map +1 -0
  95. package/dist/tools/credits.js +312 -0
  96. package/dist/tools/credits.js.map +1 -0
  97. package/dist/tools/custody-hints.d.ts +16 -0
  98. package/dist/tools/custody-hints.d.ts.map +1 -0
  99. package/dist/tools/custody-hints.js +27 -0
  100. package/dist/tools/custody-hints.js.map +1 -0
  101. package/dist/tools/custody.d.ts +38 -0
  102. package/dist/tools/custody.d.ts.map +1 -0
  103. package/dist/tools/custody.js +274 -0
  104. package/dist/tools/custody.js.map +1 -0
  105. package/dist/tools/dashboard.d.ts +19 -0
  106. package/dist/tools/dashboard.d.ts.map +1 -0
  107. package/dist/tools/dashboard.js +146 -0
  108. package/dist/tools/dashboard.js.map +1 -0
  109. package/dist/tools/directory.d.ts +15 -0
  110. package/dist/tools/directory.d.ts.map +1 -0
  111. package/dist/tools/directory.js +106 -0
  112. package/dist/tools/directory.js.map +1 -0
  113. package/dist/tools/discovery.d.ts +28 -0
  114. package/dist/tools/discovery.d.ts.map +1 -0
  115. package/dist/tools/discovery.js +560 -0
  116. package/dist/tools/discovery.js.map +1 -0
  117. package/dist/tools/disputes.d.ts +18 -0
  118. package/dist/tools/disputes.d.ts.map +1 -0
  119. package/dist/tools/disputes.js +61 -0
  120. package/dist/tools/disputes.js.map +1 -0
  121. package/dist/tools/documents.d.ts +15 -0
  122. package/dist/tools/documents.d.ts.map +1 -0
  123. package/dist/tools/documents.js +36 -0
  124. package/dist/tools/documents.js.map +1 -0
  125. package/dist/tools/duplicates.d.ts +16 -0
  126. package/dist/tools/duplicates.d.ts.map +1 -0
  127. package/dist/tools/duplicates.js +87 -0
  128. package/dist/tools/duplicates.js.map +1 -0
  129. package/dist/tools/enrichment.d.ts +23 -0
  130. package/dist/tools/enrichment.d.ts.map +1 -0
  131. package/dist/tools/enrichment.js +220 -0
  132. package/dist/tools/enrichment.js.map +1 -0
  133. package/dist/tools/exports.d.ts +19 -0
  134. package/dist/tools/exports.d.ts.map +1 -0
  135. package/dist/tools/exports.js +175 -0
  136. package/dist/tools/exports.js.map +1 -0
  137. package/dist/tools/import-documents.d.ts +21 -0
  138. package/dist/tools/import-documents.d.ts.map +1 -0
  139. package/dist/tools/import-documents.js +203 -0
  140. package/dist/tools/import-documents.js.map +1 -0
  141. package/dist/tools/import.d.ts +30 -0
  142. package/dist/tools/import.d.ts.map +1 -0
  143. package/dist/tools/import.js +455 -0
  144. package/dist/tools/import.js.map +1 -0
  145. package/dist/tools/index.d.ts +67 -5
  146. package/dist/tools/index.d.ts.map +1 -1
  147. package/dist/tools/index.js +448 -84
  148. package/dist/tools/index.js.map +1 -1
  149. package/dist/tools/integrations.d.ts +15 -0
  150. package/dist/tools/integrations.d.ts.map +1 -0
  151. package/dist/tools/integrations.js +100 -0
  152. package/dist/tools/integrations.js.map +1 -0
  153. package/dist/tools/licensing.d.ts +40 -0
  154. package/dist/tools/licensing.d.ts.map +1 -0
  155. package/dist/tools/licensing.js +431 -0
  156. package/dist/tools/licensing.js.map +1 -0
  157. package/dist/tools/memory.d.ts +21 -0
  158. package/dist/tools/memory.d.ts.map +1 -0
  159. package/dist/tools/memory.js +116 -0
  160. package/dist/tools/memory.js.map +1 -0
  161. package/dist/tools/metadata.d.ts +15 -0
  162. package/dist/tools/metadata.d.ts.map +1 -0
  163. package/dist/tools/metadata.js +1106 -0
  164. package/dist/tools/metadata.js.map +1 -0
  165. package/dist/tools/multimedia.d.ts +19 -0
  166. package/dist/tools/multimedia.d.ts.map +1 -0
  167. package/dist/tools/multimedia.js +291 -0
  168. package/dist/tools/multimedia.js.map +1 -0
  169. package/dist/tools/notes.d.ts +21 -0
  170. package/dist/tools/notes.d.ts.map +1 -0
  171. package/dist/tools/notes.js +108 -0
  172. package/dist/tools/notes.js.map +1 -0
  173. package/dist/tools/notifications.d.ts +20 -0
  174. package/dist/tools/notifications.d.ts.map +1 -0
  175. package/dist/tools/notifications.js +266 -0
  176. package/dist/tools/notifications.js.map +1 -0
  177. package/dist/tools/people.d.ts +5 -13
  178. package/dist/tools/people.d.ts.map +1 -1
  179. package/dist/tools/people.js +148 -109
  180. package/dist/tools/people.js.map +1 -1
  181. package/dist/tools/projects.d.ts +19 -0
  182. package/dist/tools/projects.d.ts.map +1 -0
  183. package/dist/tools/projects.js +140 -0
  184. package/dist/tools/projects.js.map +1 -0
  185. package/dist/tools/publishers.d.ts +16 -0
  186. package/dist/tools/publishers.d.ts.map +1 -0
  187. package/dist/tools/publishers.js +69 -0
  188. package/dist/tools/publishers.js.map +1 -0
  189. package/dist/tools/purchases.d.ts +15 -0
  190. package/dist/tools/purchases.d.ts.map +1 -0
  191. package/dist/tools/purchases.js +63 -0
  192. package/dist/tools/purchases.js.map +1 -0
  193. package/dist/tools/recordings.d.ts +35 -35
  194. package/dist/tools/recordings.d.ts.map +1 -1
  195. package/dist/tools/recordings.js +136 -48
  196. package/dist/tools/recordings.js.map +1 -1
  197. package/dist/tools/recovery-hints.d.ts +14 -0
  198. package/dist/tools/recovery-hints.d.ts.map +1 -0
  199. package/dist/tools/recovery-hints.js +277 -0
  200. package/dist/tools/recovery-hints.js.map +1 -0
  201. package/dist/tools/releases.d.ts +18 -0
  202. package/dist/tools/releases.d.ts.map +1 -0
  203. package/dist/tools/releases.js +128 -0
  204. package/dist/tools/releases.js.map +1 -0
  205. package/dist/tools/royalties.d.ts +23 -0
  206. package/dist/tools/royalties.d.ts.map +1 -0
  207. package/dist/tools/royalties.js +257 -0
  208. package/dist/tools/royalties.js.map +1 -0
  209. package/dist/tools/search.d.ts +1 -1
  210. package/dist/tools/search.d.ts.map +1 -1
  211. package/dist/tools/search.js +3 -3
  212. package/dist/tools/search.js.map +1 -1
  213. package/dist/tools/send.d.ts +17 -0
  214. package/dist/tools/send.d.ts.map +1 -0
  215. package/dist/tools/send.js +185 -0
  216. package/dist/tools/send.js.map +1 -0
  217. package/dist/tools/sessions.d.ts +18 -0
  218. package/dist/tools/sessions.d.ts.map +1 -0
  219. package/dist/tools/sessions.js +115 -0
  220. package/dist/tools/sessions.js.map +1 -0
  221. package/dist/tools/settings.d.ts +18 -0
  222. package/dist/tools/settings.d.ts.map +1 -0
  223. package/dist/tools/settings.js +96 -0
  224. package/dist/tools/settings.js.map +1 -0
  225. package/dist/tools/share-links.d.ts +19 -0
  226. package/dist/tools/share-links.d.ts.map +1 -0
  227. package/dist/tools/share-links.js +121 -0
  228. package/dist/tools/share-links.js.map +1 -0
  229. package/dist/tools/split-sheets.d.ts +25 -0
  230. package/dist/tools/split-sheets.d.ts.map +1 -0
  231. package/dist/tools/split-sheets.js +307 -0
  232. package/dist/tools/split-sheets.js.map +1 -0
  233. package/dist/tools/team.d.ts +22 -0
  234. package/dist/tools/team.d.ts.map +1 -0
  235. package/dist/tools/team.js +134 -0
  236. package/dist/tools/team.js.map +1 -0
  237. package/dist/tools/telegram.d.ts +21 -0
  238. package/dist/tools/telegram.d.ts.map +1 -0
  239. package/dist/tools/telegram.js +141 -0
  240. package/dist/tools/telegram.js.map +1 -0
  241. package/dist/tools/uploads.d.ts +17 -0
  242. package/dist/tools/uploads.d.ts.map +1 -0
  243. package/dist/tools/uploads.js +156 -0
  244. package/dist/tools/uploads.js.map +1 -0
  245. package/dist/tools/works.d.ts +5 -13
  246. package/dist/tools/works.d.ts.map +1 -1
  247. package/dist/tools/works.js +219 -116
  248. package/dist/tools/works.js.map +1 -1
  249. package/package.json +1 -1
  250. package/dist/pica-sdk.d.ts +0 -1231
  251. package/dist/pica-sdk.d.ts.map +0 -1
  252. package/dist/pica-sdk.js +0 -1403
  253. package/dist/pica-sdk.js.map +0 -1
  254. package/dist/utils/errors.d.ts +0 -29
  255. package/dist/utils/errors.d.ts.map +0 -1
  256. package/dist/utils/errors.js +0 -115
  257. package/dist/utils/errors.js.map +0 -1
  258. package/dist/utils/formatting.d.ts +0 -82
  259. package/dist/utils/formatting.d.ts.map +0 -1
  260. package/dist/utils/formatting.js +0 -125
  261. package/dist/utils/formatting.js.map +0 -1
@@ -1,78 +1,123 @@
1
1
  // Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
2
- import { ResourceError } from "../utils/errors.js";
2
+ import { ResourceError } from "@withpica/mcp-utils";
3
3
  import { readFileSync } from "fs";
4
4
  import { join } from "path";
5
5
  import { WITHPICA_PRIMER } from "./llms-primer.js";
6
+ import { UPLOAD_HTML } from "../apps/upload.js";
7
+ import { DOWNLOAD_HTML } from "../apps/download.js";
8
+ import { PICA_STORAGE_CONNECT_DOMAINS } from "../apps/shared.js";
6
9
  export class ResourceRegistry {
7
10
  pica;
8
- constructor(pica) {
11
+ config;
12
+ constructor(pica, config) {
9
13
  this.pica = pica;
14
+ this.config = config;
10
15
  }
11
16
  /**
12
17
  * List all available resources
13
18
  */
14
19
  listResources() {
15
- return [
20
+ const resources = [
16
21
  {
17
- uri: "llms://primer",
18
- name: "PICA Domain Primer",
19
- description: "Plain-language description of PICA's domain model, entity relationships, and recommended agent workflows. Read this first.",
22
+ uri: "pica://welcome",
23
+ name: "Welcome to PICA",
24
+ description: "Getting started guide how to sign in and what you can do",
20
25
  mimeType: "text/markdown",
21
26
  },
22
- {
23
- uri: "works://list",
24
- name: "All Works",
25
- description: "Complete list of musical works in the catalog",
26
- mimeType: "application/json",
27
- },
28
- {
29
- uri: "people://list",
30
- name: "All People",
31
- description: "Complete list of people (artists, composers, etc.)",
32
- mimeType: "application/json",
33
- },
34
- {
35
- uri: "recordings://list",
36
- name: "All Recordings",
37
- description: "Complete list of recordings",
38
- mimeType: "application/json",
39
- },
40
- {
41
- uri: "catalog://stats",
42
- name: "Catalog Statistics",
43
- description: "Statistics and metrics about the catalog",
44
- mimeType: "application/json",
45
- },
46
- {
47
- uri: "catalog://health",
48
- name: "Catalog Health (PICA Score)",
49
- description: "PICA Score — composite legibility index (0-100) with grade, 4-pillar breakdown, and actionable suggestions",
50
- mimeType: "application/json",
51
- },
52
- {
53
- uri: "workspace://context",
54
- name: "Workspace Context",
55
- description: "Aggregated workspace orientation — org info, catalog stats, health score, and top priorities in one call",
56
- mimeType: "application/json",
57
- },
58
- {
59
- uri: "events://recent",
60
- name: "Recent Events",
61
- description: "Recent webhook delivery events — what happened in this workspace recently",
62
- mimeType: "application/json",
63
- },
64
- {
65
- uri: "api://openapi",
66
- name: "OpenAPI Specification",
67
- description: "OpenAPI 3.1 spec for the top 20 PICA API endpoints — works, people, recordings, agreements, credits, search, health",
68
- mimeType: "text/yaml",
69
- },
70
27
  ];
28
+ if (this.config?.lobbyMode || !this.pica) {
29
+ return resources;
30
+ }
31
+ resources.push({
32
+ uri: "llms://primer",
33
+ name: "PICA Domain Primer",
34
+ description: "Plain-language description of PICA's domain model, entity relationships, and recommended agent workflows. Read this first.",
35
+ mimeType: "text/markdown",
36
+ }, {
37
+ uri: "works://list",
38
+ name: "All Works",
39
+ description: "Complete list of musical works in the catalog",
40
+ mimeType: "application/json",
41
+ }, {
42
+ uri: "people://list",
43
+ name: "All People",
44
+ description: "Complete list of people (artists, composers, etc.)",
45
+ mimeType: "application/json",
46
+ }, {
47
+ uri: "recordings://list",
48
+ name: "All Recordings",
49
+ description: "Complete list of recordings",
50
+ mimeType: "application/json",
51
+ }, {
52
+ uri: "catalog://stats",
53
+ name: "Catalog Statistics",
54
+ description: "Statistics and metrics about the catalog",
55
+ mimeType: "application/json",
56
+ }, {
57
+ uri: "catalog://health",
58
+ name: "Catalog Health (PICA Score)",
59
+ description: "PICA Score — composite legibility index (0-100) with grade, 4-pillar breakdown, and actionable suggestions",
60
+ mimeType: "application/json",
61
+ }, {
62
+ uri: "workspace://context",
63
+ name: "Workspace Context",
64
+ description: "Aggregated workspace orientation — org info, catalog stats, health score, and top priorities in one call",
65
+ mimeType: "application/json",
66
+ }, {
67
+ uri: "events://recent",
68
+ name: "Recent Events",
69
+ description: "Recent webhook delivery events — what happened in this workspace recently",
70
+ mimeType: "application/json",
71
+ }, {
72
+ uri: "api://openapi",
73
+ name: "OpenAPI Specification",
74
+ description: "OpenAPI 3.1 spec for the top 20 PICA API endpoints — works, people, recordings, agreements, credits, search, health",
75
+ mimeType: "text/yaml",
76
+ }, {
77
+ uri: "ui://pica/upload",
78
+ name: "Upload Files",
79
+ description: "Generic file upload card — drop zone for audio, photos, documents, anything",
80
+ mimeType: "text/html;profile=mcp-app",
81
+ }, {
82
+ uri: "ui://pica/download",
83
+ name: "Download File",
84
+ description: "File download card — shows file metadata and a download button",
85
+ mimeType: "text/html;profile=mcp-app",
86
+ });
87
+ return resources;
71
88
  }
72
89
  /**
73
90
  * Read a resource by URI
74
91
  */
75
92
  async readResource(uri) {
93
+ switch (uri) {
94
+ case "pica://welcome":
95
+ return {
96
+ contents: [
97
+ {
98
+ uri: "pica://welcome",
99
+ mimeType: "text/markdown",
100
+ text: "# welcome to PICA\n\n" +
101
+ "PICA manages your music catalog — works, recordings, credits, agreements, and more.\n\n" +
102
+ "## get started\n\n" +
103
+ 'Say **"sign me in"** and provide your email address. ' +
104
+ "You'll receive a magic link — click it, and all tools unlock automatically.\n\n" +
105
+ "No API key needed. No config files. Just talk.\n\n" +
106
+ "## what you can do after signing in\n\n" +
107
+ "- Add and manage works, recordings, and credits\n" +
108
+ "- Enrich metadata from Spotify, MusicBrainz, MLC, and more\n" +
109
+ "- Generate exports (CSV, NRO, CAR reports)\n" +
110
+ "- Track agreements and splits\n" +
111
+ "- Search your catalog and get health reports\n",
112
+ },
113
+ ],
114
+ };
115
+ default:
116
+ break;
117
+ }
118
+ if (!this.pica) {
119
+ throw new ResourceError(`Resource not available in lobby mode: ${uri}`);
120
+ }
76
121
  switch (uri) {
77
122
  case "llms://primer":
78
123
  return {
@@ -100,6 +145,40 @@ export class ResourceRegistry {
100
145
  return await this.getRecentEvents();
101
146
  case "api://openapi":
102
147
  return this.getOpenAPISpec();
148
+ case "ui://pica/upload":
149
+ return {
150
+ contents: [
151
+ {
152
+ uri: "ui://pica/upload",
153
+ mimeType: "text/html;profile=mcp-app",
154
+ text: UPLOAD_HTML,
155
+ _meta: {
156
+ ui: {
157
+ csp: {
158
+ connectDomains: PICA_STORAGE_CONNECT_DOMAINS,
159
+ },
160
+ },
161
+ },
162
+ },
163
+ ],
164
+ };
165
+ case "ui://pica/download":
166
+ return {
167
+ contents: [
168
+ {
169
+ uri: "ui://pica/download",
170
+ mimeType: "text/html;profile=mcp-app",
171
+ text: DOWNLOAD_HTML,
172
+ _meta: {
173
+ ui: {
174
+ csp: {
175
+ connectDomains: PICA_STORAGE_CONNECT_DOMAINS,
176
+ },
177
+ },
178
+ },
179
+ },
180
+ ],
181
+ };
103
182
  default:
104
183
  throw new ResourceError(`Resource not found: ${uri}`);
105
184
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAS7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,IAAI,EAAW,MAAM,MAAM,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAmBnD,MAAM,OAAO,gBAAgB;IACnB,IAAI,CAAa;IAEzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO;YACL;gBAC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E,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;iBACrC;aACF;SACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,gBAAgB;QAC5B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QAE/C,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,GAAG,EAAE,kBAAkB;oBACvB,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;iBACrC;aACF;SACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,mBAAmB;QAC/B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAK,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QAExD,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,GAAG,EAAE,qBAAqB;oBAC1B,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;iBACvC;aACF;SACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,eAAe;QAC3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAK,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAE9D,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,GAAG,EAAE,iBAAiB;oBACtB,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACtC;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +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 pica_enrich_work_spotify/mlc/musicbrainz \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
+ //# sourceMappingURL=llms-primer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llms-primer.d.ts","sourceRoot":"","sources":["../../src/resources/llms-primer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,kpHAiE3B,CAAC"}
@@ -0,0 +1,68 @@
1
+ // Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
2
+ export const WITHPICA_PRIMER = `# PICA — Music Catalog Management Platform
3
+
4
+ PICA helps music creators and publishers manage their catalog metadata,
5
+ track royalties, and prepare works for registration with collection societies.
6
+
7
+ ## Core Entities
8
+
9
+ ### Work
10
+ A musical composition (song, piece, library track). The central entity.
11
+ - Has: title, ISWC, work_type (song/library/demo), genre, mood, BPM, key
12
+ - Relationships: has many credits (writers/composers), has many recordings,
13
+ has many agreements, may have audio files, may have multimedia
14
+ - Identifiers: ISWC (global), Tunecode (PRS), CAE/IPI (writer)
15
+
16
+ ### Person
17
+ A human involved in music — writer, composer, performer, producer, publisher.
18
+ - Has: name, email, IPI number, ISNI, MusicBrainz ID, PRO affiliation
19
+ - Relationships: credited on many works, may have recordings, may have agreements
20
+ - Can be enriched via: ISNI, MusicBrainz, Wikidata
21
+
22
+ ### Recording
23
+ A specific audio capture of a work — the master/sound recording side.
24
+ - Has: title, ISRC, duration, artist, label
25
+ - Relationships: belongs to one work, has credits (performers/producers)
26
+ - Distinct from the work: a work is the composition, a recording is the performance
27
+
28
+ ### Agreement
29
+ A contract governing rights to works — publishing, sync, distribution.
30
+ - Has: title, type, parties, dates, territory, terms
31
+ - Relationships: covers many works
32
+ - Types: publishing_admin, co_publishing, master_recording, sub_publishing,
33
+ admin_only, distribution, library_music, production, artist_contract,
34
+ termination, report, other
35
+
36
+ ### Import Document
37
+ A canonical representation of an ingested file (royalty statement, CSV import).
38
+ - Has: source (16 formats — 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
39
+ - Immutable snapshot of the import event — not a live view
40
+ - Use pica_import_documents_list to find them, pica_import_documents_get to read
41
+
42
+ ## First Connection
43
+
44
+ If you're connecting to this workspace for the first time or don't know where to start,
45
+ invoke the **workspace-autopilot** prompt. It reads the workspace state and routes you
46
+ to the most valuable workflow automatically.
47
+
48
+ ## Recommended Workflows
49
+
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 → pica_enrich_work_spotify/mlc/musicbrainz → pica_works_inspect (verify)
52
+ 3. **Statement reconciliation**: pica_import_documents_query → pica_import_documents_inspect({ sections: ["diff"] })
53
+ 4. **Duplicate cleanup**: pica_find_duplicates → review → pica_merge_duplicates
54
+ 5. **Registration readiness**: pica_works_inspect({ sections: ["registration"] }) → fix gaps → pica_export_song_registration
55
+
56
+ ## Key Concepts
57
+
58
+ - **Organisation**: Multi-tenant — all data scoped to one org. Never cross org boundaries.
59
+ - **PICA Score**: Composite catalog legibility index (0-100, grade A-F). Four pillars:
60
+ identification, documentation, registration, completeness.
61
+ - **Enrichment cascade**: When an identifier is added, external sources
62
+ (MusicBrainz, ISNI, MLC) are queried automatically to fill gaps.
63
+ - **Credits**: Work credits (writers/composers with splits) are distinct from
64
+ recording credits (performers/producers). Different tables, different role enums.
65
+ Work credit roles: writer, composer, arranger, lyricist, producer, performer.
66
+ Recording credit roles: Writer, Composer, Producer, Performer (PascalCase).
67
+ `;
68
+ //# sourceMappingURL=llms-primer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llms-primer.js","sourceRoot":"","sources":["../../src/resources/llms-primer.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiE9B,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Server-level instructions sent to agents on MCP handshake.
3
+ * Keep under 2000 chars — this is context budget, not documentation.
4
+ *
5
+ * Block playbook: "document the high level of your server"
6
+ * Lowin: "instructions are context — design them as context"
7
+ */
8
+ export declare const SERVER_INSTRUCTIONS = "PICA manages music catalog metadata \u2014 works, recordings, people, credits, agreements, and 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\nKey patterns:\n- Read tools are safe to call freely (annotated readOnlyHint=true)\n- Use _inspect tools with sections param for targeted data (e.g., pica_works_inspect with sections: [\"basic\", \"credits\"])\n- Write tools (create/update) confirm what changed after execution\n- Destructive tools (delete/merge) require a two-step confirmation with a token\n- Errors include a \"suggestion\" field with recovery instructions and a \"next_tool\" to try\n\nTool categories: catalog, enrichment, business, discovery, media, comms, settings.\nUse pica_dashboard_attention for items needing action.\nUse pica_works_inspect with sections: [\"health\", \"completeness\"] to check data quality.\nEnrichment tools (pica_enrich_work_*) pull from external sources \u2014 Spotify, MusicBrainz, MLC, ISNI, Discogs, YouTube.\nThe agent orchestrates enrichment \u2014 try sources based on available identifiers, follow recovery hints.\n\nAll query endpoints accept \"limit\" (default 50) and return paginated results.\nIDs are UUIDs. When unsure of an ID, use a _query tool first.\n\nWhen calling write tools: briefly tell the user what you're about to do before calling. After execution, confirm what changed.\nWhen calling destructive tools: describe exactly what will be deleted/merged and get explicit user confirmation before calling.";
9
+ //# sourceMappingURL=server-instructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../src/server-instructions.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,2nDAwBgG,CAAC"}
@@ -0,0 +1,34 @@
1
+ // Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
2
+ /**
3
+ * Server-level instructions sent to agents on MCP handshake.
4
+ * Keep under 2000 chars — this is context budget, not documentation.
5
+ *
6
+ * Block playbook: "document the high level of your server"
7
+ * Lowin: "instructions are context — design them as context"
8
+ */
9
+ export const SERVER_INSTRUCTIONS = `PICA manages music catalog metadata — works, recordings, people, credits, agreements, and rights.
10
+
11
+ Start here:
12
+ - pica_dashboard_briefing — daily summary of what needs attention
13
+ - pica_search_all — find any entity by name, ISWC, ISRC, or IPI
14
+ - pica_works_query / pica_people_query — browse the catalog
15
+
16
+ Key patterns:
17
+ - Read tools are safe to call freely (annotated readOnlyHint=true)
18
+ - Use _inspect tools with sections param for targeted data (e.g., pica_works_inspect with sections: ["basic", "credits"])
19
+ - Write tools (create/update) confirm what changed after execution
20
+ - Destructive tools (delete/merge) require a two-step confirmation with a token
21
+ - Errors include a "suggestion" field with recovery instructions and a "next_tool" to try
22
+
23
+ Tool categories: catalog, enrichment, business, discovery, media, comms, settings.
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.
28
+
29
+ All query endpoints accept "limit" (default 50) and return paginated results.
30
+ IDs are UUIDs. When unsure of an ID, use a _query tool first.
31
+
32
+ When calling write tools: briefly tell the user what you're about to do before calling. After execution, confirm what changed.
33
+ When calling destructive tools: describe exactly what will be deleted/merged and get explicit user confirmation before calling.`;
34
+ //# sourceMappingURL=server-instructions.js.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;gIAwB6F,CAAC"}
package/dist/server.d.ts CHANGED
@@ -8,6 +8,23 @@ export declare class PicaMcpServer {
8
8
  private config;
9
9
  private httpServer?;
10
10
  constructor(config: ServerConfig);
11
+ /**
12
+ * Reinitialize server with new credentials (called after successful auth)
13
+ */
14
+ reinitialize(apiKey: string): void;
15
+ /**
16
+ * Reset the server back to lobby mode (called after sign_out).
17
+ * Mirrors reinitialize() but in reverse: clears the PicaClient,
18
+ * sets lobbyMode=true, and rebuilds the tool/resource registries so
19
+ * the next tools/list call returns only [pica_sign_in, pica_sign_out].
20
+ *
21
+ * Without this the server would keep advertising the full authenticated
22
+ * tool surface after sign_out until the process is restarted, which
23
+ * lies about what's actually available — every privileged tool call
24
+ * would still fail at the API layer (no PicaClient), but the surface
25
+ * itself shouldn't pretend the catalog is reachable.
26
+ */
27
+ signOut(): void;
11
28
  /**
12
29
  * Set up MCP protocol handlers on the main server instance (for stdio)
13
30
  */
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,UAAU,CAAC,CAAkC;gBAEzC,MAAM,EAAE,YAAY;IAiChC;;OAEG;IACH,OAAO,CAAC,aAAa;IAIrB;;;;;;OAMG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAkBd,UAAU;YAKV,SAAS;IAwHvB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA6CxB;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAS5B"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAY3C,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAoB;IAChC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,UAAU,CAAC,CAAkC;gBAEzC,MAAM,EAAE,YAAY;IA4DhC;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAgDlC;;;;;;;;;;;OAWG;IACH,OAAO,IAAI,IAAI;IAqCf;;OAEG;IACH,OAAO,CAAC,aAAa;IAIrB;;;;;;OAMG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAqBd,UAAU;YAKV,SAAS;IA6HvB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA6CxB;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAS5B"}
package/dist/server.js CHANGED
@@ -8,11 +8,14 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
8
8
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
9
9
  import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
10
10
  import { createServer } from "node:http";
11
- import { PicaClient } from "./pica-sdk.js";
11
+ import { timingSafeEqual } from "node:crypto";
12
+ import { PicaClient } from "@withpica/mcp-sdk";
12
13
  import { ToolRegistry } from "./tools/index.js";
13
14
  import { ResourceRegistry } from "./resources/index.js";
14
15
  import { PromptRegistry } from "./prompts/index.js";
15
- import { logError } from "./utils/errors.js";
16
+ import { logError } from "@withpica/mcp-utils";
17
+ import { makeStdioCallerContext, makeHttpAuditFn, McpAuditLogger, } from "@withpica/mcp-utils";
18
+ import { SERVER_INSTRUCTIONS } from "./server-instructions.js";
16
19
  export class PicaMcpServer {
17
20
  server;
18
21
  pica;
@@ -23,29 +26,110 @@ export class PicaMcpServer {
23
26
  httpServer;
24
27
  constructor(config) {
25
28
  this.config = config;
26
- // Initialize PICA SDK client
27
- this.pica = new PicaClient({
28
- apiKey: config.picaApiKey,
29
- baseUrl: config.picaApiUrl,
30
- debug: config.debug,
31
- });
29
+ // Initialize PICA SDK client (null in lobby mode)
30
+ if (config.picaApiKey) {
31
+ this.pica = new PicaClient({
32
+ apiKey: config.picaApiKey,
33
+ baseUrl: config.picaApiUrl,
34
+ debug: config.debug,
35
+ });
36
+ }
37
+ else {
38
+ this.pica = null;
39
+ }
32
40
  // Initialize MCP server
33
41
  this.server = new Server({
34
42
  name: config.serverName,
35
43
  version: config.version,
36
44
  }, {
37
45
  capabilities: {
38
- tools: {},
39
- resources: {},
46
+ // listChanged: true on tools + resources tells the client we
47
+ // may emit `notifications/tools/list_changed` and
48
+ // `notifications/resources/list_changed` after sign-in or
49
+ // sign-out hot-swaps the registries. Without this declaration
50
+ // the client won't subscribe to those notifications, and the
51
+ // tool surface stays frozen at the lobby pair forever.
52
+ tools: { listChanged: true },
53
+ resources: { listChanged: true },
40
54
  prompts: {},
41
55
  },
56
+ instructions: SERVER_INSTRUCTIONS,
42
57
  });
43
- // Initialize registries
44
- this.toolRegistry = new ToolRegistry(this.pica);
45
- this.resourceRegistry = new ResourceRegistry(this.pica);
58
+ // Initialize registries with stdio caller context (api key hash)
59
+ this.toolRegistry = new ToolRegistry(this.pica, config, (apiKey) => this.reinitialize(apiKey), makeStdioCallerContext(config.picaApiKey), () => this.signOut());
60
+ this.resourceRegistry = new ResourceRegistry(this.pica, config);
46
61
  this.promptRegistry = new PromptRegistry();
62
+ // Wire audit logger — fire-and-forget POST to /api/mcp/audit
63
+ this.toolRegistry.setAuditLogger(new McpAuditLogger(makeHttpAuditFn({
64
+ baseUrl: config.picaApiUrl,
65
+ apiKey: config.picaApiKey,
66
+ })));
47
67
  this.setupHandlers();
48
68
  }
69
+ /**
70
+ * Reinitialize server with new credentials (called after successful auth)
71
+ */
72
+ reinitialize(apiKey) {
73
+ this.pica = new PicaClient({
74
+ apiKey,
75
+ baseUrl: this.config.picaApiUrl,
76
+ debug: this.config.debug,
77
+ });
78
+ this.config = { ...this.config, picaApiKey: apiKey, lobbyMode: false };
79
+ this.toolRegistry = new ToolRegistry(this.pica, this.config, (key) => this.reinitialize(key), makeStdioCallerContext(apiKey), () => this.signOut());
80
+ this.toolRegistry.setAuditLogger(new McpAuditLogger(makeHttpAuditFn({ baseUrl: this.config.picaApiUrl, apiKey })));
81
+ this.resourceRegistry = new ResourceRegistry(this.pica, this.config);
82
+ console.error("[MCP Server] Reinitialized with new credentials");
83
+ // Tell the client the tool + resource lists have changed so it
84
+ // re-fetches and discovers the full authenticated surface. Without
85
+ // these notifications the client keeps showing the lobby pair
86
+ // (sign_in/sign_out) even though sign-in succeeded — the in-memory
87
+ // registries on the server know about the 168 catalog tools but
88
+ // the client never asks for them again.
89
+ //
90
+ // Fire-and-forget: a failure to notify is a soft error (the user
91
+ // can manually trigger another tool call which will work since the
92
+ // server's internal state is correct), so we log and continue
93
+ // rather than throwing inside the callback path that just rebuilt
94
+ // the registries.
95
+ this.server.sendToolListChanged().catch((err) => {
96
+ console.error("[MCP Server] Failed to send tools/list_changed notification:", err);
97
+ });
98
+ this.server.sendResourceListChanged().catch((err) => {
99
+ console.error("[MCP Server] Failed to send resources/list_changed notification:", err);
100
+ });
101
+ }
102
+ /**
103
+ * Reset the server back to lobby mode (called after sign_out).
104
+ * Mirrors reinitialize() but in reverse: clears the PicaClient,
105
+ * sets lobbyMode=true, and rebuilds the tool/resource registries so
106
+ * the next tools/list call returns only [pica_sign_in, pica_sign_out].
107
+ *
108
+ * Without this the server would keep advertising the full authenticated
109
+ * tool surface after sign_out until the process is restarted, which
110
+ * lies about what's actually available — every privileged tool call
111
+ * would still fail at the API layer (no PicaClient), but the surface
112
+ * itself shouldn't pretend the catalog is reachable.
113
+ */
114
+ signOut() {
115
+ this.pica = null;
116
+ this.config = { ...this.config, picaApiKey: "", lobbyMode: true };
117
+ this.toolRegistry = new ToolRegistry(this.pica, this.config, (key) => this.reinitialize(key), makeStdioCallerContext(""), () => this.signOut());
118
+ this.toolRegistry.setAuditLogger(new McpAuditLogger(makeHttpAuditFn({ baseUrl: this.config.picaApiUrl, apiKey: "" })));
119
+ this.resourceRegistry = new ResourceRegistry(this.pica, this.config);
120
+ console.error("[MCP Server] Reset to lobby mode after sign_out");
121
+ // Same listChanged story as reinitialize() — without these the
122
+ // client keeps advertising the full authenticated surface to the
123
+ // model after sign-out, and any tool call would fail at the API
124
+ // layer with a confusing "no credentials" error instead of the
125
+ // model saying "you need to sign in first."
126
+ this.server.sendToolListChanged().catch((err) => {
127
+ console.error("[MCP Server] Failed to send tools/list_changed notification (signOut):", err);
128
+ });
129
+ this.server.sendResourceListChanged().catch((err) => {
130
+ console.error("[MCP Server] Failed to send resources/list_changed notification (signOut):", err);
131
+ });
132
+ }
49
133
  /**
50
134
  * Set up MCP protocol handlers on the main server instance (for stdio)
51
135
  */
@@ -70,6 +154,7 @@ export class PicaMcpServer {
70
154
  console.error("[MCP Server] PICA MCP Server started");
71
155
  console.error(`[MCP Server] Version: ${this.config.version}`);
72
156
  console.error(`[MCP Server] Transport: ${mode === "http" ? "HTTP" : "stdio"}`);
157
+ console.error(`[MCP Server] Mode: ${this.config.lobbyMode ? "lobby (sign in to connect)" : "authenticated"}`);
73
158
  console.error(`[MCP Server] API URL: ${this.config.picaApiUrl}`);
74
159
  console.error("[MCP Server] Ready to accept connections");
75
160
  }
@@ -98,7 +183,11 @@ export class PicaMcpServer {
98
183
  const token = authHeader.startsWith("Bearer ")
99
184
  ? authHeader.slice(7)
100
185
  : "";
101
- if (token !== httpSecret) {
186
+ const tokenBuf = Buffer.from(token);
187
+ const secretBuf = Buffer.from(httpSecret);
188
+ const isValid = tokenBuf.length === secretBuf.length &&
189
+ timingSafeEqual(tokenBuf, secretBuf);
190
+ if (!isValid) {
102
191
  res.writeHead(401, { "Content-Type": "application/json" });
103
192
  res.end(JSON.stringify({ error: "Unauthorized" }));
104
193
  return;