slab-mcp 0.1.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 (56) hide show
  1. package/README.md +264 -0
  2. package/dist/client.d.ts +26 -0
  3. package/dist/client.js +100 -0
  4. package/dist/client.js.map +1 -0
  5. package/dist/config.d.ts +21 -0
  6. package/dist/config.js +34 -0
  7. package/dist/config.js.map +1 -0
  8. package/dist/context.d.ts +20 -0
  9. package/dist/context.js +39 -0
  10. package/dist/context.js.map +1 -0
  11. package/dist/errors.d.ts +38 -0
  12. package/dist/errors.js +76 -0
  13. package/dist/errors.js.map +1 -0
  14. package/dist/format.d.ts +64 -0
  15. package/dist/format.js +125 -0
  16. package/dist/format.js.map +1 -0
  17. package/dist/index.d.ts +15 -0
  18. package/dist/index.js +52 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/prompts/index.d.ts +23 -0
  21. package/dist/prompts/index.js +104 -0
  22. package/dist/prompts/index.js.map +1 -0
  23. package/dist/resources/index.d.ts +25 -0
  24. package/dist/resources/index.js +60 -0
  25. package/dist/resources/index.js.map +1 -0
  26. package/dist/tools/catalog.d.ts +93 -0
  27. package/dist/tools/catalog.js +103 -0
  28. package/dist/tools/catalog.js.map +1 -0
  29. package/dist/tools/collection.d.ts +87 -0
  30. package/dist/tools/collection.js +130 -0
  31. package/dist/tools/collection.js.map +1 -0
  32. package/dist/tools/community.d.ts +10 -0
  33. package/dist/tools/community.js +74 -0
  34. package/dist/tools/community.js.map +1 -0
  35. package/dist/tools/filters.d.ts +51 -0
  36. package/dist/tools/filters.js +54 -0
  37. package/dist/tools/filters.js.map +1 -0
  38. package/dist/tools/index.d.ts +22 -0
  39. package/dist/tools/index.js +55 -0
  40. package/dist/tools/index.js.map +1 -0
  41. package/dist/tools/meta.d.ts +33 -0
  42. package/dist/tools/meta.js +98 -0
  43. package/dist/tools/meta.js.map +1 -0
  44. package/dist/tools/pricing.d.ts +30 -0
  45. package/dist/tools/pricing.js +90 -0
  46. package/dist/tools/pricing.js.map +1 -0
  47. package/dist/tools/types.d.ts +69 -0
  48. package/dist/tools/types.js +50 -0
  49. package/dist/tools/types.js.map +1 -0
  50. package/dist/tools/writes.d.ts +128 -0
  51. package/dist/tools/writes.js +168 -0
  52. package/dist/tools/writes.js.map +1 -0
  53. package/dist/types.d.ts +80 -0
  54. package/dist/types.js +11 -0
  55. package/dist/types.js.map +1 -0
  56. package/package.json +53 -0
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Write tools — registered only when SLAB_MCP_WRITE=1.
3
+ *
4
+ * Everything in this file has `mutates: true`, which is what the registry
5
+ * checks; `tests/registry.test.ts` fails the build if a tool in here forgets
6
+ * it, or claims `readOnlyHint: true`.
7
+ *
8
+ * These write to a real person's records, so the descriptions say what a wrong
9
+ * call actually costs — a duplicated copy quietly doubles a reported
10
+ * collection value, and a break's total cost is divided across every card
11
+ * pulled from it, so the wrong figure re-prices dozens of cards at once.
12
+ */
13
+ import { z } from 'zod';
14
+ import { text } from '../format.js';
15
+ import { CREATES, DELETES, UPDATES, defineTool } from './types.js';
16
+ const collectorArg = z
17
+ .string()
18
+ .optional()
19
+ .describe('Collector UUID. Omit it — the server uses the collector this API key acts for.');
20
+ const isoDate = (description) => z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Must be an ISO date, YYYY-MM-DD').describe(description);
21
+ export const addCopy = defineTool({
22
+ name: 'add_copy',
23
+ title: 'Add a card to the collection',
24
+ description: 'Record one physical copy the user owns. `card_uuid` comes from search_cards — a parallel is its ' +
25
+ 'own card, so make sure you picked the right finish before adding, not just the right player.\n\n' +
26
+ 'This is not idempotent: calling it twice adds two copies and doubles that card\'s contribution ' +
27
+ 'to the collection\'s value. Search the collection first if there is any chance the copy is ' +
28
+ 'already recorded.\n\n' +
29
+ 'Cost: pass `acquisition_cost` for a straight purchase. If the card came out of a sealed product, ' +
30
+ 'log the break with log_break and pass `break_uuid` instead — the break\'s cost is then split ' +
31
+ 'across every card pulled from it, which is the honest cost basis for a pack pull. Same idea with ' +
32
+ '`lot_uuid` for a multi-card purchase. Do not pass both a cost and a container.\n\n' +
33
+ 'If you do not know a field, leave it out. Do not guess a serial number, a grade, or a price.',
34
+ inputSchema: z.object({
35
+ collector_uuid: collectorArg,
36
+ card_uuid: z.string().describe('Catalog card UUID, from search_cards.'),
37
+ quantity: z.number().int().min(1).optional().describe('Only for identical, ungraded, interchangeable duplicates. Default 1.'),
38
+ serial_number: z.number().int().optional().describe('This copy\'s serial, the "54" of /100. Omit unless the card is actually numbered.'),
39
+ grading_company: z.string().optional().describe('PSA, BGS, SGC, or CGC. Omit for a raw card.'),
40
+ grade: z.string().optional().describe('The grade on the slab, e.g. "10", "9.5", "Authentic".'),
41
+ cert_number: z.string().optional().describe('Certification number from the slab.'),
42
+ self_grade: z.number().int().min(1).max(10).optional().describe('The user\'s own 1-10 assessment of a raw card.'),
43
+ acquisition_type: z.enum(['purchase', 'pack_pull', 'trade', 'gift', 'other']).optional().describe('How the copy was acquired.'),
44
+ acquisition_cost: z.number().min(0).optional().describe('What this copy cost. Leave unset for a pull or a gift, and unset when passing break_uuid or lot_uuid.'),
45
+ acquired_date: z.string().optional().describe('ISO date (YYYY-MM-DD). Defaults to today. Matters: the portfolio series values a copy only from this date onward.'),
46
+ acquired_source: z.string().optional().describe('Where it came from, e.g. "eBay", "card show".'),
47
+ break_uuid: z.string().optional().describe('The break this card was pulled from, from log_break. Sets the cost basis by division.'),
48
+ lot_uuid: z.string().optional().describe('The multi-card purchase this came from, from log_lot.'),
49
+ storage_location: z.string().optional().describe('Where the physical card lives, e.g. "binder 3", "safe deposit box".'),
50
+ notes: z.string().optional().describe('Free-text note about this copy. Condition observations, provenance, anything the fields do not capture.'),
51
+ }),
52
+ annotations: CREATES,
53
+ mutates: true,
54
+ async handler(input, ctx) {
55
+ const { collector_uuid, ...body } = input;
56
+ const collector = await ctx.collector(collector_uuid);
57
+ const copy = await ctx.client.request('POST', `/collectors/${collector}/copies`, { body });
58
+ return text(`Added copy ${copy.uuid} of card ${copy.card_uuid}.`, 'Use this copy uuid for update_copy or remove_copy.');
59
+ },
60
+ });
61
+ export const updateCopy = defineTool({
62
+ name: 'update_copy',
63
+ title: 'Update a copy already in the collection',
64
+ description: 'Change fields on a copy the user already owns. `copy_uuid` comes from search_collection (it is ' +
65
+ 'the copy uuid, not the card uuid). Only the fields you pass are changed.\n\n' +
66
+ 'To record a sale, set `status` to "sold" and pass `sale_price` and `sold_date`. That is what ' +
67
+ 'turns paper gain into realised gain, so get the figure right rather than approximating it.',
68
+ inputSchema: z.object({
69
+ collector_uuid: collectorArg,
70
+ copy_uuid: z.string().describe('Copy UUID, from search_collection.'),
71
+ quantity: z.number().int().min(1).optional().describe('New quantity, for identical ungraded duplicates collapsed into one row.'),
72
+ serial_number: z.number().int().optional().describe("This copy's serial, the \"54\" of /100."),
73
+ grading_company: z.string().optional().describe('PSA, BGS, SGC, or CGC. Set this when a raw card comes back from grading.'),
74
+ grade: z.string().optional().describe('The grade on the slab, e.g. "10", "9.5", "Authentic".'),
75
+ cert_number: z.string().optional().describe('Certification number from the slab.'),
76
+ self_grade: z.number().int().min(1).max(10).optional().describe("The user's own 1-10 assessment of a raw card."),
77
+ acquisition_type: z.enum(['purchase', 'pack_pull', 'trade', 'gift', 'other']).optional().describe('How the copy was acquired.'),
78
+ acquisition_cost: z.number().min(0).optional().describe('What this copy cost. Only for standalone copies — a copy attached to a break or lot derives its cost from the container.'),
79
+ acquired_date: z.string().optional().describe('ISO date (YYYY-MM-DD) the copy was acquired. Changes where it enters the portfolio series.'),
80
+ acquired_source: z.string().optional().describe('Where it came from, e.g. "eBay", "card show".'),
81
+ status: z.enum(['in_collection', 'for_trade', 'for_sale', 'sold']).optional().describe('Set to "sold" to record a sale — pair it with sale_price and sold_date.'),
82
+ sale_price: z.number().min(0).optional().describe('What it actually sold for. Required in practice when status is "sold"; this is what turns paper gain into realised gain.'),
83
+ sold_date: z.string().optional().describe('ISO date (YYYY-MM-DD) of the sale.'),
84
+ storage_location: z.string().optional().describe('Where the physical card lives.'),
85
+ notes: z.string().optional().describe('Free-text note about this copy.'),
86
+ }),
87
+ annotations: UPDATES,
88
+ mutates: true,
89
+ async handler(input, ctx) {
90
+ const { collector_uuid, copy_uuid, ...body } = input;
91
+ const collector = await ctx.collector(collector_uuid);
92
+ const copy = await ctx.client.request('PATCH', `/collectors/${collector}/copies/${copy_uuid}`, { body });
93
+ return text(`Updated copy ${copy.uuid}.`);
94
+ },
95
+ });
96
+ export const removeCopy = defineTool({
97
+ name: 'remove_copy',
98
+ title: 'Delete a copy from the collection',
99
+ description: 'Permanently delete a copy record and its cost history. There is no undo and no trash — the ' +
100
+ 'purchase price, grading costs, and acquisition date are gone with it.\n\n' +
101
+ 'This is for correcting a mistaken entry. If the user SOLD the card, do not use this: call ' +
102
+ 'update_copy with status "sold" instead, which keeps the record and computes the realised gain. ' +
103
+ 'Deleting a sold card erases the profit it made.\n\n' +
104
+ 'Confirm with the user before calling this.',
105
+ inputSchema: z.object({
106
+ collector_uuid: collectorArg,
107
+ copy_uuid: z.string().describe('Copy UUID, from search_collection.'),
108
+ }),
109
+ annotations: DELETES,
110
+ mutates: true,
111
+ async handler(input, ctx) {
112
+ const collector = await ctx.collector(input.collector_uuid);
113
+ await ctx.client.request('DELETE', `/collectors/${collector}/copies/${input.copy_uuid}`);
114
+ return text(`Deleted copy ${input.copy_uuid}.`);
115
+ },
116
+ });
117
+ export const logBreak = defineTool({
118
+ name: 'log_break',
119
+ title: 'Log a sealed product that was opened',
120
+ description: 'Record that the user opened a sealed product — a box, case, or pack — and what it cost. Returns ' +
121
+ 'a break uuid to pass as `break_uuid` on each add_copy for the cards pulled from it.\n\n' +
122
+ 'This is how pack pulls get an honest cost basis: the break\'s total cost is divided across the ' +
123
+ 'copies linked to it, so the split changes every time another card is added. Log the break first, ' +
124
+ 'then add the cards.\n\n' +
125
+ '`set_uuid` comes from search_sets.',
126
+ inputSchema: z.object({
127
+ collector_uuid: collectorArg,
128
+ set_uuid: z.string().describe('UUID of the product that was opened, from search_sets.'),
129
+ break_type: z.string().describe('Format opened, e.g. hobby_box, hobby_case, blaster_box, retail_pack. Call get_vocab for the current list.'),
130
+ total_cost: z.number().min(0).describe('Total paid for the sealed product.'),
131
+ break_date: isoDate('Date the product was opened (YYYY-MM-DD).'),
132
+ source: z.string().optional().describe('Where it was bought, e.g. "eBay", "LCS".'),
133
+ notes: z.string().optional().describe('Free-text note about this break.'),
134
+ }),
135
+ annotations: CREATES,
136
+ mutates: true,
137
+ async handler(input, ctx) {
138
+ const { collector_uuid, ...body } = input;
139
+ const collector = await ctx.collector(collector_uuid);
140
+ const result = await ctx.client.request('POST', `/collectors/${collector}/breaks`, { body });
141
+ return text(`Logged break ${result.uuid}.`, 'Pass this as `break_uuid` on add_copy for each card pulled from it.');
142
+ },
143
+ });
144
+ export const logLot = defineTool({
145
+ name: 'log_lot',
146
+ title: 'Log a multi-card purchase',
147
+ description: 'Record a single purchase of several cards for one price — a lot, a collection buy, a trade-in. ' +
148
+ 'Returns a lot uuid to pass as `lot_uuid` on each add_copy.\n\n' +
149
+ 'Same mechanic as log_break, without a sealed product: the total is divided across the copies ' +
150
+ 'linked to the lot, which is the only defensible way to price cards bought as a bundle.',
151
+ inputSchema: z.object({
152
+ collector_uuid: collectorArg,
153
+ total_cost: z.number().min(0).describe('Total paid for the whole purchase.'),
154
+ lot_date: isoDate('Date of the purchase (YYYY-MM-DD).'),
155
+ source: z.string().optional().describe('Where it was bought, e.g. "eBay", a seller, "card show".'),
156
+ notes: z.string().optional().describe('Free-text note about this purchase.'),
157
+ }),
158
+ annotations: CREATES,
159
+ mutates: true,
160
+ async handler(input, ctx) {
161
+ const { collector_uuid, ...body } = input;
162
+ const collector = await ctx.collector(collector_uuid);
163
+ const result = await ctx.client.request('POST', `/collectors/${collector}/lots`, { body });
164
+ return text(`Logged lot ${result.uuid}.`, 'Pass this as `lot_uuid` on add_copy for each card in it.');
165
+ },
166
+ });
167
+ export const writeTools = [addCopy, updateCopy, removeCopy, logBreak, logLot];
168
+ //# sourceMappingURL=writes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writes.js","sourceRoot":"","sources":["../../src/tools/writes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEnE,MAAM,YAAY,GAAG,CAAC;KACnB,MAAM,EAAE;KACR,QAAQ,EAAE;KACV,QAAQ,CAAC,gFAAgF,CAAC,CAAC;AAE9F,MAAM,OAAO,GAAG,CAAC,WAAmB,EAAE,EAAE,CACtC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,qBAAqB,EAAE,iCAAiC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAEnG,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;IAChC,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,8BAA8B;IACrC,WAAW,EACT,kGAAkG;QAClG,kGAAkG;QAClG,iGAAiG;QACjG,6FAA6F;QAC7F,uBAAuB;QACvB,mGAAmG;QACnG,+FAA+F;QAC/F,mGAAmG;QACnG,oFAAoF;QACpF,8FAA8F;IAChG,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,cAAc,EAAE,YAAY;QAC5B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;QACvE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sEAAsE,CAAC;QAC7H,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAA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B,MAAM,EAAE,eAAe,SAAS,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7G,OAAO,IAAI,CAAC,cAAc,MAAM,CAAC,IAAI,GAAG,EAAE,0DAA0D,CAAC,CAAC;IACxG,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Structural types for the slice of the slab wire contract this server reads.
3
+ *
4
+ * These are read-side conveniences for formatting, NOT a re-specification of
5
+ * the API. `GET /openapi.json` is authoritative; anything here that disagrees
6
+ * with it is a bug in here. Every field is optional on purpose — a response
7
+ * that grows a field must not break formatting, and a field that moves should
8
+ * degrade to "not shown" rather than throw.
9
+ */
10
+ export interface SubjectOut {
11
+ name?: string;
12
+ team?: string | null;
13
+ }
14
+ export interface AttributeOut {
15
+ name?: string;
16
+ }
17
+ export interface FmvSummary {
18
+ fair_market_value?: number | null;
19
+ grade_key?: string | null;
20
+ sample_size?: number | null;
21
+ price_change_30d?: number | null;
22
+ }
23
+ export interface CardOut {
24
+ uuid: string;
25
+ card_number?: string;
26
+ brand?: string | null;
27
+ set_name?: string | null;
28
+ set_slug?: string | null;
29
+ season?: string | null;
30
+ year?: number | null;
31
+ subset?: string | null;
32
+ finish?: string | null;
33
+ print_run?: number | null;
34
+ subjects?: SubjectOut[];
35
+ attributes?: AttributeOut[];
36
+ owned_quantity?: number | null;
37
+ market?: FmvSummary | null;
38
+ }
39
+ export interface SetOut {
40
+ uuid: string;
41
+ name?: string | null;
42
+ slug?: string;
43
+ brand?: string | null;
44
+ season?: string | null;
45
+ year?: number | null;
46
+ card_count?: number | null;
47
+ box_price?: number | null;
48
+ }
49
+ export interface Paged<T> {
50
+ total?: number;
51
+ limit?: number;
52
+ offset?: number;
53
+ items?: T[];
54
+ facets?: Record<string, Array<{
55
+ value: string;
56
+ count: number;
57
+ }>> | null;
58
+ summary?: Record<string, unknown> | null;
59
+ }
60
+ export interface CardCopyOut {
61
+ uuid: string;
62
+ card_uuid?: string;
63
+ quantity?: number;
64
+ serial_number?: number | null;
65
+ grading_company?: string | null;
66
+ grade?: string | null;
67
+ acquired_date?: string | null;
68
+ cost_basis?: number | null;
69
+ status?: string;
70
+ storage_location?: string | null;
71
+ market?: Record<string, unknown> | null;
72
+ card?: CardOut | null;
73
+ }
74
+ export interface AccountOut {
75
+ default_collector_uuid?: string | null;
76
+ collectors?: Array<{
77
+ uuid: string;
78
+ handle?: string | null;
79
+ }>;
80
+ }
package/dist/types.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Structural types for the slice of the slab wire contract this server reads.
3
+ *
4
+ * These are read-side conveniences for formatting, NOT a re-specification of
5
+ * the API. `GET /openapi.json` is authoritative; anything here that disagrees
6
+ * with it is a bug in here. Every field is optional on purpose — a response
7
+ * that grows a field must not break formatting, and a field that moves should
8
+ * degrade to "not shown" rather than throw.
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "slab-mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for the slab trading-card API — lets a local AI agent search the catalog, read pricing, and manage a collection.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "keywords": [
8
+ "mcp",
9
+ "modelcontextprotocol",
10
+ "slab",
11
+ "trading-cards",
12
+ "hockey-cards",
13
+ "ai-agent"
14
+ ],
15
+ "homepage": "https://github.com/dev-jeb/slab-community/tree/main/slab-mcp#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/dev-jeb/slab-community/issues"
18
+ },
19
+ "//repository": "Required for npm provenance — the attestation links the published tarball to this exact repo and directory, and npm rejects a mismatch.",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/dev-jeb/slab-community.git",
23
+ "directory": "slab-mcp"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "engines": {
29
+ "node": ">=20"
30
+ },
31
+ "bin": {
32
+ "slab-mcp": "dist/index.js"
33
+ },
34
+ "files": [
35
+ "dist"
36
+ ],
37
+ "scripts": {
38
+ "build": "tsc",
39
+ "dev": "tsx src/index.ts",
40
+ "test": "node --import tsx --test tests/*.test.ts",
41
+ "typecheck": "tsc --noEmit",
42
+ "prepublishOnly": "npm run build"
43
+ },
44
+ "dependencies": {
45
+ "@modelcontextprotocol/server": "^2.0.0",
46
+ "zod": "^4.2.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^20",
50
+ "tsx": "^4.19.0",
51
+ "typescript": "^5"
52
+ }
53
+ }