@pipeworx/mcp-mic 0.0.0-stage → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mojibake Inc.
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 CHANGED
@@ -1,3 +1,126 @@
1
- # Temporary Holding Version
1
+ # @pipeworx/mic
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ISO 10383 Market Identifier Code (MIC) decoder — venue name, operator, country and status behind the 4-character exchange code, no auth.
4
+
5
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1831+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.
6
+
7
+ ## Tools
8
+
9
+ - `decode_mic(code)` — decode one MIC (e.g. `"XNYS"`, `"XLON"`) to the venue's market name, legal operator, LEI, country, city, website and registry status. Reports whether the code is an **operating MIC** (the venue operator as a whole, e.g. `"XNYS"` for the New York Stock Exchange) or a **segment MIC** (one specific market/order book under an operator, e.g. `"ARCX"`, NYSE Arca, under `"XNYS"`). An operating MIC also carries `segment_count` — call `search_mics` with `operating_mic` to list them.
10
+ - `search_mics(country?, operating_mic?, status?, name_contains?, limit?, offset?)` — filter the registry. Returns aggregate counts first (`total`, `by_status`, `by_country`) and a page of rows after. Pass `operating_mic` to list every market under one venue operator; a zero-match combination names the filters tried rather than returning a bare empty array.
11
+
12
+ **Complements `openfigi`**: openfigi returns `exchCode` on a security's exchange listing with no decoder for it — `decode_mic` is that decoder.
13
+
14
+ ## Data source
15
+
16
+ Publisher: ISO, delegated to ANNA (the Association of National Numbering Agencies) as the Registration Authority for ISO 10383 — the Market Identifier Code list, ~2,900 codes. The registry is published as a downloadable file only (no query API), so this pack answers from a baked table refreshed on a schedule rather than a live per-call fetch. `data_as_of` in every response is the capture time the answer reflects.
17
+
18
+ **Licence.** ISO 10383 is a published international standard; ANNA distributes the current MIC list for public reference use.
19
+
20
+ ## Two kinds of MIC
21
+
22
+ ISO 10383 itself distinguishes an **operating MIC** (the venue operator, e.g. `"XNYS"`) from a **segment MIC** (one market under that operator, e.g. `"ARCX"` under `"XNYS"`, or `"XCHI"`, NYSE Texas, also under `"XNYS"`). A security's `exchCode` can be either kind — `decode_mic` reports which, and for an operating MIC, how many segments sit under it.
23
+
24
+ ## Quick Start
25
+
26
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
27
+
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "mic": {
32
+ "url": "https://gateway.pipeworx.io/mic/mcp"
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ### What this endpoint actually serves
39
+
40
+ `tools/list` at `https://gateway.pipeworx.io/mic/mcp` returns the tools in the table
41
+ above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
42
+ `discover_tools`, `search_within`, `remember`/`recall` and the rest of the
43
+ gateway-wide set. So the tool count you see is larger than this table: a
44
+ single-pack endpoint currently lists roughly 30 shared tools alongside the
45
+ pack's own. The connection's `initialize` response states its exact scope, and
46
+ is the authoritative answer for a given day.
47
+
48
+ This is deliberate, not multiplexing by accident. The meta-tools are what let a
49
+ scoped connection answer a question this pack does not cover — via
50
+ `ask_pipeworx`, which routes across the whole catalog — without you adding a
51
+ second MCP server. There is currently no way to mount a pack endpoint without
52
+ them; if the extra schemas cost you more context than the routing is worth,
53
+ connect to the full gateway once rather than to several pack endpoints.
54
+
55
+ Or connect to the full Pipeworx gateway to get every pack's tools listed
56
+ directly, instead of just this one's:
57
+
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "pipeworx": {
62
+ "url": "https://gateway.pipeworx.io/mcp"
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ Both URLs reach the same gateway and the same 1831+ data sources. The
69
+ only difference is which pack's tools are listed **directly**; `ask_pipeworx`
70
+ reaches all of them from either one.
71
+
72
+ ## No MCP client? Call it over HTTP
73
+
74
+ ```bash
75
+ curl -X POST https://gateway.pipeworx.io/v1/tools/decode_mic \
76
+ -H 'Content-Type: application/json' \
77
+ -d '{"code":"XNYS"}'
78
+ ```
79
+
80
+ No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/decode_mic`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.
81
+
82
+ ## Standalone (no gateway account)
83
+
84
+ This package also runs as a local stdio MCP server — no Pipeworx account, no
85
+ gateway round-trip:
86
+
87
+ ```json
88
+ {
89
+ "mcpServers": {
90
+ "mic": {
91
+ "command": "npx",
92
+ "args": ["-y", "@pipeworx/mcp-mic"]
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ Or run it directly to confirm it starts:
99
+
100
+ ```bash
101
+ npx -y @pipeworx/mcp-mic
102
+ ```
103
+
104
+ It speaks MCP over stdin/stdout and answers `initialize`/`tools/list`/`tools/call`
105
+ for **only** this pack's tools — none of the shared meta-tools the gateway
106
+ connection above adds. Same source, same tools, no ask_pipeworx routing.
107
+
108
+ ## Using with ask_pipeworx
109
+
110
+ Instead of calling tools directly, you can ask questions in plain English —
111
+ this works on the pack endpoint above as well as on the full gateway:
112
+
113
+ ```
114
+ ask_pipeworx({ question: "your question about Mic data" })
115
+ ```
116
+
117
+ The gateway picks the right tool and fills the arguments automatically.
118
+
119
+ ## More
120
+
121
+ - [Docs and guides](https://pipeworx.io/docs)
122
+ - [pipeworx.io](https://pipeworx.io)
123
+
124
+ ## License
125
+
126
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ //
3
+ // Entry point for `npx @pipeworx/mcp-<slug>`.
4
+ //
5
+ // Packs ship as raw TypeScript (no build step — see publish-pack.sh for why:
6
+ // tsx sidesteps every extensionless-import / bare-JSON-import edge case a
7
+ // per-pack tsc build would have to solve one pack at a time). This file
8
+ // registers tsx's ESM loader programmatically, then hands off to src/server.ts,
9
+ // which wraps the pack's {tools, callTool} export in a stdio MCP server.
10
+ //
11
+ // Copied verbatim into every published pack repo by scripts/publish-pack.sh —
12
+ // edit this file, not a per-pack copy.
13
+ import { register } from 'tsx/esm/api';
14
+
15
+ register();
16
+
17
+ await import('../src/server.ts');
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "@pipeworx/mcp-mic",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "MIC — ISO 10383 Market Identifier Code decoder (fleet #3261)",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "bin": {
9
+ "mcp-mic": "bin/cli.js"
10
+ },
11
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "mic"],
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/pipeworx-io/mcp-mic.git"
16
+ },
17
+ "scripts": {
18
+ "typecheck": "tsc --noEmit"
19
+ },
20
+ "dependencies": {
21
+ "@modelcontextprotocol/sdk": "^1.30.0",
22
+ "tsx": "^4.19.0"
23
+ },
24
+ "devDependencies": {
25
+ "typescript": "^5.9.3",
26
+ "@cloudflare/workers-types": "^4.20260405.1"
27
+ },
28
+ "pipeworx": {
29
+ "sourceHash": "v1-06db289850363c6fc75c46c9134af215aa4f0d19ac76a83b95bcfc3c0a59cd4b",
30
+ "sourceCommit": "514e3efb42b8d81082c07e01d3ae7654bbf91f52"
31
+ }
32
+ }
package/server.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.pipeworx-io/mic",
4
+ "title": "Mic",
5
+ "description": "MIC — ISO 10383 Market Identifier Code decoder (fleet #3261)",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/mic",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-mic",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/mic/mcp"
16
+ }
17
+ ]
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,261 @@
1
+ interface McpToolDefinition {
2
+ name: string;
3
+ description: string;
4
+ /** Human-facing one-liner (fleet #1967). Optional; consumers fall back to
5
+ * description. Kept in step with shared/src/types.ts — scripts/lib/
6
+ * check-inlined-types.mjs reports drift at publish time. */
7
+ summary?: string;
8
+ inputSchema: {
9
+ type: 'object';
10
+ properties: Record<string, unknown>;
11
+ required?: string[];
12
+ anyOf?: Array<{ required: string[] }>;
13
+ oneOf?: Array<{ required: string[] }>;
14
+ allOf?: Array<{ required: string[] }>;
15
+ };
16
+ outputSchema?: Record<string, unknown>;
17
+ }
18
+
19
+ interface McpToolExport {
20
+ tools: McpToolDefinition[];
21
+ callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
22
+ meter?: { credits: number };
23
+ cost?: Record<string, unknown>;
24
+ provider?: string;
25
+ }
26
+
27
+ /**
28
+ * MIC — ISO 10383 Market Identifier Code decoder (fleet #3261)
29
+ *
30
+ * Decodes the 4-character venue code openfigi returns as `exchCode` on a
31
+ * security's exchange listing (and that most market-data feeds use the same
32
+ * way) to the trading venue's own name, legal operator, country, city and
33
+ * status, per ANNA's Market Identifier Code registry — the Registration
34
+ * Authority for ISO 10383.
35
+ *
36
+ * SHAPE. ANNA publishes the registry as a downloadable file only (checked
37
+ * live 2026-10-17: the registry's own listing page links straight to the
38
+ * file; there is no query API, keyed or otherwise), so this pack answers
39
+ * from a baked table rather than a live per-call fetch — the same "local
40
+ * copy when live fails" shape as every other baked-index pack in this repo
41
+ * (mcps/south-dakota-code is the worked example). The table is uploaded to
42
+ * KV at deploy and injected by the gateway as `args._bakedIndex` on the
43
+ * first call into this pack — see ensureIndex() below and
44
+ * workers/gateway/src/pack-baked-indexes.json. Refresh path:
45
+ * scripts/bake-index.mjs, re-run on a schedule (ANNA updates the registry on
46
+ * an ongoing basis).
47
+ *
48
+ * Two MIC "kinds" (per ISO 10383 itself): an OPERATING MIC names the venue
49
+ * operator as a whole (e.g. "XNYS", the New York Stock Exchange); a SEGMENT
50
+ * MIC names one specific market/order book under that operator (e.g.
51
+ * "ARCX", NYSE Arca, operates under XNYS). decode_mic reports which kind a
52
+ * code is and, for an operating MIC, how many segments sit under it.
53
+ *
54
+ * Tools:
55
+ * - decode_mic: one MIC -> venue name, operator, country, city, status
56
+ * - search_mics: filter the registry by country, operator, status, name
57
+ */
58
+ import type { MicRow } from './mic-index-data.js';
59
+
60
+ const tools: McpToolExport['tools'] = [
61
+ {
62
+ name: 'decode_mic',
63
+ description:
64
+ 'Decode an ISO 10383 Market Identifier Code (MIC) — the 4-character venue code openfigi returns as `exchCode` ' +
65
+ 'on an exchange listing, and the code most market-data feeds use the same way — to the trading venue\'s own ' +
66
+ 'name, legal operator, country, city, website and registry status. Reports whether the code is an OPERATING ' +
67
+ 'MIC (the operator as a whole, e.g. "XNYS") or a SEGMENT MIC (one specific market under an operator, e.g. ' +
68
+ '"ARCX" under "XNYS"); an operating MIC also carries segment_count — call search_mics with operating_mic to list them.',
69
+ summary: 'The venue name, operator, country and status behind an ISO 10383 Market Identifier Code.',
70
+ inputSchema: {
71
+ type: 'object',
72
+ properties: {
73
+ code: { type: 'string', description: '4-character ISO 10383 MIC, e.g. "XNYS" (NYSE) or "XLON" (London Stock Exchange).' },
74
+ },
75
+ required: ['code'],
76
+ },
77
+ },
78
+ {
79
+ name: 'search_mics',
80
+ description:
81
+ 'Filter the ISO 10383 Market Identifier Code registry by country, operating MIC, status and/or a name fragment. ' +
82
+ 'Returns aggregate counts first (total matched, by_status, by_country) and a page of rows after. Use operating_mic ' +
83
+ 'to list every segment market under one venue operator (e.g. every segment under "XNYS").',
84
+ summary: 'Trading venues in the ISO 10383 Market Identifier Code registry, filtered by country, operator, status or name.',
85
+ inputSchema: {
86
+ type: 'object',
87
+ properties: {
88
+ country: { type: 'string', description: 'ISO 3166-1 alpha-2 country code of the venue, e.g. "US", "GB", "JP".' },
89
+ operating_mic: { type: 'string', description: 'List every market (segment or operating) under this operating MIC, e.g. "XNYS" to list NYSE\'s own segments.' },
90
+ status: { type: 'string', description: 'Registry status.', enum: ['ACTIVE', 'UPDATED', 'EXPIRED'] },
91
+ name_contains: { type: 'string', description: 'Case-insensitive fragment of the market name, legal entity name or acronym, e.g. "nasdaq".' },
92
+ limit: { type: 'number', description: 'Rows per page, 1-500 (default 50).' },
93
+ offset: { type: 'number', description: 'Rows to skip for paging (default 0).' },
94
+ },
95
+ },
96
+ },
97
+ ];
98
+
99
+ // fleet #2754: a pack registered in pack-baked-indexes.json must never VALUE
100
+ // import its data module — the whole table would then be evaluated at
101
+ // module scope in every gateway isolate, including ones that never serve
102
+ // this pack. `MicRow` above is a type-only import (erased at build time);
103
+ // the actual rows arrive at runtime via args._bakedIndex, injected by the
104
+ // gateway from KV on the first call into this pack and adopted for the
105
+ // isolate's life.
106
+ let MIC_ROWS: MicRow[] = [];
107
+ let MIC_INDEX_CAPTURED_AT = '';
108
+
109
+ function ensureIndex(args: Record<string, unknown>): void {
110
+ if (MIC_ROWS.length) return;
111
+ const idx = args._bakedIndex as Record<string, unknown> | null | undefined;
112
+ const rows = idx?.MIC_ROWS;
113
+ const capturedAt = idx?.MIC_INDEX_CAPTURED_AT;
114
+ if (!Array.isArray(rows) || rows.length === 0 || typeof capturedAt !== 'string') {
115
+ // Loud on purpose: answering from an empty table would read as "no such
116
+ // MIC" / "no match" — a silent wrong answer indistinguishable from a
117
+ // real miss (docs/silent-zero-policy.md).
118
+ throw new Error(
119
+ `mic: the baked MIC index is unavailable (${idx == null ? 'not injected' : 'malformed'}). ` +
120
+ 'The gateway loads it from KV on the first call into this pack; this is a server-side fault, not an unknown code — retry shortly.',
121
+ );
122
+ }
123
+ MIC_ROWS = rows as MicRow[];
124
+ MIC_INDEX_CAPTURED_AT = capturedAt;
125
+ }
126
+
127
+ // Tuple field indices — see mic-index-data.ts's own header for the full list.
128
+ const F = {
129
+ mic: 0, operatingMic: 1, type: 2, marketName: 3, legalEntityName: 4, lei: 5,
130
+ marketCategoryCode: 6, acronym: 7, countryCode: 8, city: 9, website: 10,
131
+ status: 11, creationDate: 12, lastUpdateDate: 13, lastValidationDate: 14,
132
+ expiryDate: 15, comments: 16,
133
+ } as const;
134
+
135
+ function toRecord(r: MicRow) {
136
+ return {
137
+ mic: r[F.mic],
138
+ operating_mic: r[F.operatingMic] || null,
139
+ type: r[F.type] === 'OPRT' ? 'operating' : r[F.type] === 'SGMT' ? 'segment' : r[F.type] || null,
140
+ market_name: r[F.marketName] || null,
141
+ legal_entity_name: r[F.legalEntityName] || null,
142
+ lei: r[F.lei] || null,
143
+ market_category_code: r[F.marketCategoryCode] || null,
144
+ acronym: r[F.acronym] || null,
145
+ country_code: r[F.countryCode] || null,
146
+ city: r[F.city] || null,
147
+ website: r[F.website] || null,
148
+ status: r[F.status] || null,
149
+ creation_date: r[F.creationDate] || null,
150
+ last_update_date: r[F.lastUpdateDate] || null,
151
+ last_validation_date: r[F.lastValidationDate] || null,
152
+ expiry_date: r[F.expiryDate] || null,
153
+ comments: r[F.comments] || null,
154
+ };
155
+ }
156
+
157
+ function decodeMic(args: Record<string, unknown>) {
158
+ ensureIndex(args);
159
+ const raw = args.code;
160
+ if (typeof raw !== 'string' || !raw.trim()) {
161
+ throw new Error('Required argument "code" is missing or empty. Pass a 4-character MIC like "XNYS" or "XLON".');
162
+ }
163
+ const code = raw.trim().toUpperCase();
164
+ const row = MIC_ROWS.find((r) => r[F.mic] === code);
165
+ if (!row) {
166
+ throw new Error(
167
+ `user_error: "${code}" is not a MIC in the ISO 10383 registry (${MIC_ROWS.length} codes, as of ${MIC_INDEX_CAPTURED_AT}). ` +
168
+ 'Verify the code, or use search_mics to browse by name or country rather than guessing one.',
169
+ );
170
+ }
171
+ const decoded = toRecord(row);
172
+ const segments =
173
+ decoded.type === 'operating'
174
+ ? MIC_ROWS.filter((r) => r[F.operatingMic] === code && r[F.mic] !== code)
175
+ : [];
176
+ return {
177
+ found: true,
178
+ data_as_of: MIC_INDEX_CAPTURED_AT,
179
+ ...decoded,
180
+ ...(decoded.type === 'operating'
181
+ ? {
182
+ segment_count: segments.length,
183
+ ...(segments.length
184
+ ? { note: `This is an operating MIC with ${segments.length} segment market(s) under it — call search_mics with operating_mic: "${code}" to list them.` }
185
+ : {}),
186
+ }
187
+ : {}),
188
+ };
189
+ }
190
+
191
+ function searchMics(args: Record<string, unknown>) {
192
+ ensureIndex(args);
193
+ const country = typeof args.country === 'string' && args.country.trim() ? args.country.trim().toUpperCase() : null;
194
+ const operatingMic = typeof args.operating_mic === 'string' && args.operating_mic.trim() ? args.operating_mic.trim().toUpperCase() : null;
195
+ const status = typeof args.status === 'string' && args.status.trim() ? args.status.trim().toUpperCase() : null;
196
+ const nameContains = typeof args.name_contains === 'string' && args.name_contains.trim() ? args.name_contains.trim().toLowerCase() : null;
197
+ const limit = Math.min(500, Math.max(1, Math.round((args.limit as number) ?? 50)));
198
+ const offset = Math.max(0, Math.round((args.offset as number) ?? 0));
199
+
200
+ if (status && status !== 'ACTIVE' && status !== 'UPDATED' && status !== 'EXPIRED') {
201
+ throw new Error(`user_error: unknown status "${args.status}". Use ACTIVE, UPDATED or EXPIRED.`);
202
+ }
203
+
204
+ const filtersTried: string[] = [];
205
+ if (country) filtersTried.push(`country=${country}`);
206
+ if (operatingMic) filtersTried.push(`operating_mic=${operatingMic}`);
207
+ if (status) filtersTried.push(`status=${status}`);
208
+ if (nameContains) filtersTried.push(`name_contains="${nameContains}"`);
209
+
210
+ const matched = MIC_ROWS.filter((r) => {
211
+ if (country && r[F.countryCode] !== country) return false;
212
+ if (operatingMic && r[F.operatingMic] !== operatingMic) return false;
213
+ if (status && r[F.status] !== status) return false;
214
+ if (nameContains) {
215
+ const hay = `${r[F.marketName]} ${r[F.legalEntityName]} ${r[F.acronym]}`.toLowerCase();
216
+ if (!hay.includes(nameContains)) return false;
217
+ }
218
+ return true;
219
+ });
220
+
221
+ const byStatus: Record<string, number> = {};
222
+ const byCountry: Record<string, number> = {};
223
+ for (const r of matched) {
224
+ byStatus[r[F.status]] = (byStatus[r[F.status]] ?? 0) + 1;
225
+ if (r[F.countryCode]) byCountry[r[F.countryCode]] = (byCountry[r[F.countryCode]] ?? 0) + 1;
226
+ }
227
+
228
+ const page = matched.slice(offset, offset + limit).map(toRecord);
229
+
230
+ return {
231
+ found: matched.length > 0,
232
+ data_as_of: MIC_INDEX_CAPTURED_AT,
233
+ total: matched.length,
234
+ by_status: byStatus,
235
+ by_country: byCountry,
236
+ returned: page.length,
237
+ offset,
238
+ ...(offset + page.length < matched.length ? { next_offset: offset + page.length } : {}),
239
+ ...(matched.length === 0
240
+ ? {
241
+ note: filtersTried.length
242
+ ? `No MIC in the registry (${MIC_ROWS.length} codes, as of ${MIC_INDEX_CAPTURED_AT}) matches: ${filtersTried.join(', ')}. That is a real zero, not an error.`
243
+ : `No filters were given and the registry is unexpectedly empty — this should never happen; treat as a server fault.`,
244
+ }
245
+ : {}),
246
+ rows: page,
247
+ };
248
+ }
249
+
250
+ async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
251
+ switch (name) {
252
+ case 'decode_mic':
253
+ return decodeMic(args);
254
+ case 'search_mics':
255
+ return searchMics(args);
256
+ default:
257
+ throw new Error(`Unknown tool: ${name}`);
258
+ }
259
+ }
260
+
261
+ export default { tools, callTool } satisfies McpToolExport;