teryt-mcp 0.1.0 → 0.1.2
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/dist/{chunk-YEPFIU35.js → chunk-Q5BJHXKD.js} +23 -99
- package/dist/cli.d.ts +3 -6
- package/dist/cli.js +12 -20
- package/dist/main.js +1 -1
- package/package.json +10 -12
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
// src/version.ts
|
|
2
|
+
var terytMcpVersion = "0.1.2";
|
|
3
|
+
|
|
1
4
|
// src/features/server-status/application/get-server-status.ts
|
|
2
5
|
function getServerStatus(input) {
|
|
3
6
|
return {
|
|
4
7
|
serverName: "teryt-mcp",
|
|
5
|
-
serverVersion:
|
|
8
|
+
serverVersion: terytMcpVersion,
|
|
6
9
|
frameworkVersion: input.frameworkVersion,
|
|
7
10
|
transport: input.transport,
|
|
8
11
|
dataDir: input.dataDir,
|
|
@@ -951,7 +954,7 @@ async function getPlace(input, dependencies) {
|
|
|
951
954
|
}
|
|
952
955
|
|
|
953
956
|
// src/features/get-place/mcp/get-place.tool.ts
|
|
954
|
-
import { defineTool as defineTool2 } from "@mcp-craftman/core";
|
|
957
|
+
import { defineTool as defineTool2, readRequiredStringField } from "@mcp-craftman/core";
|
|
955
958
|
function createGetPlaceTool(dependencies) {
|
|
956
959
|
return defineTool2({
|
|
957
960
|
name: "get_place",
|
|
@@ -1017,11 +1020,8 @@ function createGetPlaceTool(dependencies) {
|
|
|
1017
1020
|
});
|
|
1018
1021
|
}
|
|
1019
1022
|
function parseInput(input) {
|
|
1020
|
-
if (typeof input !== "object" || input === null || !("id" in input) || typeof input.id !== "string") {
|
|
1021
|
-
throw new Error("get_place requires id.");
|
|
1022
|
-
}
|
|
1023
1023
|
return {
|
|
1024
|
-
id: input
|
|
1024
|
+
id: readRequiredStringField(input, "id", "get_place")
|
|
1025
1025
|
};
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
@@ -1039,7 +1039,7 @@ async function getStreet(input, dependencies) {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
|
|
1041
1041
|
// src/features/get-street/mcp/get-street.tool.ts
|
|
1042
|
-
import { defineTool as defineTool3 } from "@mcp-craftman/core";
|
|
1042
|
+
import { defineTool as defineTool3, readRequiredStringField as readRequiredStringField2 } from "@mcp-craftman/core";
|
|
1043
1043
|
function createGetStreetTool(dependencies) {
|
|
1044
1044
|
return defineTool3({
|
|
1045
1045
|
name: "get_street",
|
|
@@ -1108,11 +1108,8 @@ function createGetStreetTool(dependencies) {
|
|
|
1108
1108
|
});
|
|
1109
1109
|
}
|
|
1110
1110
|
function parseInput2(input) {
|
|
1111
|
-
if (typeof input !== "object" || input === null || !("id" in input) || typeof input.id !== "string") {
|
|
1112
|
-
throw new Error("get_street requires id.");
|
|
1113
|
-
}
|
|
1114
1111
|
return {
|
|
1115
|
-
id: input
|
|
1112
|
+
id: readRequiredStringField2(input, "id", "get_street")
|
|
1116
1113
|
};
|
|
1117
1114
|
}
|
|
1118
1115
|
|
|
@@ -1130,7 +1127,7 @@ async function getUnit(input, dependencies) {
|
|
|
1130
1127
|
}
|
|
1131
1128
|
|
|
1132
1129
|
// src/features/get-unit/mcp/get-unit.tool.ts
|
|
1133
|
-
import { defineTool as defineTool4 } from "@mcp-craftman/core";
|
|
1130
|
+
import { defineTool as defineTool4, readRequiredStringField as readRequiredStringField3 } from "@mcp-craftman/core";
|
|
1134
1131
|
function createGetUnitTool(dependencies) {
|
|
1135
1132
|
return defineTool4({
|
|
1136
1133
|
name: "get_unit",
|
|
@@ -1196,11 +1193,8 @@ function createGetUnitTool(dependencies) {
|
|
|
1196
1193
|
});
|
|
1197
1194
|
}
|
|
1198
1195
|
function parseInput3(input) {
|
|
1199
|
-
if (typeof input !== "object" || input === null || !("id" in input) || typeof input.id !== "string") {
|
|
1200
|
-
throw new Error("get_unit requires id.");
|
|
1201
|
-
}
|
|
1202
1196
|
return {
|
|
1203
|
-
id: input
|
|
1197
|
+
id: readRequiredStringField3(input, "id", "get_unit")
|
|
1204
1198
|
};
|
|
1205
1199
|
}
|
|
1206
1200
|
|
|
@@ -1304,7 +1298,7 @@ function normalizeName(value) {
|
|
|
1304
1298
|
}
|
|
1305
1299
|
|
|
1306
1300
|
// src/features/resolve-address/mcp/resolve-address.tool.ts
|
|
1307
|
-
import { defineTool as defineTool6 } from "@mcp-craftman/core";
|
|
1301
|
+
import { defineTool as defineTool6, readQueryLimitInput } from "@mcp-craftman/core";
|
|
1308
1302
|
function createResolveAddressTool(dependencies) {
|
|
1309
1303
|
return defineTool6({
|
|
1310
1304
|
inputSchema,
|
|
@@ -1317,7 +1311,7 @@ function createResolveAddressTool(dependencies) {
|
|
|
1317
1311
|
readOnlyHint: true
|
|
1318
1312
|
},
|
|
1319
1313
|
handler: async (input) => ({
|
|
1320
|
-
structuredContent: await resolveAddress(
|
|
1314
|
+
structuredContent: await resolveAddress(readQueryLimitInput(input, "resolve_address"), dependencies)
|
|
1321
1315
|
})
|
|
1322
1316
|
});
|
|
1323
1317
|
}
|
|
@@ -1429,19 +1423,6 @@ var outputSchema = {
|
|
|
1429
1423
|
},
|
|
1430
1424
|
required: ["addresses", "stateDate"]
|
|
1431
1425
|
};
|
|
1432
|
-
function parseInput4(input) {
|
|
1433
|
-
if (typeof input !== "object" || input === null || !("query" in input) || typeof input.query !== "string") {
|
|
1434
|
-
throw new Error("resolve_address requires query.");
|
|
1435
|
-
}
|
|
1436
|
-
const limit = "limit" in input ? input.limit : void 0;
|
|
1437
|
-
if (limit !== void 0 && typeof limit !== "number") {
|
|
1438
|
-
throw new Error("resolve_address limit must be a number.");
|
|
1439
|
-
}
|
|
1440
|
-
return {
|
|
1441
|
-
limit,
|
|
1442
|
-
query: input.query
|
|
1443
|
-
};
|
|
1444
|
-
}
|
|
1445
1426
|
|
|
1446
1427
|
// src/features/search-places/application/search-places.ts
|
|
1447
1428
|
var DEFAULT_LIMIT2 = 20;
|
|
@@ -1516,7 +1497,7 @@ function normalizeName2(value) {
|
|
|
1516
1497
|
}
|
|
1517
1498
|
|
|
1518
1499
|
// src/features/search-places/mcp/search-places.tool.ts
|
|
1519
|
-
import { defineTool as defineTool7 } from "@mcp-craftman/core";
|
|
1500
|
+
import { defineTool as defineTool7, readQueryLimitInput as readQueryLimitInput2 } from "@mcp-craftman/core";
|
|
1520
1501
|
function createSearchPlacesTool(dependencies) {
|
|
1521
1502
|
return defineTool7({
|
|
1522
1503
|
name: "search_places",
|
|
@@ -1592,23 +1573,10 @@ function createSearchPlacesTool(dependencies) {
|
|
|
1592
1573
|
readOnlyHint: true
|
|
1593
1574
|
},
|
|
1594
1575
|
handler: async (input) => ({
|
|
1595
|
-
structuredContent: await searchPlaces(
|
|
1576
|
+
structuredContent: await searchPlaces(readQueryLimitInput2(input, "search_places"), dependencies)
|
|
1596
1577
|
})
|
|
1597
1578
|
});
|
|
1598
1579
|
}
|
|
1599
|
-
function parseInput5(input) {
|
|
1600
|
-
if (typeof input !== "object" || input === null || !("query" in input) || typeof input.query !== "string") {
|
|
1601
|
-
throw new Error("search_places requires query.");
|
|
1602
|
-
}
|
|
1603
|
-
const limit = "limit" in input ? input.limit : void 0;
|
|
1604
|
-
if (limit !== void 0 && typeof limit !== "number") {
|
|
1605
|
-
throw new Error("search_places limit must be a number.");
|
|
1606
|
-
}
|
|
1607
|
-
return {
|
|
1608
|
-
limit,
|
|
1609
|
-
query: input.query
|
|
1610
|
-
};
|
|
1611
|
-
}
|
|
1612
1580
|
|
|
1613
1581
|
// src/features/search-streets/application/search-streets.ts
|
|
1614
1582
|
var DEFAULT_LIMIT3 = 20;
|
|
@@ -1683,7 +1651,7 @@ function normalizeName3(value) {
|
|
|
1683
1651
|
}
|
|
1684
1652
|
|
|
1685
1653
|
// src/features/search-streets/mcp/search-streets.tool.ts
|
|
1686
|
-
import { defineTool as defineTool8 } from "@mcp-craftman/core";
|
|
1654
|
+
import { defineTool as defineTool8, readQueryLimitInput as readQueryLimitInput3 } from "@mcp-craftman/core";
|
|
1687
1655
|
function createSearchStreetsTool(dependencies) {
|
|
1688
1656
|
return defineTool8({
|
|
1689
1657
|
inputSchema: inputSchema2,
|
|
@@ -1696,7 +1664,7 @@ function createSearchStreetsTool(dependencies) {
|
|
|
1696
1664
|
readOnlyHint: true
|
|
1697
1665
|
},
|
|
1698
1666
|
handler: async (input) => ({
|
|
1699
|
-
structuredContent: await searchStreets(
|
|
1667
|
+
structuredContent: await searchStreets(readQueryLimitInput3(input, "search_streets"), dependencies)
|
|
1700
1668
|
})
|
|
1701
1669
|
});
|
|
1702
1670
|
}
|
|
@@ -1768,19 +1736,6 @@ var outputSchema2 = {
|
|
|
1768
1736
|
},
|
|
1769
1737
|
required: ["stateDate", "streets"]
|
|
1770
1738
|
};
|
|
1771
|
-
function parseInput6(input) {
|
|
1772
|
-
if (typeof input !== "object" || input === null || !("query" in input) || typeof input.query !== "string") {
|
|
1773
|
-
throw new Error("search_streets requires query.");
|
|
1774
|
-
}
|
|
1775
|
-
const limit = "limit" in input ? input.limit : void 0;
|
|
1776
|
-
if (limit !== void 0 && typeof limit !== "number") {
|
|
1777
|
-
throw new Error("search_streets limit must be a number.");
|
|
1778
|
-
}
|
|
1779
|
-
return {
|
|
1780
|
-
limit,
|
|
1781
|
-
query: input.query
|
|
1782
|
-
};
|
|
1783
|
-
}
|
|
1784
1739
|
|
|
1785
1740
|
// src/features/search-units/application/search-units.ts
|
|
1786
1741
|
var DEFAULT_LIMIT4 = 20;
|
|
@@ -1855,7 +1810,7 @@ function normalizeName4(value) {
|
|
|
1855
1810
|
}
|
|
1856
1811
|
|
|
1857
1812
|
// src/features/search-units/mcp/search-units.tool.ts
|
|
1858
|
-
import { defineTool as defineTool9 } from "@mcp-craftman/core";
|
|
1813
|
+
import { defineTool as defineTool9, readQueryLimitInput as readQueryLimitInput4 } from "@mcp-craftman/core";
|
|
1859
1814
|
function createSearchUnitsTool(dependencies) {
|
|
1860
1815
|
return defineTool9({
|
|
1861
1816
|
name: "search_units",
|
|
@@ -1931,23 +1886,10 @@ function createSearchUnitsTool(dependencies) {
|
|
|
1931
1886
|
readOnlyHint: true
|
|
1932
1887
|
},
|
|
1933
1888
|
handler: async (input) => ({
|
|
1934
|
-
structuredContent: await searchUnits(
|
|
1889
|
+
structuredContent: await searchUnits(readQueryLimitInput4(input, "search_units"), dependencies)
|
|
1935
1890
|
})
|
|
1936
1891
|
});
|
|
1937
1892
|
}
|
|
1938
|
-
function parseInput7(input) {
|
|
1939
|
-
if (typeof input !== "object" || input === null || !("query" in input) || typeof input.query !== "string") {
|
|
1940
|
-
throw new Error("search_units requires query.");
|
|
1941
|
-
}
|
|
1942
|
-
const limit = "limit" in input ? input.limit : void 0;
|
|
1943
|
-
if (limit !== void 0 && typeof limit !== "number") {
|
|
1944
|
-
throw new Error("search_units limit must be a number.");
|
|
1945
|
-
}
|
|
1946
|
-
return {
|
|
1947
|
-
limit,
|
|
1948
|
-
query: input.query
|
|
1949
|
-
};
|
|
1950
|
-
}
|
|
1951
1893
|
|
|
1952
1894
|
// src/features/source-status/application/get-source-status.ts
|
|
1953
1895
|
async function getSourceStatus(input) {
|
|
@@ -2377,7 +2319,7 @@ function createApp(config = loadRuntimeConfig(), overrides = {}) {
|
|
|
2377
2319
|
const syncSource = overrides.syncSource ?? new EterytSource();
|
|
2378
2320
|
return createMcpApp({
|
|
2379
2321
|
name: "teryt-mcp",
|
|
2380
|
-
version:
|
|
2322
|
+
version: terytMcpVersion,
|
|
2381
2323
|
registry: createRegistry({
|
|
2382
2324
|
config,
|
|
2383
2325
|
manifestStore,
|
|
@@ -2402,29 +2344,11 @@ function createApp(config = loadRuntimeConfig(), overrides = {}) {
|
|
|
2402
2344
|
}
|
|
2403
2345
|
|
|
2404
2346
|
// src/server/serve.ts
|
|
2405
|
-
import { loadRuntimeConfig as loadRuntimeConfig2 } from "@mcp-craftman/node";
|
|
2406
|
-
|
|
2407
|
-
// src/server/transports/http.ts
|
|
2408
|
-
import { startHttpServer } from "@mcp-craftman/node";
|
|
2409
|
-
function startHttpTransport(app, options = {}) {
|
|
2410
|
-
return startHttpServer(app, options);
|
|
2411
|
-
}
|
|
2412
|
-
|
|
2413
|
-
// src/server/transports/stdio.ts
|
|
2414
|
-
import { startStdioServer } from "@mcp-craftman/node";
|
|
2415
|
-
function startStdioTransport(app, options = {}) {
|
|
2416
|
-
return startStdioServer(app, options);
|
|
2417
|
-
}
|
|
2418
|
-
|
|
2419
|
-
// src/server/serve.ts
|
|
2347
|
+
import { loadRuntimeConfig as loadRuntimeConfig2, serveMcpApp } from "@mcp-craftman/node";
|
|
2420
2348
|
async function serve(config = loadRuntimeConfig2()) {
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
port: config.port
|
|
2425
|
-
});
|
|
2426
|
-
}
|
|
2427
|
-
return startStdioTransport(app);
|
|
2349
|
+
return serveMcpApp(createApp, {
|
|
2350
|
+
config
|
|
2351
|
+
});
|
|
2428
2352
|
}
|
|
2429
2353
|
|
|
2430
2354
|
export {
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { RuntimeConfig, CliIo } from '@mcp-craftman/node';
|
|
2
3
|
import * as _mcp_craftman_core from '@mcp-craftman/core';
|
|
3
|
-
import { RuntimeConfig } from '@mcp-craftman/node';
|
|
4
4
|
|
|
5
5
|
type DatasetCode = "TERC" | "SIMC" | "ULIC" | "WMRODZ";
|
|
6
6
|
|
|
@@ -19,12 +19,9 @@ type CreateAppOverrides = {
|
|
|
19
19
|
};
|
|
20
20
|
declare function createApp(config?: RuntimeConfig, overrides?: CreateAppOverrides): _mcp_craftman_core.McpApp;
|
|
21
21
|
|
|
22
|
-
type
|
|
22
|
+
type TerytCliIo = CliIo & {
|
|
23
23
|
readonly appFactory?: typeof createApp;
|
|
24
|
-
readonly env: NodeJS.ProcessEnv;
|
|
25
|
-
readonly stderr: NodeJS.WritableStream;
|
|
26
|
-
readonly stdout: NodeJS.WritableStream;
|
|
27
24
|
};
|
|
28
|
-
declare function runCli(argv?: readonly string[], io?:
|
|
25
|
+
declare function runCli(argv?: readonly string[], io?: TerytCliIo): Promise<void>;
|
|
29
26
|
|
|
30
27
|
export { runCli };
|
package/dist/cli.js
CHANGED
|
@@ -3,12 +3,17 @@ import {
|
|
|
3
3
|
createApp,
|
|
4
4
|
getServerStatus,
|
|
5
5
|
serve
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Q5BJHXKD.js";
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import {
|
|
10
|
+
createDefaultCliIo,
|
|
11
|
+
isCliEntrypoint,
|
|
12
|
+
loadRuntimeConfig,
|
|
13
|
+
writeCliToolStructuredContent,
|
|
14
|
+
writeJson
|
|
15
|
+
} from "@mcp-craftman/node";
|
|
16
|
+
import { mcpCraftmanCoreVersion } from "@mcp-craftman/core";
|
|
12
17
|
async function runCli(argv = process.argv.slice(2), io = defaultIo()) {
|
|
13
18
|
const [command, ...args] = argv;
|
|
14
19
|
if (command === "serve") {
|
|
@@ -41,20 +46,11 @@ async function runCli(argv = process.argv.slice(2), io = defaultIo()) {
|
|
|
41
46
|
}
|
|
42
47
|
throw new Error(`Unknown command: ${command ?? "<missing>"}`);
|
|
43
48
|
}
|
|
44
|
-
function writeJson(stream, value) {
|
|
45
|
-
stream.write(`${JSON.stringify(value, null, 2)}
|
|
46
|
-
`);
|
|
47
|
-
}
|
|
48
49
|
async function writeCliToolResult(stream, toolName, input, io) {
|
|
49
|
-
|
|
50
|
-
writeJson(stream, result.structuredContent);
|
|
50
|
+
await writeCliToolStructuredContent(stream, io.appFactory ?? createApp, toolName, input, io.env);
|
|
51
51
|
}
|
|
52
52
|
function defaultIo() {
|
|
53
|
-
return
|
|
54
|
-
env: process.env,
|
|
55
|
-
stderr: process.stderr,
|
|
56
|
-
stdout: process.stdout
|
|
57
|
-
};
|
|
53
|
+
return createDefaultCliIo();
|
|
58
54
|
}
|
|
59
55
|
async function runSearchCommand(args, io) {
|
|
60
56
|
const [scope, ...queryParts] = args;
|
|
@@ -111,11 +107,7 @@ function parseSyncMode(args) {
|
|
|
111
107
|
}
|
|
112
108
|
return "missing";
|
|
113
109
|
}
|
|
114
|
-
|
|
115
|
-
const entrypoint = argvPath ? basename(argvPath) : "";
|
|
116
|
-
return entrypoint === "teryt-mcp" || entrypoint === "cli.js";
|
|
117
|
-
}
|
|
118
|
-
if (isCliEntrypoint()) {
|
|
110
|
+
if (isCliEntrypoint("teryt-mcp")) {
|
|
119
111
|
runCli().catch((error) => {
|
|
120
112
|
process.stderr.write(`${error instanceof Error ? error.message : String(error)}
|
|
121
113
|
`);
|
package/dist/main.js
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "teryt-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "MCP server for the official Polish TERYT registry.",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"packageManager": "pnpm@10.12.1",
|
|
8
7
|
"bin": {
|
|
9
8
|
"teryt-mcp": "dist/cli.js"
|
|
10
9
|
},
|
|
@@ -15,20 +14,14 @@
|
|
|
15
14
|
"publishConfig": {
|
|
16
15
|
"access": "public"
|
|
17
16
|
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "tsup src/main.ts src/cli.ts --format esm --dts --clean",
|
|
20
|
-
"prepare": "git rev-parse --is-inside-work-tree >/dev/null 2>&1 && git config core.hooksPath .githooks || true",
|
|
21
|
-
"quality": "mcp-craftman quality",
|
|
22
|
-
"test": "vitest run"
|
|
23
|
-
},
|
|
24
17
|
"dependencies": {
|
|
25
|
-
"@mcp-craftman/core": "^0.1.
|
|
26
|
-
"@mcp-craftman/node": "^0.1.
|
|
18
|
+
"@mcp-craftman/core": "^0.1.3",
|
|
19
|
+
"@mcp-craftman/node": "^0.1.2",
|
|
27
20
|
"fflate": "^0.8.3",
|
|
28
21
|
"sql.js": "^1.14.1"
|
|
29
22
|
},
|
|
30
23
|
"devDependencies": {
|
|
31
|
-
"@mcp-craftman/cli": "^0.1.
|
|
24
|
+
"@mcp-craftman/cli": "^0.1.5",
|
|
32
25
|
"@types/node": "^24.0.3",
|
|
33
26
|
"@types/sql.js": "^1.4.11",
|
|
34
27
|
"@vitest/coverage-v8": "^3.2.4",
|
|
@@ -43,5 +36,10 @@
|
|
|
43
36
|
},
|
|
44
37
|
"engines": {
|
|
45
38
|
"node": ">=20.19.0"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup src/main.ts src/cli.ts --format esm --dts --clean",
|
|
42
|
+
"quality": "mcp-craftman quality",
|
|
43
|
+
"test": "vitest run"
|
|
46
44
|
}
|
|
47
|
-
}
|
|
45
|
+
}
|