@withpica/mcp-server 2.5.2 → 2.6.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 (275) hide show
  1. package/assets/fonts/GeistSans-Light.woff2 +0 -0
  2. package/assets/fonts/InstrumentSerif-Italic.woff2 +0 -0
  3. package/assets/fonts/InstrumentSerif-Regular.woff2 +0 -0
  4. package/dist/apps/download.d.ts +2 -0
  5. package/dist/apps/download.d.ts.map +1 -0
  6. package/dist/apps/download.js +125 -0
  7. package/dist/apps/download.js.map +1 -0
  8. package/dist/apps/generated/shared-bundle.d.ts +5 -0
  9. package/dist/apps/generated/shared-bundle.d.ts.map +1 -0
  10. package/dist/apps/generated/shared-bundle.js +7 -0
  11. package/dist/apps/generated/shared-bundle.js.map +1 -0
  12. package/dist/apps/shared.d.ts +15 -0
  13. package/dist/apps/shared.d.ts.map +1 -0
  14. package/dist/apps/shared.js +480 -0
  15. package/dist/apps/shared.js.map +1 -0
  16. package/dist/apps/upload.d.ts +2 -0
  17. package/dist/apps/upload.d.ts.map +1 -0
  18. package/dist/apps/upload.js +280 -0
  19. package/dist/apps/upload.js.map +1 -0
  20. package/dist/config.d.ts +4 -25
  21. package/dist/config.d.ts.map +1 -1
  22. package/dist/config.js +30 -12
  23. package/dist/config.js.map +1 -1
  24. package/dist/index.js +3 -3
  25. package/dist/index.js.map +1 -1
  26. package/dist/prompts/index.js +24 -24
  27. package/dist/prompts/index.js.map +1 -1
  28. package/dist/resources/index.d.ts +4 -2
  29. package/dist/resources/index.d.ts.map +1 -1
  30. package/dist/resources/index.js +133 -54
  31. package/dist/resources/index.js.map +1 -1
  32. package/dist/resources/llms-primer.d.ts +1 -1
  33. package/dist/resources/llms-primer.d.ts.map +1 -1
  34. package/dist/resources/llms-primer.js +4 -4
  35. package/dist/server-instructions.d.ts +9 -0
  36. package/dist/server-instructions.d.ts.map +1 -0
  37. package/dist/server-instructions.js +34 -0
  38. package/dist/server-instructions.js.map +1 -0
  39. package/dist/server.d.ts +4 -0
  40. package/dist/server.d.ts.map +1 -1
  41. package/dist/server.js +46 -12
  42. package/dist/server.js.map +1 -1
  43. package/dist/tools/agreement-types.d.ts +10 -20
  44. package/dist/tools/agreement-types.d.ts.map +1 -1
  45. package/dist/tools/agreement-types.js +203 -419
  46. package/dist/tools/agreement-types.js.map +1 -1
  47. package/dist/tools/agreements.d.ts +3 -4
  48. package/dist/tools/agreements.d.ts.map +1 -1
  49. package/dist/tools/agreements.js +72 -52
  50. package/dist/tools/agreements.js.map +1 -1
  51. package/dist/tools/analytics.d.ts +1 -1
  52. package/dist/tools/analytics.d.ts.map +1 -1
  53. package/dist/tools/analytics.js +1 -1
  54. package/dist/tools/analytics.js.map +1 -1
  55. package/dist/tools/app-tools.d.ts +21 -0
  56. package/dist/tools/app-tools.d.ts.map +1 -0
  57. package/dist/tools/app-tools.js +248 -0
  58. package/dist/tools/app-tools.js.map +1 -0
  59. package/dist/tools/assets.d.ts +2 -4
  60. package/dist/tools/assets.d.ts.map +1 -1
  61. package/dist/tools/assets.js +278 -59
  62. package/dist/tools/assets.js.map +1 -1
  63. package/dist/tools/audio-files.d.ts +3 -4
  64. package/dist/tools/audio-files.d.ts.map +1 -1
  65. package/dist/tools/audio-files.js +63 -35
  66. package/dist/tools/audio-files.js.map +1 -1
  67. package/dist/tools/auth.d.ts +20 -0
  68. package/dist/tools/auth.d.ts.map +1 -0
  69. package/dist/tools/auth.js +200 -0
  70. package/dist/tools/auth.js.map +1 -0
  71. package/dist/tools/bulk.d.ts +1 -1
  72. package/dist/tools/bulk.d.ts.map +1 -1
  73. package/dist/tools/bulk.js +1 -1
  74. package/dist/tools/bulk.js.map +1 -1
  75. package/dist/tools/calendar.d.ts +1 -1
  76. package/dist/tools/calendar.d.ts.map +1 -1
  77. package/dist/tools/calendar.js +1 -1
  78. package/dist/tools/calendar.js.map +1 -1
  79. package/dist/tools/collaborators.d.ts +1 -1
  80. package/dist/tools/collaborators.d.ts.map +1 -1
  81. package/dist/tools/collaborators.js +2 -2
  82. package/dist/tools/collaborators.js.map +1 -1
  83. package/dist/tools/comparisons.d.ts +1 -1
  84. package/dist/tools/comparisons.d.ts.map +1 -1
  85. package/dist/tools/comparisons.js +1 -1
  86. package/dist/tools/comparisons.js.map +1 -1
  87. package/dist/tools/credits.d.ts +1 -1
  88. package/dist/tools/credits.d.ts.map +1 -1
  89. package/dist/tools/credits.js +130 -20
  90. package/dist/tools/credits.js.map +1 -1
  91. package/dist/tools/dashboard.d.ts +2 -3
  92. package/dist/tools/dashboard.d.ts.map +1 -1
  93. package/dist/tools/dashboard.js +20 -28
  94. package/dist/tools/dashboard.js.map +1 -1
  95. package/dist/tools/directory.d.ts +1 -1
  96. package/dist/tools/directory.d.ts.map +1 -1
  97. package/dist/tools/directory.js +1 -1
  98. package/dist/tools/directory.js.map +1 -1
  99. package/dist/tools/discovery.d.ts +28 -0
  100. package/dist/tools/discovery.d.ts.map +1 -0
  101. package/dist/tools/discovery.js +560 -0
  102. package/dist/tools/discovery.js.map +1 -0
  103. package/dist/tools/disputes.d.ts +1 -1
  104. package/dist/tools/disputes.d.ts.map +1 -1
  105. package/dist/tools/disputes.js +1 -1
  106. package/dist/tools/disputes.js.map +1 -1
  107. package/dist/tools/documents.d.ts +1 -1
  108. package/dist/tools/documents.d.ts.map +1 -1
  109. package/dist/tools/documents.js +1 -1
  110. package/dist/tools/documents.js.map +1 -1
  111. package/dist/tools/duplicates.d.ts +1 -1
  112. package/dist/tools/duplicates.d.ts.map +1 -1
  113. package/dist/tools/duplicates.js +18 -1
  114. package/dist/tools/duplicates.js.map +1 -1
  115. package/dist/tools/enrichment.d.ts +1 -4
  116. package/dist/tools/enrichment.d.ts.map +1 -1
  117. package/dist/tools/enrichment.js +19 -122
  118. package/dist/tools/enrichment.js.map +1 -1
  119. package/dist/tools/exports.d.ts +1 -1
  120. package/dist/tools/exports.d.ts.map +1 -1
  121. package/dist/tools/exports.js +2 -2
  122. package/dist/tools/exports.js.map +1 -1
  123. package/dist/tools/import-documents.d.ts +4 -4
  124. package/dist/tools/import-documents.d.ts.map +1 -1
  125. package/dist/tools/import-documents.js +65 -51
  126. package/dist/tools/import-documents.js.map +1 -1
  127. package/dist/tools/import.d.ts +2 -1
  128. package/dist/tools/import.d.ts.map +1 -1
  129. package/dist/tools/import.js +64 -2
  130. package/dist/tools/import.js.map +1 -1
  131. package/dist/tools/index.d.ts +50 -5
  132. package/dist/tools/index.d.ts.map +1 -1
  133. package/dist/tools/index.js +440 -84
  134. package/dist/tools/index.js.map +1 -1
  135. package/dist/tools/integrations.d.ts +1 -1
  136. package/dist/tools/integrations.d.ts.map +1 -1
  137. package/dist/tools/integrations.js +1 -1
  138. package/dist/tools/integrations.js.map +1 -1
  139. package/dist/tools/licensing.d.ts +1 -1
  140. package/dist/tools/licensing.d.ts.map +1 -1
  141. package/dist/tools/licensing.js +1 -1
  142. package/dist/tools/licensing.js.map +1 -1
  143. package/dist/tools/memory.d.ts +1 -1
  144. package/dist/tools/memory.d.ts.map +1 -1
  145. package/dist/tools/memory.js +1 -1
  146. package/dist/tools/memory.js.map +1 -1
  147. package/dist/tools/metadata.d.ts +15 -0
  148. package/dist/tools/metadata.d.ts.map +1 -0
  149. package/dist/tools/metadata.js +1069 -0
  150. package/dist/tools/metadata.js.map +1 -0
  151. package/dist/tools/multimedia.d.ts +1 -1
  152. package/dist/tools/multimedia.d.ts.map +1 -1
  153. package/dist/tools/multimedia.js +1 -1
  154. package/dist/tools/multimedia.js.map +1 -1
  155. package/dist/tools/notes.d.ts +1 -1
  156. package/dist/tools/notes.d.ts.map +1 -1
  157. package/dist/tools/notes.js +1 -1
  158. package/dist/tools/notes.js.map +1 -1
  159. package/dist/tools/notifications.d.ts +1 -1
  160. package/dist/tools/notifications.d.ts.map +1 -1
  161. package/dist/tools/notifications.js +1 -1
  162. package/dist/tools/notifications.js.map +1 -1
  163. package/dist/tools/people.d.ts +5 -13
  164. package/dist/tools/people.d.ts.map +1 -1
  165. package/dist/tools/people.js +148 -109
  166. package/dist/tools/people.js.map +1 -1
  167. package/dist/tools/projects.d.ts +1 -1
  168. package/dist/tools/projects.d.ts.map +1 -1
  169. package/dist/tools/projects.js +1 -1
  170. package/dist/tools/projects.js.map +1 -1
  171. package/dist/tools/publishers.d.ts +16 -0
  172. package/dist/tools/publishers.d.ts.map +1 -0
  173. package/dist/tools/publishers.js +69 -0
  174. package/dist/tools/publishers.js.map +1 -0
  175. package/dist/tools/purchases.d.ts +1 -1
  176. package/dist/tools/purchases.d.ts.map +1 -1
  177. package/dist/tools/purchases.js +1 -1
  178. package/dist/tools/purchases.js.map +1 -1
  179. package/dist/tools/recordings.d.ts +9 -9
  180. package/dist/tools/recordings.d.ts.map +1 -1
  181. package/dist/tools/recordings.js +121 -48
  182. package/dist/tools/recordings.js.map +1 -1
  183. package/dist/tools/recovery-hints.d.ts +14 -0
  184. package/dist/tools/recovery-hints.d.ts.map +1 -0
  185. package/dist/tools/recovery-hints.js +277 -0
  186. package/dist/tools/recovery-hints.js.map +1 -0
  187. package/dist/tools/releases.d.ts +1 -1
  188. package/dist/tools/releases.d.ts.map +1 -1
  189. package/dist/tools/releases.js +1 -1
  190. package/dist/tools/releases.js.map +1 -1
  191. package/dist/tools/royalties.d.ts +1 -1
  192. package/dist/tools/royalties.d.ts.map +1 -1
  193. package/dist/tools/royalties.js +2 -2
  194. package/dist/tools/royalties.js.map +1 -1
  195. package/dist/tools/search.d.ts +1 -1
  196. package/dist/tools/search.d.ts.map +1 -1
  197. package/dist/tools/search.js +3 -3
  198. package/dist/tools/search.js.map +1 -1
  199. package/dist/tools/send.d.ts +2 -3
  200. package/dist/tools/send.d.ts.map +1 -1
  201. package/dist/tools/send.js +20 -28
  202. package/dist/tools/send.js.map +1 -1
  203. package/dist/tools/sessions.d.ts +1 -1
  204. package/dist/tools/sessions.d.ts.map +1 -1
  205. package/dist/tools/sessions.js +1 -1
  206. package/dist/tools/sessions.js.map +1 -1
  207. package/dist/tools/settings.d.ts +1 -1
  208. package/dist/tools/settings.d.ts.map +1 -1
  209. package/dist/tools/settings.js +1 -1
  210. package/dist/tools/settings.js.map +1 -1
  211. package/dist/tools/share-links.d.ts +1 -1
  212. package/dist/tools/share-links.d.ts.map +1 -1
  213. package/dist/tools/share-links.js +1 -1
  214. package/dist/tools/share-links.js.map +1 -1
  215. package/dist/tools/split-sheets.d.ts +1 -1
  216. package/dist/tools/split-sheets.d.ts.map +1 -1
  217. package/dist/tools/split-sheets.js +13 -1
  218. package/dist/tools/split-sheets.js.map +1 -1
  219. package/dist/tools/team.d.ts +1 -1
  220. package/dist/tools/team.d.ts.map +1 -1
  221. package/dist/tools/team.js +1 -1
  222. package/dist/tools/team.js.map +1 -1
  223. package/dist/tools/telegram.d.ts +1 -1
  224. package/dist/tools/telegram.d.ts.map +1 -1
  225. package/dist/tools/telegram.js +1 -1
  226. package/dist/tools/telegram.js.map +1 -1
  227. package/dist/tools/uploads.d.ts +1 -1
  228. package/dist/tools/uploads.d.ts.map +1 -1
  229. package/dist/tools/uploads.js +1 -1
  230. package/dist/tools/uploads.js.map +1 -1
  231. package/dist/tools/works.d.ts +5 -13
  232. package/dist/tools/works.d.ts.map +1 -1
  233. package/dist/tools/works.js +201 -116
  234. package/dist/tools/works.js.map +1 -1
  235. package/package.json +5 -1
  236. package/scripts/bundle-apps.ts +61 -0
  237. package/.mcpregistry_github_token +0 -1
  238. package/.mcpregistry_registry_token +0 -1
  239. package/dist/pica-sdk.d.ts +0 -1170
  240. package/dist/pica-sdk.d.ts.map +0 -1
  241. package/dist/pica-sdk.js +0 -1403
  242. package/dist/pica-sdk.js.map +0 -1
  243. package/dist/tools/health.d.ts +0 -17
  244. package/dist/tools/health.d.ts.map +0 -1
  245. package/dist/tools/health.js +0 -67
  246. package/dist/tools/health.js.map +0 -1
  247. package/dist/tools/pica-score.d.ts +0 -15
  248. package/dist/tools/pica-score.d.ts.map +0 -1
  249. package/dist/tools/pica-score.js +0 -28
  250. package/dist/tools/pica-score.js.map +0 -1
  251. package/dist/tools/registration.d.ts +0 -16
  252. package/dist/tools/registration.d.ts.map +0 -1
  253. package/dist/tools/registration.js +0 -50
  254. package/dist/tools/registration.js.map +0 -1
  255. package/dist/utils/credit-gate.d.ts +0 -17
  256. package/dist/utils/credit-gate.d.ts.map +0 -1
  257. package/dist/utils/credit-gate.js +0 -100
  258. package/dist/utils/credit-gate.js.map +0 -1
  259. package/dist/utils/errors.d.ts +0 -29
  260. package/dist/utils/errors.d.ts.map +0 -1
  261. package/dist/utils/errors.js +0 -115
  262. package/dist/utils/errors.js.map +0 -1
  263. package/dist/utils/formatting.d.ts +0 -63
  264. package/dist/utils/formatting.d.ts.map +0 -1
  265. package/dist/utils/formatting.js +0 -125
  266. package/dist/utils/formatting.js.map +0 -1
  267. package/dist/utils/mpp.d.ts +0 -63
  268. package/dist/utils/mpp.d.ts.map +0 -1
  269. package/dist/utils/mpp.js +0 -137
  270. package/dist/utils/mpp.js.map +0 -1
  271. package/dist/utils/notify-parties.d.ts +0 -35
  272. package/dist/utils/notify-parties.d.ts.map +0 -1
  273. package/dist/utils/notify-parties.js +0 -59
  274. package/dist/utils/notify-parties.js.map +0 -1
  275. package/server.json +0 -30
@@ -1,63 +0,0 @@
1
- /**
2
- * Response formatting utilities
3
- *
4
- * All formatters return FormattedResult — both human-readable text content
5
- * AND a structuredContent object for machine parsing (ADR-104 §1.2).
6
- */
7
- export interface FormattedResult {
8
- content: Array<{
9
- type: string;
10
- text: string;
11
- }>;
12
- structuredContent?: Record<string, unknown>;
13
- }
14
- /**
15
- * Format data as JSON text for MCP response
16
- */
17
- export declare function formatAsText(data: any): FormattedResult;
18
- /**
19
- * Completion hint — tells the LLM what's missing on entities just touched.
20
- * The LLM decides whether and how to surface these to the user.
21
- */
22
- export interface CompletionHint {
23
- gap: string;
24
- suggestion: string;
25
- count?: number;
26
- severity?: "critical" | "important" | "nice_to_have";
27
- }
28
- /**
29
- * Format success message, with optional completion hints for the guided loop.
30
- *
31
- * Completion hints are structured data appended to the response so the LLM
32
- * can naturally suggest the next step without PICA dictating the conversation.
33
- * If no hints are provided, the response is identical to the old format.
34
- */
35
- export declare function formatSuccess(message: string, data?: any, completionHints?: CompletionHint[]): FormattedResult;
36
- /**
37
- * Map raw gap objects from the completeness API into CompletionHints.
38
- * The API response shape varies — this handles the known field names.
39
- */
40
- export declare function mapGapsToHints(gaps: any[], limit?: number): CompletionHint[];
41
- /**
42
- * Format array of items with count
43
- */
44
- export declare function formatList<T>(items: T[], metadata?: Record<string, any>): FormattedResult;
45
- /**
46
- * Truncate text to max length
47
- */
48
- export declare function truncate(text: string, maxLength?: number): string;
49
- /**
50
- * Format validation error
51
- */
52
- export declare function formatValidationError(fields: Record<string, string>): FormattedResult;
53
- /**
54
- * Format structured response with dual content blocks:
55
- * - Human-readable text (includes full JSON so all MCP clients can read it)
56
- * - Machine-parseable structuredContent object
57
- */
58
- export declare function formatStructured(data: any, summary?: string): FormattedResult;
59
- /**
60
- * Format a list with both human summary and structured JSON
61
- */
62
- export declare function formatStructuredList<T>(items: T[], entityName: string, metadata?: Record<string, any>): FormattedResult;
63
- //# sourceMappingURL=formatting.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src/utils/formatting.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,eAAe,CAKvD;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,cAAc,CAAC;CACtD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,GAAG,EACV,eAAe,CAAC,EAAE,cAAc,EAAE,GACjC,eAAe,CA0BjB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,GAAG,EAAE,EACX,KAAK,GAAE,MAAU,GAChB,cAAc,EAAE,CAOlB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,KAAK,EAAE,CAAC,EAAE,EACV,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC7B,eAAe,CAsBjB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAa,GAAG,MAAM,CAKvE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,eAAe,CAWjB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,CAW7E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,KAAK,EAAE,CAAC,EAAE,EACV,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC7B,eAAe,CAOjB"}
@@ -1,125 +0,0 @@
1
- // Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
2
- /**
3
- * Format data as JSON text for MCP response
4
- */
5
- export function formatAsText(data) {
6
- return {
7
- content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
8
- structuredContent: data,
9
- };
10
- }
11
- /**
12
- * Format success message, with optional completion hints for the guided loop.
13
- *
14
- * Completion hints are structured data appended to the response so the LLM
15
- * can naturally suggest the next step without PICA dictating the conversation.
16
- * If no hints are provided, the response is identical to the old format.
17
- */
18
- export function formatSuccess(message, data, completionHints) {
19
- const response = {
20
- success: true,
21
- message,
22
- };
23
- if (data !== undefined) {
24
- response.data = data;
25
- }
26
- if (completionHints && completionHints.length > 0) {
27
- response.completion_hints = completionHints;
28
- // Append a human-readable summary so all LLMs can see the hints
29
- const hintLines = completionHints
30
- .map((h) => `- ${h.suggestion}${h.count ? ` (${h.count} works)` : ""}`)
31
- .join("\n");
32
- message += `\n\nNext steps you could take:\n${hintLines}`;
33
- response.message = message; // Keep structuredContent in sync with text
34
- }
35
- const jsonText = JSON.stringify(response, null, 2);
36
- return {
37
- content: [{ type: "text", text: `${message}\n\n${jsonText}` }],
38
- structuredContent: response,
39
- };
40
- }
41
- /**
42
- * Map raw gap objects from the completeness API into CompletionHints.
43
- * The API response shape varies — this handles the known field names.
44
- */
45
- export function mapGapsToHints(gaps, limit = 5) {
46
- if (!Array.isArray(gaps))
47
- return [];
48
- return gaps.slice(0, limit).map((g) => ({
49
- gap: g.key || g.field || g.type || "unknown",
50
- suggestion: g.suggestion || g.label || g.description || "",
51
- severity: g.severity || "important",
52
- }));
53
- }
54
- /**
55
- * Format array of items with count
56
- */
57
- export function formatList(items, metadata) {
58
- const response = {
59
- count: items.length,
60
- items,
61
- };
62
- if (metadata) {
63
- response.metadata = metadata;
64
- }
65
- const summary = `Found ${items.length} item${items.length !== 1 ? "s" : ""}.`;
66
- const jsonText = JSON.stringify(response, null, 2);
67
- return {
68
- content: [
69
- {
70
- type: "text",
71
- text: `${summary}\n\n${jsonText}`,
72
- },
73
- ],
74
- structuredContent: response,
75
- };
76
- }
77
- /**
78
- * Truncate text to max length
79
- */
80
- export function truncate(text, maxLength = 1000) {
81
- if (text.length <= maxLength) {
82
- return text;
83
- }
84
- return text.substring(0, maxLength) + "... (truncated)";
85
- }
86
- /**
87
- * Format validation error
88
- */
89
- export function formatValidationError(fields) {
90
- const structured = {
91
- error: "VALIDATION_ERROR",
92
- message: "Validation failed",
93
- fields,
94
- };
95
- return {
96
- content: [{ type: "text", text: JSON.stringify(structured, null, 2) }],
97
- structuredContent: structured,
98
- };
99
- }
100
- /**
101
- * Format structured response with dual content blocks:
102
- * - Human-readable text (includes full JSON so all MCP clients can read it)
103
- * - Machine-parseable structuredContent object
104
- */
105
- export function formatStructured(data, summary) {
106
- const jsonText = JSON.stringify(data, null, 2);
107
- return {
108
- content: [
109
- {
110
- type: "text",
111
- text: summary ? `${summary}\n\n${jsonText}` : jsonText,
112
- },
113
- ],
114
- structuredContent: data,
115
- };
116
- }
117
- /**
118
- * Format a list with both human summary and structured JSON
119
- */
120
- export function formatStructuredList(items, entityName, metadata) {
121
- const count = items.length;
122
- const summary = `Found ${count} ${entityName}${count !== 1 ? "s" : ""}${metadata?.query ? ` matching "${metadata.query}"` : ""}.`;
123
- return formatStructured({ count, items, ...metadata }, summary);
124
- }
125
- //# sourceMappingURL=formatting.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src/utils/formatting.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAc7D;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAS;IACpC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QAChE,iBAAiB,EAAE,IAA+B;KACnD,CAAC;AACJ,CAAC;AAaD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAe,EACf,IAAU,EACV,eAAkC;IAElC,MAAM,QAAQ,GAAQ;QACpB,OAAO,EAAE,IAAI;QACb,OAAO;KACR,CAAC;IAEF,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,IAAI,eAA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C,EAAE,CAAC;QACtE,iBAAiB,EAAE,UAAqC;KACzD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAS,EAAE,OAAgB;IAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC/C,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,OAAO,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ;aACvD;SACF;QACD,iBAAiB,EAAE,IAA+B;KACnD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAU,EACV,UAAkB,EAClB,QAA8B;IAE9B,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;IAC3B,MAAM,OAAO,GAAG,SAAS,KAAK,IAAI,UAAU,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GACnE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,cAAc,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EACtD,GAAG,CAAC;IAEJ,OAAO,gBAAgB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC"}
@@ -1,63 +0,0 @@
1
- import type { CallToolResult, McpError } from "@modelcontextprotocol/sdk/types.js";
2
- export declare const MPP_PER_CREDIT_PRICES: Record<string, number>;
3
- /** Default currency for MPP charges */
4
- export declare const MPP_DEFAULT_CURRENCY = "usd";
5
- /** All supported MPP currencies */
6
- export declare const MPP_SUPPORTED_CURRENCIES: string[];
7
- /**
8
- * Get per-credit amount in minor units for a currency.
9
- * Falls back to USD if currency not supported.
10
- */
11
- export declare function getMppPerCreditAmount(currency: string): number;
12
- /**
13
- * Calculate total charge amount for a number of credits.
14
- */
15
- export declare function getMppChargeAmount(creditCost: number, currency: string): {
16
- amount: string;
17
- currency: string;
18
- };
19
- /**
20
- * Check if MPP is configured (env vars present).
21
- */
22
- export declare function isMppConfigured(): boolean;
23
- /**
24
- * Get or create the MPP instance. Returns null if not configured.
25
- */
26
- export declare function getMppInstance(): any | null;
27
- /**
28
- * Reset the MPP instance (for testing).
29
- */
30
- export declare function resetMppInstance(): void;
31
- /**
32
- * Extra metadata from the MCP CallToolRequest.
33
- * Contains MPP credentials when an agent retries after a 402.
34
- */
35
- export type McpExtra = {
36
- _meta?: Record<string, unknown>;
37
- [key: string]: unknown;
38
- };
39
- /**
40
- * Result of an MPP charge attempt.
41
- */
42
- export type MppChargeResult = {
43
- status: 402;
44
- challenge: McpError;
45
- } | {
46
- status: 200;
47
- withReceipt: (result: CallToolResult) => CallToolResult;
48
- };
49
- /**
50
- * Attempt to charge via MPP for a credit-gated operation.
51
- *
52
- * @param creditCost Number of credits the operation costs
53
- * @param operationName Human-readable operation name for the charge description
54
- * @param currency Currency to charge in (default: usd)
55
- * @param extra The MCP request extra/meta (contains credential on retry)
56
- * @returns Charge result, or null if MPP is not configured
57
- */
58
- export declare function chargeMpp(creditCost: number, operationName: string, currency?: string, extra?: McpExtra): Promise<MppChargeResult | null>;
59
- /**
60
- * Format a human-readable price for a number of credits in a currency.
61
- */
62
- export declare function formatMppPrice(creditCost: number, currency?: string): string;
63
- //# sourceMappingURL=mpp.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mpp.d.ts","sourceRoot":"","sources":["../../src/utils/mpp.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,cAAc,EACd,QAAQ,EACT,MAAM,oCAAoC,CAAC;AAO5C,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAWxD,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAE1C,mC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3
- * MPP (Machine Payments Protocol) inline payment helper.
4
- *
5
- * Wraps mppx to provide per-credit charging for credit-gated MCP operations.
6
- * Same pricing as credit packs (pica_25 best-value rate per credit).
7
- *
8
- * Environment variables:
9
- * MPP_SECRET_KEY — HMAC key for challenge binding (required for MPP)
10
- * MPP_STRIPE_NETWORK_ID — Stripe Business Network Profile ID (required for MPP)
11
- * MPP_TESTNET — set "true" for staging/dev
12
- * STRIPE_SECRET_KEY — already exists, used by mppx for payment settlement
13
- *
14
- * If MPP_SECRET_KEY or MPP_STRIPE_NETWORK_ID are not set, MPP is disabled
15
- * and the gate falls through to the existing insufficient_credits error.
16
- */
17
- import { Mppx, stripe } from "mppx/server";
18
- import { Transport as McpTransport } from "mppx/mcp-sdk/server";
19
- // ---------------------------------------------------------------------------
20
- // Per-credit pricing in minor units (pica_25 pack / 25 credits)
21
- // Verified against live Stripe prices 2026-03-31
22
- // ---------------------------------------------------------------------------
23
- export const MPP_PER_CREDIT_PRICES = {
24
- gbp: 40, // £0.40
25
- usd: 48, // $0.48
26
- eur: 44, // €0.44
27
- cad: 64, // CA$0.64
28
- aud: 72, // A$0.72
29
- zar: 396, // R4
30
- ngn: 20000, // ₦200
31
- kes: 3196, // KSh32
32
- brl: 160, // R$1.60
33
- mxn: 636, // MX$6
34
- };
35
- /** Default currency for MPP charges */
36
- export const MPP_DEFAULT_CURRENCY = "usd";
37
- /** All supported MPP currencies */
38
- export const MPP_SUPPORTED_CURRENCIES = Object.keys(MPP_PER_CREDIT_PRICES);
39
- /**
40
- * Get per-credit amount in minor units for a currency.
41
- * Falls back to USD if currency not supported.
42
- */
43
- export function getMppPerCreditAmount(currency) {
44
- const key = currency.toLowerCase();
45
- return (MPP_PER_CREDIT_PRICES[key] ?? MPP_PER_CREDIT_PRICES[MPP_DEFAULT_CURRENCY]);
46
- }
47
- /**
48
- * Calculate total charge amount for a number of credits.
49
- */
50
- export function getMppChargeAmount(creditCost, currency) {
51
- const perCredit = getMppPerCreditAmount(currency);
52
- const total = perCredit * creditCost;
53
- return {
54
- amount: String(total),
55
- currency: currency.toLowerCase(),
56
- };
57
- }
58
- // ---------------------------------------------------------------------------
59
- // MPP instance (lazy singleton)
60
- // ---------------------------------------------------------------------------
61
- // Use `any` for the instance type — mppx generics are deeply nested and
62
- // cause "two different types with this name exist" errors with explicit annotations.
63
- // The runtime behavior is fully type-safe via mppx's internal validation.
64
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
- let mppInstance = null;
66
- let mppChecked = false;
67
- /**
68
- * Check if MPP is configured (env vars present).
69
- */
70
- export function isMppConfigured() {
71
- return !!(process.env.MPP_SECRET_KEY &&
72
- process.env.MPP_STRIPE_NETWORK_ID &&
73
- process.env.STRIPE_SECRET_KEY);
74
- }
75
- /**
76
- * Get or create the MPP instance. Returns null if not configured.
77
- */
78
- export function getMppInstance() {
79
- if (mppChecked)
80
- return mppInstance;
81
- mppChecked = true;
82
- if (!isMppConfigured()) {
83
- return null;
84
- }
85
- mppInstance = Mppx.create({
86
- methods: [
87
- stripe.charge({
88
- secretKey: process.env.STRIPE_SECRET_KEY,
89
- networkId: process.env.MPP_STRIPE_NETWORK_ID,
90
- paymentMethodTypes: ["card", "link"],
91
- }),
92
- ],
93
- secretKey: process.env.MPP_SECRET_KEY,
94
- realm: "withpica.com",
95
- transport: McpTransport.mcpSdk(),
96
- });
97
- return mppInstance;
98
- }
99
- /**
100
- * Reset the MPP instance (for testing).
101
- */
102
- export function resetMppInstance() {
103
- mppInstance = null;
104
- mppChecked = false;
105
- }
106
- /**
107
- * Attempt to charge via MPP for a credit-gated operation.
108
- *
109
- * @param creditCost Number of credits the operation costs
110
- * @param operationName Human-readable operation name for the charge description
111
- * @param currency Currency to charge in (default: usd)
112
- * @param extra The MCP request extra/meta (contains credential on retry)
113
- * @returns Charge result, or null if MPP is not configured
114
- */
115
- export async function chargeMpp(creditCost, operationName, currency = MPP_DEFAULT_CURRENCY, extra = {}) {
116
- const mpp = getMppInstance();
117
- if (!mpp)
118
- return null;
119
- const { amount, currency: chargeCurrency } = getMppChargeAmount(creditCost, currency);
120
- const handler = mpp.charge({
121
- amount,
122
- currency: chargeCurrency,
123
- description: `${operationName} (${creditCost} pica credit${creditCost !== 1 ? "s" : ""})`,
124
- });
125
- const result = await handler(extra);
126
- return result;
127
- }
128
- /**
129
- * Format a human-readable price for a number of credits in a currency.
130
- */
131
- export function formatMppPrice(creditCost, currency = MPP_DEFAULT_CURRENCY) {
132
- const perCredit = getMppPerCreditAmount(currency);
133
- const total = (perCredit * creditCost) / 100;
134
- const cur = currency.toUpperCase();
135
- return `${total.toFixed(2)} ${cur}`;
136
- }
137
- //# sourceMappingURL=mpp.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mpp.js","sourceRoot":"","sources":["../../src/utils/mpp.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAa,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAMhE,8EAA8E;AAC9E,gEAAgE;AAChE,iDAAiD;AACjD,8EAA8E;AAE9E,MAAM,CAAC,MAAM,qBAAqB,GAA2B;IAC3D,GAAG,EAAE,EAAE,EAAE,QAAQ;IACjB,GAAG,EAAE,EAAE,EAAE,QAAQ;IACjB,GAAG,EAAE,EAAE,EAAE,QAAQ;IACjB,GAAG,EAAE,EAAE,EAAE,UAAU;IACnB,GAAG,EAAE,EAAE,EAAE,SAAS;IAClB,GAAG,EAAE,GAAG,EAAE,KAAK;IACf,GAAG,EAAE,KAAK,EAAE,OAAO;IACnB,GAAG,EAAE,IAAI,EAAE,QAAQ;IACnB,GAAG,EAAE,GAAG,EAAE,SAAS;IACnB,GAAG,EAAE,GAAG,EAAE,OAAO;CAClB,CAAC;AAEF,uCAAuC;AACvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAE1C,mCAAmC;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,CAAC;IAClD,MAAM,KAAK,GAAG,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,GAAG,CAAC;IAC7C,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACnC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;AACtC,CAAC"}
@@ -1,35 +0,0 @@
1
- /**
2
- * Reusable party notification utility.
3
- *
4
- * Sends notifications to people involved in a write operation.
5
- * Delivers via in-app + Telegram + email (all fire-and-forget).
6
- * Used by agreement, credit, split, and collaborator tools.
7
- */
8
- import { PicaClient } from "../pica-sdk.js";
9
- export interface PartyNotification {
10
- person_id: string;
11
- message: string;
12
- work_id?: string;
13
- notification_type?: string;
14
- }
15
- export interface NotifyResult {
16
- person_id: string;
17
- name: string;
18
- delivered: boolean;
19
- channels?: {
20
- in_app?: boolean;
21
- telegram?: boolean;
22
- email?: boolean;
23
- };
24
- reason?: string;
25
- }
26
- /**
27
- * Notify one or more parties about a catalog action.
28
- * Returns results per person. Never throws — failures are per-party.
29
- */
30
- export declare function notifyParties(pica: PicaClient, parties: PartyNotification[]): Promise<NotifyResult[]>;
31
- /**
32
- * Format notification results into a human-readable summary line.
33
- */
34
- export declare function summarizeNotifications(results: NotifyResult[]): string;
35
- //# sourceMappingURL=notify-parties.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notify-parties.d.ts","sourceRoot":"","sources":["../../src/utils/notify-parties.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,iBAAiB,EAAE,GAC3B,OAAO,CAAC,YAAY,EAAE,CAAC,CAiCzB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAuBtE"}
@@ -1,59 +0,0 @@
1
- // Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
2
- /**
3
- * Notify one or more parties about a catalog action.
4
- * Returns results per person. Never throws — failures are per-party.
5
- */
6
- export async function notifyParties(pica, parties) {
7
- const results = [];
8
- for (const party of parties) {
9
- if (!party.person_id)
10
- continue;
11
- try {
12
- const result = await pica.notifications.sendToPerson({
13
- person_id: party.person_id,
14
- message: party.message,
15
- work_id: party.work_id,
16
- notification_type: party.notification_type || "collaboration_update",
17
- });
18
- const data = result.data || result;
19
- results.push({
20
- person_id: party.person_id,
21
- name: data.person_name || "Unknown",
22
- delivered: data.delivered,
23
- channels: data.channels,
24
- reason: data.reason,
25
- });
26
- }
27
- catch {
28
- results.push({
29
- person_id: party.person_id,
30
- name: "Unknown",
31
- delivered: false,
32
- reason: "notification_failed",
33
- });
34
- }
35
- }
36
- return results;
37
- }
38
- /**
39
- * Format notification results into a human-readable summary line.
40
- */
41
- export function summarizeNotifications(results) {
42
- if (results.length === 0)
43
- return "";
44
- const delivered = results.filter((r) => r.delivered);
45
- const notPica = results.filter((r) => r.reason === "not_a_pica_user");
46
- const failed = results.filter((r) => !r.delivered && r.reason !== "not_a_pica_user");
47
- const parts = [];
48
- if (delivered.length > 0) {
49
- parts.push(`Notified: ${delivered.map((r) => r.name).join(", ")}`);
50
- }
51
- if (notPica.length > 0) {
52
- parts.push(`Not PICA users (use pica_collaborators_invite): ${notPica.map((r) => r.name).join(", ")}`);
53
- }
54
- if (failed.length > 0) {
55
- parts.push(`Notification failed: ${failed.map((r) => r.name).join(", ")}`);
56
- }
57
- return parts.join(". ");
58
- }
59
- //# sourceMappingURL=notify-parties.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notify-parties.js","sourceRoot":"","sources":["../../src/utils/notify-parties.ts"],"names":[],"mappings":"AAAA,6DAA6D;AA2B7D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAgB,EAChB,OAA4B;IAE5B,MAAM,OAAO,GAAmB,EAAE,CAAC;IAEnC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,SAAS;YAAE,SAAS;QAE/B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;gBACnD,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,IAAI,sBAAsB;aACrE,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC;gBACX,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,IAAI,EAAE,IAAI,CAAC,WAAW,IAAI,SAAS;gBACnC,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,IAAI,CAAC;gBAC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,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,wBAAwB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
package/server.json DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
- "name": "io.github.withpica/pica",
4
- "description": "193 tools for music catalog management — works, recordings, credits, royalties",
5
- "repository": {
6
- "url": "https://github.com/withpica/pica",
7
- "source": "github",
8
- "subfolder": "mcp-server"
9
- },
10
- "version": "2.4.1",
11
- "packages": [
12
- {
13
- "registryType": "npm",
14
- "identifier": "@withpica/mcp-server",
15
- "version": "2.4.1",
16
- "transport": {
17
- "type": "stdio"
18
- },
19
- "environmentVariables": [
20
- {
21
- "description": "Your PICA API key — get one at https://connect.withpica.com",
22
- "isRequired": true,
23
- "format": "string",
24
- "isSecret": true,
25
- "name": "PICA_API_KEY"
26
- }
27
- ]
28
- }
29
- ]
30
- }