dogpolicies-mcp 0.2.2 → 0.2.3
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 +4 -0
- package/package.json +2 -2
- package/server.json +2 -2
- package/src/dogpolicies/connect.mjs +102 -5
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,10 @@ The data inside the package has its own date (`as_of` in every result). A
|
|
|
10
10
|
new package version ships a new snapshot; the server also refreshes from the
|
|
11
11
|
site on its own when the network allows.
|
|
12
12
|
|
|
13
|
+
## 0.2.3 - 2026-10-31
|
|
14
|
+
|
|
15
|
+
- Smaller, cleaner install: the MCP client SDK is no longer a dependency. `demo`, `check` and `connectInProcess` use a small built-in client over the in-memory transport. The client SDK pulled in process-spawning and other code a server never runs, which supply-chain scanners flag.
|
|
16
|
+
|
|
13
17
|
## 0.2.2 - 2026-10-31
|
|
14
18
|
|
|
15
19
|
- Tests run on Node 20 again: `npm test` builds the file list itself instead of relying on `node --test` glob support (Node 22+). No change to the server.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dogpolicies-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "MCP server for verified dog rules at California and Nevada parks, beaches, trails, hotels, campgrounds and restaurant patios: leash rules, pet fees, weight limits, trip planning, every fact with its official source and the date it was checked.",
|
|
5
5
|
"mcpName": "io.github.xultrax-web/dogpolicies-mcp",
|
|
6
6
|
"type": "module",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"format": "prettier --write ."
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@modelcontextprotocol/client": "^2.4.0",
|
|
56
55
|
"@modelcontextprotocol/server": "^2.4.0",
|
|
57
56
|
"zod": "^4.2.0"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
59
|
+
"@modelcontextprotocol/client": "^2.4.0",
|
|
60
60
|
"prettier": "^3.9.10"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
package/server.json
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"url": "https://github.com/xultrax-web/dogpolicies-mcp",
|
|
9
9
|
"source": "github"
|
|
10
10
|
},
|
|
11
|
-
"version": "0.2.
|
|
11
|
+
"version": "0.2.3",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "npm",
|
|
15
15
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
16
16
|
"identifier": "dogpolicies-mcp",
|
|
17
|
-
"version": "0.2.
|
|
17
|
+
"version": "0.2.3",
|
|
18
18
|
"runtimeHint": "npx",
|
|
19
19
|
"transport": {
|
|
20
20
|
"type": "stdio"
|
|
@@ -1,11 +1,108 @@
|
|
|
1
1
|
// An in-process client over an in-memory transport: what `check`, `demo`
|
|
2
2
|
// and the unit tests use to call tools exactly as an AI client would,
|
|
3
|
-
// without a child process.
|
|
3
|
+
// without a child process. It speaks the same JSON-RPC as any MCP client
|
|
4
|
+
// but needs no client SDK, so the package ships only the server SDK (the
|
|
5
|
+
// client SDK brings process-spawning code a server never needs).
|
|
4
6
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
+
import {
|
|
8
|
+
InMemoryTransport,
|
|
9
|
+
LATEST_PROTOCOL_VERSION,
|
|
10
|
+
} from "@modelcontextprotocol/server";
|
|
7
11
|
import { createServer } from "./server.mjs";
|
|
8
12
|
|
|
13
|
+
/** The subset of an MCP client this package needs, over one transport. */
|
|
14
|
+
class LocalClient {
|
|
15
|
+
#transport;
|
|
16
|
+
#nextId = 1;
|
|
17
|
+
#pending = new Map();
|
|
18
|
+
|
|
19
|
+
constructor(transport, info) {
|
|
20
|
+
this.#transport = transport;
|
|
21
|
+
this.info = info;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async connect() {
|
|
25
|
+
this.#transport.onmessage = (msg) => this.#receive(msg);
|
|
26
|
+
this.#transport.onclose = () => this.#failAll(new Error("connection closed"));
|
|
27
|
+
await this.#transport.start();
|
|
28
|
+
this.initialize = await this.#request("initialize", {
|
|
29
|
+
protocolVersion: LATEST_PROTOCOL_VERSION,
|
|
30
|
+
capabilities: {},
|
|
31
|
+
clientInfo: this.info,
|
|
32
|
+
});
|
|
33
|
+
await this.#transport.send({ jsonrpc: "2.0", method: "notifications/initialized" });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#receive(msg) {
|
|
37
|
+
if (msg.id !== undefined && (msg.result !== undefined || msg.error)) {
|
|
38
|
+
const waiting = this.#pending.get(msg.id);
|
|
39
|
+
if (!waiting) return;
|
|
40
|
+
this.#pending.delete(msg.id);
|
|
41
|
+
if (msg.error) {
|
|
42
|
+
const err = new Error(`MCP error ${msg.error.code}: ${msg.error.message}`);
|
|
43
|
+
err.code = msg.error.code;
|
|
44
|
+
err.data = msg.error.data;
|
|
45
|
+
waiting.reject(err);
|
|
46
|
+
} else waiting.resolve(msg.result);
|
|
47
|
+
} else if (msg.id !== undefined && msg.method) {
|
|
48
|
+
// A request from the server (ping, roots, sampling): answer ping, decline the rest.
|
|
49
|
+
const reply =
|
|
50
|
+
msg.method === "ping"
|
|
51
|
+
? { jsonrpc: "2.0", id: msg.id, result: {} }
|
|
52
|
+
: { jsonrpc: "2.0", id: msg.id, error: { code: -32601, message: "Method not found" } };
|
|
53
|
+
this.#transport.send(reply).catch(() => {});
|
|
54
|
+
}
|
|
55
|
+
// Notifications (logging, list changes) are not needed in-process.
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#failAll(err) {
|
|
59
|
+
for (const { reject } of this.#pending.values()) reject(err);
|
|
60
|
+
this.#pending.clear();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#request(method, params) {
|
|
64
|
+
const id = this.#nextId++;
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
66
|
+
this.#pending.set(id, { resolve, reject });
|
|
67
|
+
this.#transport
|
|
68
|
+
.send({ jsonrpc: "2.0", id, method, ...(params === undefined ? {} : { params }) })
|
|
69
|
+
.catch((e) => {
|
|
70
|
+
this.#pending.delete(id);
|
|
71
|
+
reject(e);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
listTools(params) {
|
|
77
|
+
return this.#request("tools/list", params);
|
|
78
|
+
}
|
|
79
|
+
callTool(params) {
|
|
80
|
+
return this.#request("tools/call", params);
|
|
81
|
+
}
|
|
82
|
+
listResources(params) {
|
|
83
|
+
return this.#request("resources/list", params);
|
|
84
|
+
}
|
|
85
|
+
listResourceTemplates(params) {
|
|
86
|
+
return this.#request("resources/templates/list", params);
|
|
87
|
+
}
|
|
88
|
+
readResource(params) {
|
|
89
|
+
return this.#request("resources/read", params);
|
|
90
|
+
}
|
|
91
|
+
listPrompts(params) {
|
|
92
|
+
return this.#request("prompts/list", params);
|
|
93
|
+
}
|
|
94
|
+
getPrompt(params) {
|
|
95
|
+
return this.#request("prompts/get", params);
|
|
96
|
+
}
|
|
97
|
+
complete(params) {
|
|
98
|
+
return this.#request("completion/complete", params);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async close() {
|
|
102
|
+
await this.#transport.close();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
9
106
|
/** Connects a client to a fresh server over the runtime. Returns { client, close }. */
|
|
10
107
|
export async function connectInProcess(
|
|
11
108
|
ctx,
|
|
@@ -15,8 +112,8 @@ export async function connectInProcess(
|
|
|
15
112
|
InMemoryTransport.createLinkedPair();
|
|
16
113
|
const server = createServer(ctx);
|
|
17
114
|
await server.connect(serverTransport);
|
|
18
|
-
const client = new
|
|
19
|
-
await client.connect(
|
|
115
|
+
const client = new LocalClient(clientTransport, { name: clientName, version: "1.0.0" });
|
|
116
|
+
await client.connect();
|
|
20
117
|
return {
|
|
21
118
|
client,
|
|
22
119
|
server,
|