@talonic/mcp 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +107 -0
- package/README.md +63 -14
- package/dist/content.js +1 -1
- package/dist/content.js.map +1 -1
- package/dist/http-server.js +284 -30
- package/dist/http-server.js.map +1 -1
- package/dist/index.js +258 -23
- package/dist/index.js.map +1 -1
- package/dist/server.js +258 -23
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -100,7 +100,7 @@ function registerWebhooksResource(server, apiKey, baseUrl) {
|
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
function jsonOk(value) {
|
|
103
|
-
|
|
103
|
+
const result = {
|
|
104
104
|
content: [
|
|
105
105
|
{
|
|
106
106
|
type: "text",
|
|
@@ -108,6 +108,10 @@ function jsonOk(value) {
|
|
|
108
108
|
}
|
|
109
109
|
]
|
|
110
110
|
};
|
|
111
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
112
|
+
result["structuredContent"] = value;
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
111
115
|
}
|
|
112
116
|
function validationError(message) {
|
|
113
117
|
return {
|
|
@@ -157,18 +161,22 @@ var DESCRIPTION = [
|
|
|
157
161
|
"- The user just wants the full text content (use talonic_to_markdown after extracting once).",
|
|
158
162
|
"- The user wants to find documents matching a query (use talonic_search or talonic_filter).",
|
|
159
163
|
"",
|
|
160
|
-
"FILE SOURCES (provide exactly
|
|
161
|
-
"- file_data + filename
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
" the
|
|
171
|
-
"
|
|
164
|
+
"FILE SOURCES (provide exactly EXACTLY ONE; never combine, e.g. do NOT pass both file_data and file_path):",
|
|
165
|
+
"- file_data + filename: base64-encoded file bytes plus the original filename (with extension).",
|
|
166
|
+
" RECOMMENDED for local-stdio installs (Claude Desktop, Cursor, Cline, Continue, Cowork).",
|
|
167
|
+
" WARNING for hosted-MCP via Claude.ai connectors: Claude.ai imposes a hard size limit on",
|
|
168
|
+
" tool-call arguments (effectively under ~1KB), so file_data CANNOT carry a real PDF through",
|
|
169
|
+
" Claude.ai's pipeline. The bytes get truncated before reaching the MCP server. For files",
|
|
170
|
+
" larger than a trivial test, use file_url or document_id instead when running through",
|
|
171
|
+
" Claude.ai. Local stdio installs do NOT have this limit.",
|
|
172
|
+
"- file_path: a local path to the document. Only works if the MCP server process can read",
|
|
173
|
+
" that path on its own filesystem. Chat clients (Claude Desktop, Claude.ai, Cowork) store",
|
|
174
|
+
" user uploads in a sandbox the MCP server cannot access, so file_path is only useful when",
|
|
175
|
+
" the agent explicitly knows a path on the same machine as the MCP server.",
|
|
176
|
+
"- file_url: a URL the Talonic API will fetch directly. Use for documents already on the",
|
|
177
|
+
" public web. Best path for Claude.ai users dealing with files larger than the parameter cap.",
|
|
178
|
+
"- document_id: re-extract a document already in the workspace. Cheapest option when the",
|
|
179
|
+
" document is already uploaded via app.talonic.com or a previous extract call.",
|
|
172
180
|
"",
|
|
173
181
|
"SCHEMA (REQUIRED, provide exactly one of `schema` or `schema_id`):",
|
|
174
182
|
'- JSON Schema (RECOMMENDED): { type: "object", properties: { vendor_name: { type: "string" } } }.',
|
|
@@ -218,6 +226,52 @@ var inputSchema = {
|
|
|
218
226
|
"Include per-field provenance (source_text, section, page) showing where each value was found in the document."
|
|
219
227
|
)
|
|
220
228
|
};
|
|
229
|
+
var outputSchema = {
|
|
230
|
+
extraction_id: z.string().describe("Stable identifier for this extraction."),
|
|
231
|
+
request_id: z.string().optional().describe("Server-assigned request ID for support and debugging."),
|
|
232
|
+
status: z.string().describe("Extraction status (e.g. 'complete')."),
|
|
233
|
+
document: z.object({
|
|
234
|
+
id: z.string(),
|
|
235
|
+
filename: z.string(),
|
|
236
|
+
pages: z.number().optional(),
|
|
237
|
+
size_bytes: z.number().optional(),
|
|
238
|
+
mime_type: z.string().optional(),
|
|
239
|
+
type_detected: z.string().nullable().optional(),
|
|
240
|
+
language_detected: z.string().nullable().optional()
|
|
241
|
+
}).describe("Metadata about the ingested document."),
|
|
242
|
+
data: z.record(z.string(), z.unknown()).describe("The extracted structured data, shape determined by the schema."),
|
|
243
|
+
schema: z.object({
|
|
244
|
+
source: z.string().optional(),
|
|
245
|
+
id: z.string().nullable().optional(),
|
|
246
|
+
definition: z.record(z.string(), z.unknown()).optional(),
|
|
247
|
+
save_url: z.string().optional()
|
|
248
|
+
}).optional().describe("Schema metadata: which schema was used and how it can be saved."),
|
|
249
|
+
confidence: z.object({
|
|
250
|
+
overall: z.number().describe("0..1 confidence for the extraction as a whole."),
|
|
251
|
+
fields: z.record(z.string(), z.number()).describe("Per-field confidence map (0..1).")
|
|
252
|
+
}).optional().describe("Extraction confidence. Treat fields below ~0.7 as needing human review."),
|
|
253
|
+
provenance: z.record(
|
|
254
|
+
z.string(),
|
|
255
|
+
z.object({
|
|
256
|
+
source_text: z.string().optional(),
|
|
257
|
+
section: z.string().optional(),
|
|
258
|
+
page: z.number().optional()
|
|
259
|
+
})
|
|
260
|
+
).optional().describe(
|
|
261
|
+
"Per-field source evidence (source_text, section, page). Present only when `include_provenance: true`."
|
|
262
|
+
),
|
|
263
|
+
processing: z.object({
|
|
264
|
+
duration_ms: z.number().optional(),
|
|
265
|
+
pages_processed: z.number().optional(),
|
|
266
|
+
region: z.string().optional()
|
|
267
|
+
}).optional().describe("Processing metadata: duration, pages processed, region."),
|
|
268
|
+
links: z.object({
|
|
269
|
+
self: z.string().optional(),
|
|
270
|
+
document: z.string().optional(),
|
|
271
|
+
dashboard: z.string().optional()
|
|
272
|
+
}).optional().describe("URLs for self, document, and human-readable dashboard view."),
|
|
273
|
+
markdown: z.string().optional().describe("OCR-converted markdown. Present only when `include_markdown: true`.")
|
|
274
|
+
};
|
|
221
275
|
async function handleExtract(talonic, args) {
|
|
222
276
|
if (args.schema === void 0 && args.schema_id === void 0) {
|
|
223
277
|
return validationError(
|
|
@@ -254,7 +308,14 @@ function registerExtract(server, talonic) {
|
|
|
254
308
|
{
|
|
255
309
|
title: "Extract Data from Document",
|
|
256
310
|
description: DESCRIPTION,
|
|
257
|
-
inputSchema
|
|
311
|
+
inputSchema,
|
|
312
|
+
outputSchema,
|
|
313
|
+
annotations: {
|
|
314
|
+
title: "Extract Data from Document",
|
|
315
|
+
readOnlyHint: false,
|
|
316
|
+
destructiveHint: false,
|
|
317
|
+
openWorldHint: true
|
|
318
|
+
}
|
|
258
319
|
},
|
|
259
320
|
async (args) => handleExtract(talonic, args)
|
|
260
321
|
);
|
|
@@ -333,6 +394,23 @@ var inputSchema2 = {
|
|
|
333
394
|
limit: z.number().int().positive().optional().describe("Results per page. Default 50 server-side."),
|
|
334
395
|
source_connection_id: z.string().optional().describe("Optionally scope to a specific source connection.")
|
|
335
396
|
};
|
|
397
|
+
var outputSchema2 = {
|
|
398
|
+
data: z.array(
|
|
399
|
+
z.object({
|
|
400
|
+
document_id: z.string().optional(),
|
|
401
|
+
filename: z.string().optional(),
|
|
402
|
+
fields: z.record(z.string(), z.unknown()).optional()
|
|
403
|
+
}).passthrough()
|
|
404
|
+
).describe("Documents matching the filter conditions, with their extracted field values."),
|
|
405
|
+
total: z.number().optional().describe("Total documents matching across all pages."),
|
|
406
|
+
page: z.number().optional().describe("Current page number."),
|
|
407
|
+
pagination: z.object({
|
|
408
|
+
total: z.number().optional(),
|
|
409
|
+
limit: z.number().optional(),
|
|
410
|
+
has_more: z.boolean().optional(),
|
|
411
|
+
next_cursor: z.string().nullable().optional()
|
|
412
|
+
}).optional().describe("Cursor-based pagination metadata.")
|
|
413
|
+
};
|
|
336
414
|
async function handleFilter(talonic, args) {
|
|
337
415
|
try {
|
|
338
416
|
const conditions = args.conditions.map((c) => {
|
|
@@ -368,7 +446,13 @@ function registerFilter(server, talonic) {
|
|
|
368
446
|
{
|
|
369
447
|
title: "Filter Talonic Documents",
|
|
370
448
|
description: DESCRIPTION2,
|
|
371
|
-
inputSchema: inputSchema2
|
|
449
|
+
inputSchema: inputSchema2,
|
|
450
|
+
outputSchema: outputSchema2,
|
|
451
|
+
annotations: {
|
|
452
|
+
title: "Filter Talonic Documents",
|
|
453
|
+
readOnlyHint: true,
|
|
454
|
+
openWorldHint: true
|
|
455
|
+
}
|
|
372
456
|
},
|
|
373
457
|
async (args) => handleFilter(talonic, args)
|
|
374
458
|
);
|
|
@@ -395,6 +479,48 @@ var inputSchema3 = {
|
|
|
395
479
|
"The Talonic document ID. Get this from a previous talonic_extract or talonic_search response."
|
|
396
480
|
)
|
|
397
481
|
};
|
|
482
|
+
var outputSchema3 = {
|
|
483
|
+
id: z.string(),
|
|
484
|
+
filename: z.string().optional(),
|
|
485
|
+
pages: z.number().optional(),
|
|
486
|
+
size_bytes: z.number().optional(),
|
|
487
|
+
mime_type: z.string().optional(),
|
|
488
|
+
type_detected: z.string().nullable().optional(),
|
|
489
|
+
language_detected: z.string().nullable().optional(),
|
|
490
|
+
status: z.string().optional(),
|
|
491
|
+
source: z.object({
|
|
492
|
+
id: z.string().optional(),
|
|
493
|
+
type: z.string().optional()
|
|
494
|
+
}).optional(),
|
|
495
|
+
triage: z.object({
|
|
496
|
+
sensitivity: z.string().optional(),
|
|
497
|
+
department: z.string().optional(),
|
|
498
|
+
jurisdiction: z.string().nullable().optional(),
|
|
499
|
+
pii_detected: z.boolean().optional(),
|
|
500
|
+
pii_categories: z.array(z.string()).nullable().optional(),
|
|
501
|
+
regulated_data: z.boolean().optional(),
|
|
502
|
+
confidentiality_marking: z.string().nullable().optional()
|
|
503
|
+
}).optional(),
|
|
504
|
+
original_path: z.string().nullable().optional(),
|
|
505
|
+
extraction_count: z.number().optional(),
|
|
506
|
+
latest_extraction_id: z.string().nullable().optional(),
|
|
507
|
+
processing_log: z.array(
|
|
508
|
+
z.object({
|
|
509
|
+
step: z.string().optional(),
|
|
510
|
+
detail: z.string().optional(),
|
|
511
|
+
status: z.string().optional(),
|
|
512
|
+
started_at: z.string().optional(),
|
|
513
|
+
completed_at: z.string().optional(),
|
|
514
|
+
duration_ms: z.number().optional()
|
|
515
|
+
})
|
|
516
|
+
).optional(),
|
|
517
|
+
created_at: z.string().optional(),
|
|
518
|
+
links: z.object({
|
|
519
|
+
self: z.string().optional(),
|
|
520
|
+
extractions: z.string().optional(),
|
|
521
|
+
dashboard: z.string().optional()
|
|
522
|
+
}).optional()
|
|
523
|
+
};
|
|
398
524
|
async function handleGetDocument(talonic, args) {
|
|
399
525
|
try {
|
|
400
526
|
const result = await talonic.documents.get(args.document_id);
|
|
@@ -409,13 +535,17 @@ function registerGetDocument(server, talonic) {
|
|
|
409
535
|
{
|
|
410
536
|
title: "Get Talonic Document",
|
|
411
537
|
description: DESCRIPTION3,
|
|
412
|
-
inputSchema: inputSchema3
|
|
538
|
+
inputSchema: inputSchema3,
|
|
539
|
+
outputSchema: outputSchema3,
|
|
540
|
+
annotations: {
|
|
541
|
+
title: "Get Talonic Document",
|
|
542
|
+
readOnlyHint: true,
|
|
543
|
+
openWorldHint: true
|
|
544
|
+
}
|
|
413
545
|
},
|
|
414
546
|
async (args) => handleGetDocument(talonic, args)
|
|
415
547
|
);
|
|
416
548
|
}
|
|
417
|
-
|
|
418
|
-
// src/tools/list-schemas.ts
|
|
419
549
|
var DESCRIPTION4 = [
|
|
420
550
|
"STATUS: stable.",
|
|
421
551
|
"",
|
|
@@ -435,6 +565,31 @@ var DESCRIPTION4 = [
|
|
|
435
565
|
"",
|
|
436
566
|
"TIP: Pair this with talonic_extract by passing the chosen schema's id as `schema_id`."
|
|
437
567
|
].join("\n");
|
|
568
|
+
var schemaItem = z.object({
|
|
569
|
+
id: z.string().describe("UUID of the schema."),
|
|
570
|
+
short_id: z.string().optional().describe("Human-readable short id (SCH-XXXXXXXX)."),
|
|
571
|
+
name: z.string(),
|
|
572
|
+
description: z.string().optional(),
|
|
573
|
+
definition: z.record(z.string(), z.unknown()).optional(),
|
|
574
|
+
field_count: z.number().optional(),
|
|
575
|
+
version: z.number().optional(),
|
|
576
|
+
created_at: z.string().optional(),
|
|
577
|
+
updated_at: z.string().optional(),
|
|
578
|
+
links: z.object({
|
|
579
|
+
self: z.string().optional(),
|
|
580
|
+
extractions: z.string().optional(),
|
|
581
|
+
dashboard: z.string().optional()
|
|
582
|
+
}).optional()
|
|
583
|
+
});
|
|
584
|
+
var outputSchema4 = {
|
|
585
|
+
data: z.array(schemaItem).describe("Saved schemas in the workspace."),
|
|
586
|
+
pagination: z.object({
|
|
587
|
+
total: z.number().optional(),
|
|
588
|
+
limit: z.number().optional(),
|
|
589
|
+
has_more: z.boolean().optional(),
|
|
590
|
+
next_cursor: z.string().nullable().optional()
|
|
591
|
+
}).optional().describe("Cursor-based pagination metadata.")
|
|
592
|
+
};
|
|
438
593
|
async function handleListSchemas(talonic) {
|
|
439
594
|
try {
|
|
440
595
|
const result = await talonic.schemas.list();
|
|
@@ -449,7 +604,13 @@ function registerListSchemas(server, talonic) {
|
|
|
449
604
|
{
|
|
450
605
|
title: "List Talonic Schemas",
|
|
451
606
|
description: DESCRIPTION4,
|
|
452
|
-
inputSchema: {}
|
|
607
|
+
inputSchema: {},
|
|
608
|
+
outputSchema: outputSchema4,
|
|
609
|
+
annotations: {
|
|
610
|
+
title: "List Talonic Schemas",
|
|
611
|
+
readOnlyHint: true,
|
|
612
|
+
openWorldHint: true
|
|
613
|
+
}
|
|
453
614
|
},
|
|
454
615
|
async () => handleListSchemas(talonic)
|
|
455
616
|
);
|
|
@@ -482,6 +643,22 @@ var inputSchema4 = {
|
|
|
482
643
|
),
|
|
483
644
|
description: z.string().optional().describe("Optional description of what this schema extracts and when to use it.")
|
|
484
645
|
};
|
|
646
|
+
var outputSchema5 = {
|
|
647
|
+
id: z.string().describe("UUID of the newly saved schema."),
|
|
648
|
+
short_id: z.string().optional().describe("Human-readable short id (SCH-XXXXXXXX)."),
|
|
649
|
+
name: z.string(),
|
|
650
|
+
description: z.string().optional(),
|
|
651
|
+
definition: z.record(z.string(), z.unknown()).optional().describe("Final schema definition as stored, normalised by the API."),
|
|
652
|
+
field_count: z.number().optional(),
|
|
653
|
+
version: z.number().optional().describe("Schema version (1 for new schemas; increments on update)."),
|
|
654
|
+
created_at: z.string().optional(),
|
|
655
|
+
updated_at: z.string().optional(),
|
|
656
|
+
links: z.object({
|
|
657
|
+
self: z.string().optional(),
|
|
658
|
+
extractions: z.string().optional(),
|
|
659
|
+
dashboard: z.string().optional()
|
|
660
|
+
}).optional()
|
|
661
|
+
};
|
|
485
662
|
async function handleSaveSchema(talonic, args) {
|
|
486
663
|
try {
|
|
487
664
|
const result = await talonic.schemas.create({
|
|
@@ -500,7 +677,14 @@ function registerSaveSchema(server, talonic) {
|
|
|
500
677
|
{
|
|
501
678
|
title: "Save Talonic Schema",
|
|
502
679
|
description: DESCRIPTION5,
|
|
503
|
-
inputSchema: inputSchema4
|
|
680
|
+
inputSchema: inputSchema4,
|
|
681
|
+
outputSchema: outputSchema5,
|
|
682
|
+
annotations: {
|
|
683
|
+
title: "Save Talonic Schema",
|
|
684
|
+
readOnlyHint: false,
|
|
685
|
+
destructiveHint: false,
|
|
686
|
+
openWorldHint: true
|
|
687
|
+
}
|
|
504
688
|
},
|
|
505
689
|
async (args) => handleSaveSchema(talonic, args)
|
|
506
690
|
);
|
|
@@ -533,6 +717,40 @@ var inputSchema5 = {
|
|
|
533
717
|
),
|
|
534
718
|
limit: z.number().int().positive().optional().describe("Maximum results per entity type. Default: 5. Increase for broader exploration.")
|
|
535
719
|
};
|
|
720
|
+
var outputSchema6 = {
|
|
721
|
+
documents: z.array(
|
|
722
|
+
z.object({
|
|
723
|
+
id: z.string(),
|
|
724
|
+
name: z.string().optional(),
|
|
725
|
+
sourceId: z.string().optional(),
|
|
726
|
+
sourceName: z.string().optional()
|
|
727
|
+
})
|
|
728
|
+
).describe("Documents matching the query."),
|
|
729
|
+
fieldMatches: z.array(
|
|
730
|
+
z.object({
|
|
731
|
+
resolvedFieldId: z.string().nullable(),
|
|
732
|
+
displayName: z.string().optional(),
|
|
733
|
+
matchedValue: z.string().optional(),
|
|
734
|
+
documentCount: z.number().optional(),
|
|
735
|
+
filterable: z.boolean().describe("Only filterable: true entries can be used with talonic_filter.")
|
|
736
|
+
})
|
|
737
|
+
).describe(
|
|
738
|
+
"Field-level matches with a filterable flag indicating whether the entry can drive talonic_filter."
|
|
739
|
+
),
|
|
740
|
+
sources: z.array(z.object({ id: z.string(), name: z.string().optional() })).describe("Source connections matching the query."),
|
|
741
|
+
schemas: z.array(z.object({ id: z.string(), name: z.string().optional() })).describe("Saved schemas matching the query."),
|
|
742
|
+
fields: z.array(
|
|
743
|
+
z.object({
|
|
744
|
+
id: z.string(),
|
|
745
|
+
canonicalName: z.string().optional(),
|
|
746
|
+
displayName: z.string().optional(),
|
|
747
|
+
documentCount: z.number().optional(),
|
|
748
|
+
filterable: z.boolean().optional()
|
|
749
|
+
})
|
|
750
|
+
).describe(
|
|
751
|
+
"Field-registry entries matching the query. filterable: true entries are usable with talonic_filter."
|
|
752
|
+
)
|
|
753
|
+
};
|
|
536
754
|
async function handleSearch(talonic, args) {
|
|
537
755
|
try {
|
|
538
756
|
const result = await talonic.search(
|
|
@@ -550,7 +768,13 @@ function registerSearch(server, talonic) {
|
|
|
550
768
|
{
|
|
551
769
|
title: "Search Talonic Workspace",
|
|
552
770
|
description: DESCRIPTION6,
|
|
553
|
-
inputSchema: inputSchema5
|
|
771
|
+
inputSchema: inputSchema5,
|
|
772
|
+
outputSchema: outputSchema6,
|
|
773
|
+
annotations: {
|
|
774
|
+
title: "Search Talonic Workspace",
|
|
775
|
+
readOnlyHint: true,
|
|
776
|
+
openWorldHint: true
|
|
777
|
+
}
|
|
554
778
|
},
|
|
555
779
|
async (args) => handleSearch(talonic, args)
|
|
556
780
|
);
|
|
@@ -595,6 +819,10 @@ var inputSchema6 = {
|
|
|
595
819
|
),
|
|
596
820
|
file_url: z.string().optional().describe("URL to a document file. The Talonic API fetches it server-side.")
|
|
597
821
|
};
|
|
822
|
+
var outputSchema7 = {
|
|
823
|
+
document_id: z.string().describe("ID of the document the markdown was extracted from."),
|
|
824
|
+
markdown: z.string().describe("OCR-converted markdown text content of the document.")
|
|
825
|
+
};
|
|
598
826
|
var INGEST_ONLY_SCHEMA = {
|
|
599
827
|
type: "object",
|
|
600
828
|
properties: {
|
|
@@ -646,7 +874,14 @@ function registerToMarkdown(server, talonic) {
|
|
|
646
874
|
{
|
|
647
875
|
title: "Document to Markdown",
|
|
648
876
|
description: DESCRIPTION7,
|
|
649
|
-
inputSchema: inputSchema6
|
|
877
|
+
inputSchema: inputSchema6,
|
|
878
|
+
outputSchema: outputSchema7,
|
|
879
|
+
annotations: {
|
|
880
|
+
title: "Document to Markdown",
|
|
881
|
+
readOnlyHint: false,
|
|
882
|
+
destructiveHint: false,
|
|
883
|
+
openWorldHint: true
|
|
884
|
+
}
|
|
650
885
|
},
|
|
651
886
|
async (args) => handleToMarkdown(talonic, args)
|
|
652
887
|
);
|
|
@@ -654,7 +889,7 @@ function registerToMarkdown(server, talonic) {
|
|
|
654
889
|
|
|
655
890
|
// package.json
|
|
656
891
|
var package_default = {
|
|
657
|
-
version: "0.1.
|
|
892
|
+
version: "0.1.18"};
|
|
658
893
|
|
|
659
894
|
// src/version.ts
|
|
660
895
|
var VERSION = package_default.version;
|