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