@talonic/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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Project skeleton: TypeScript strict mode, `tsup` ESM build with shebang banner, Vitest, GitHub Actions CI matrix on Node 18, 20, 22.
13
+ - Stdio MCP server built on `@modelcontextprotocol/sdk` and `@talonic/node`.
14
+ - Seven tools registered: `talonic_extract`, `talonic_search`, `talonic_filter`, `talonic_get_document`, `talonic_to_markdown`, `talonic_list_schemas`, `talonic_save_schema`.
15
+ - One resource registered: `talonic://schemas` (browseable list of saved schemas).
16
+ - Field-name resolution in `talonic_filter`: pass human-readable field names; the SDK resolves them to internal field IDs via `/fields/autocomplete`.
17
+ - README with install snippets for Claude Desktop, Cursor, Cline, Continue, and Cowork.
18
+ - MIT license.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Talonic GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,197 @@
1
+ # @talonic/mcp
2
+
3
+ Official Talonic MCP server. Lets AI agents extract structured, schema-validated data from any document via the [Model Context Protocol](https://modelcontextprotocol.io).
4
+
5
+ > **Status:** v0.1.0 with seven tools and one resource live: `talonic_extract`, `talonic_search`, `talonic_filter`, `talonic_get_document`, `talonic_to_markdown`, `talonic_list_schemas`, `talonic_save_schema`, plus the `talonic://schemas` resource.
6
+
7
+ ## Why an agent should use this
8
+
9
+ When an agent needs to pull structured data out of a PDF, scan, image, or messy document, the usual approach is raw OCR plus an LLM call. Results are unreliable; tables get mangled, dates get misread, totals drift.
10
+
11
+ With this MCP server installed, the agent has a `talonic_extract` tool that returns schema-validated JSON with per-field confidence scores, a detected document type, and stable IDs for follow-up calls. Six other tools cover the rest of the workflow: searching the workspace, filtering by extracted field values, fetching a document's metadata, getting OCR markdown, listing saved schemas, and saving new ones.
12
+
13
+ ## Get an API key (30 seconds)
14
+
15
+ Each user runs against their own isolated Talonic workspace. Your documents and schemas are private to you.
16
+
17
+ 1. Sign up at [https://app.talonic.com](https://app.talonic.com). Free tier: 50 extractions per day, no credit card.
18
+ 2. Settings → API Keys → Create New Key.
19
+ 3. Copy the `tlnc_` value into your MCP client config (snippets below).
20
+
21
+ ## Install
22
+
23
+ There are two paths today: a local-checkout path that works right now, and a one-line `npx` path that becomes available once we publish to npm.
24
+
25
+ ### A. Local checkout (works today)
26
+
27
+ ```bash
28
+ # 1. Clone the SDK and the MCP server
29
+ git clone https://github.com/talonicdev/talonic-node.git
30
+ git clone https://github.com/talonicdev/talonic-mcp.git
31
+
32
+ # 2. Build the SDK (the MCP server depends on it)
33
+ cd talonic-node
34
+ npm install
35
+ npm run build
36
+
37
+ # 3. Build the MCP server
38
+ cd ../talonic-mcp
39
+ npm install
40
+ npm run build
41
+ ```
42
+
43
+ Then point your MCP client at the absolute path to `dist/server.js`. Snippets per client below.
44
+
45
+ ### B. Published npm package (coming soon)
46
+
47
+ Once `@talonic/mcp` is on npm, the install becomes:
48
+
49
+ ```jsonc
50
+ {
51
+ "command": "npx",
52
+ "args": ["-y", "@talonic/mcp"],
53
+ "env": { "TALONIC_API_KEY": "tlnc_..." }
54
+ }
55
+ ```
56
+
57
+ No clone, no build. The `-y` flag skips the install prompt.
58
+
59
+ ## MCP client setup
60
+
61
+ ### Claude Desktop
62
+
63
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
64
+
65
+ ```json
66
+ {
67
+ "mcpServers": {
68
+ "talonic": {
69
+ "command": "node",
70
+ "args": ["/absolute/path/to/talonic-mcp/dist/server.js"],
71
+ "env": {
72
+ "TALONIC_API_KEY": "tlnc_your_key_here"
73
+ }
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ Restart Claude Desktop. Talonic appears in the connected servers list with all seven tools.
80
+
81
+ ### Cursor
82
+
83
+ Edit `~/.cursor/mcp.json` (or open Cursor settings → MCP → edit config):
84
+
85
+ ```json
86
+ {
87
+ "mcpServers": {
88
+ "talonic": {
89
+ "command": "node",
90
+ "args": ["/absolute/path/to/talonic-mcp/dist/server.js"],
91
+ "env": {
92
+ "TALONIC_API_KEY": "tlnc_your_key_here"
93
+ }
94
+ }
95
+ }
96
+ }
97
+ ```
98
+
99
+ ### Cline (VS Code extension)
100
+
101
+ Open the Cline panel → settings (gear icon) → MCP Servers → Edit. Add the entry above. Save and restart the panel.
102
+
103
+ ### Continue (VS Code / JetBrains)
104
+
105
+ Edit `~/.continue/config.json`. Add to the `mcpServers` array:
106
+
107
+ ```json
108
+ {
109
+ "name": "talonic",
110
+ "command": "node",
111
+ "args": ["/absolute/path/to/talonic-mcp/dist/server.js"],
112
+ "env": {
113
+ "TALONIC_API_KEY": "tlnc_your_key_here"
114
+ }
115
+ }
116
+ ```
117
+
118
+ ### Cowork
119
+
120
+ Open Cowork settings → MCP Servers → Add. Use the same shape as Claude Desktop.
121
+
122
+ ## Tool reference
123
+
124
+ Each tool's description is written for an LLM, with explicit USE WHEN / DO NOT USE WHEN sections. Agents pick the right tool reliably without further prompting. Briefly:
125
+
126
+ - **`talonic_extract`** — Extract structured, schema-validated data from a document. Inputs: one of `file_path`, `file_url`, `document_id`, plus a `schema` (or `schema_id`). Returns clean JSON with per-field confidence scores.
127
+ - **`talonic_search`** — Omnisearch across documents, fields, sources, and schemas in the workspace. Use for conceptual or fuzzy queries.
128
+ - **`talonic_filter`** — Filter documents by extracted field values using composable conditions (`eq`, `gt`, `between`, `contains`, etc.). Field names are auto-resolved to internal IDs.
129
+ - **`talonic_get_document`** — Fetch full metadata for a single document by id, including processing log and link URLs.
130
+ - **`talonic_to_markdown`** — Get OCR-converted markdown for a document already in the workspace.
131
+ - **`talonic_list_schemas`** — List all saved schemas with their definitions.
132
+ - **`talonic_save_schema`** — Save a schema definition to the workspace for reuse.
133
+
134
+ The `talonic://schemas` resource exposes the saved-schemas list to clients that browse resources separately (Claude Desktop and Cowork render these in the UI).
135
+
136
+ ## How it works
137
+
138
+ ```
139
+ Agent (Claude Desktop / Cursor / Cline / etc.)
140
+ ↓ MCP protocol over stdio
141
+ Talonic MCP server (this package)
142
+ ↓ HTTPS, Bearer auth
143
+ api.talonic.com
144
+ ```
145
+
146
+ Each tool call is one HTTP request to the Talonic API, using your API key. The server handles auth, retries on transient failures (429, 5xx), MIME-type detection on file uploads, multipart serialisation, and structured error formatting.
147
+
148
+ ## Configuration
149
+
150
+ Set via the `env` block in your MCP client config:
151
+
152
+ | Variable | Required | Description |
153
+ |---|---|---|
154
+ | `TALONIC_API_KEY` | yes | Your Talonic API key. Starts with `tlnc_`. |
155
+ | `TALONIC_BASE_URL` | no | Override the API base URL. Default: `https://api.talonic.com`. |
156
+
157
+ ## Troubleshooting
158
+
159
+ **Tool calls return `Error: TALONIC_API_KEY environment variable is required.`**
160
+ The `env` block in your MCP client config is missing or not being read. Double-check the JSON shape. After editing the config, fully restart the client (not just the conversation).
161
+
162
+ **Talonic does not appear in the connected servers list.**
163
+ Check the absolute path in `args` is correct and that `dist/server.js` exists. Try running it directly: `node /absolute/path/to/talonic-mcp/dist/server.js --version`. It should print `talonic 0.1.0`.
164
+
165
+ **`talonic_extract` returns 500 INTERNAL_ERROR with auto-discovery.**
166
+ Known limitation. Always provide either an inline `schema` or a `schema_id`. The platform team is stabilising the auto-discovery code path.
167
+
168
+ **`talonic_extract` rejects with `unsupported_file_type`.**
169
+ The MIME type was inferred as `application/octet-stream`. The SDK now infers from common file extensions; if your filename has an unusual extension, pass `content_type` explicitly to the SDK call (the MCP layer does not yet expose this; a future tool version will).
170
+
171
+ **`talonic_filter` errors with `field_not_found`.**
172
+ The field name does not exist in your workspace yet. Run `talonic_search` or `talonic_list_schemas` first to discover available field names.
173
+
174
+ **Tool descriptions look wrong in my client.**
175
+ Some MCP clients cache tool descriptions. Restart the client after a server update.
176
+
177
+ ## Known limitations (v0.1)
178
+
179
+ - Auto-discovery extract (no schema) is not reliable on production. Always pass a schema.
180
+ - The simplified-fields schema format `{ fields: [...] }` is unstable on production. Use flat-map (`{ vendor_name: "string", ... }`) or full JSON Schema.
181
+ - `talonic_to_markdown` requires an existing `document_id`. To convert a fresh file, call `talonic_extract` first with a minimal schema, then `talonic_to_markdown` with the resulting `document.id`.
182
+ - The `@talonic/node` SDK is not yet on npm; install via local checkout for now.
183
+
184
+ ## Develop
185
+
186
+ ```bash
187
+ git clone https://github.com/talonicdev/talonic-mcp.git
188
+ cd talonic-mcp
189
+ npm install
190
+ npm run build
191
+ npm test
192
+ node dist/server.js --version
193
+ ```
194
+
195
+ ## License
196
+
197
+ MIT (c) Talonic GmbH
@@ -0,0 +1,65 @@
1
+ import { Talonic } from '@talonic/node';
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+
4
+ /**
5
+ * Options for {@link createServer}.
6
+ *
7
+ * @public
8
+ */
9
+ interface CreateServerOptions {
10
+ /**
11
+ * Talonic API key. Required. Starts with `tlnc_`.
12
+ *
13
+ * Each user must provide their own key. Workspaces are isolated.
14
+ */
15
+ apiKey: string;
16
+ /**
17
+ * Override the Talonic API base URL. Defaults to `https://api.talonic.com`.
18
+ * Useful for staging or testing.
19
+ */
20
+ baseUrl?: string;
21
+ /**
22
+ * Inject a pre-configured Talonic SDK client. Useful for tests and for
23
+ * advanced setups where the SDK has custom retry policies or
24
+ * instrumentation. When provided, `apiKey` and `baseUrl` are ignored.
25
+ */
26
+ talonic?: Talonic;
27
+ }
28
+ /**
29
+ * Build a Talonic MCP server, ready to be connected to a transport
30
+ * (stdio for local installs, HTTP for the hosted endpoint).
31
+ *
32
+ * Tools, resources, and prompts are registered onto the server in
33
+ * subsequent milestones. v0.1 ships a working scaffold so the
34
+ * rest of the protocol surface can be added incrementally without
35
+ * destabilising the connection layer.
36
+ *
37
+ * @example Minimal stdio server:
38
+ * ```ts
39
+ * import { createServer } from "@talonic/mcp"
40
+ * import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
41
+ *
42
+ * const server = createServer({ apiKey: process.env.TALONIC_API_KEY! })
43
+ * await server.connect(new StdioServerTransport())
44
+ * ```
45
+ *
46
+ * @public
47
+ */
48
+ declare function createServer(options: CreateServerOptions): McpServer;
49
+
50
+ /**
51
+ * The current MCP server version. Sent in the server `info` block during
52
+ * the MCP handshake. Kept in sync with package.json by the release process.
53
+ *
54
+ * @public
55
+ */
56
+ declare const VERSION = "0.1.0";
57
+ /**
58
+ * The MCP server name. Identifies the server to MCP clients (Claude
59
+ * Desktop, Cursor, Cline, etc.) when they list connected servers.
60
+ *
61
+ * @public
62
+ */
63
+ declare const SERVER_NAME = "talonic";
64
+
65
+ export { type CreateServerOptions, SERVER_NAME, VERSION, createServer };