dogpolicies-mcp 0.2.2 → 0.2.4

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 CHANGED
@@ -10,6 +10,18 @@ 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.4 - 2026-10-31
14
+
15
+ - The registry listing names the hosted server, https://dogpolicies.com/mcp/, now that the site is live on Cloudflare.
16
+
17
+ - Bundler-friendly for other runtimes: `package.json` is read with a static JSON import and the bundled snapshot
18
+ path is only resolved when `import.meta.url` exists. No change for npm users; the site's Cloudflare Worker now
19
+ runs this package inside a Durable Object.
20
+
21
+ ## 0.2.3 - 2026-10-31
22
+
23
+ - 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.
24
+
13
25
  ## 0.2.2 - 2026-10-31
14
26
 
15
27
  - 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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dogpolicies-mcp",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
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.2",
11
+ "version": "0.2.4",
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.2",
17
+ "version": "0.2.4",
18
18
  "runtimeHint": "npx",
19
19
  "transport": {
20
20
  "type": "stdio"
@@ -37,6 +37,12 @@
37
37
  ]
38
38
  }
39
39
  ],
40
+ "remotes": [
41
+ {
42
+ "type": "streamable-http",
43
+ "url": "https://dogpolicies.com/mcp/"
44
+ }
45
+ ],
40
46
  "_meta": {
41
47
  "io.modelcontextprotocol.registry/publisher-provided": {
42
48
  "tool": "dogpolicies-release",
package/src/config.mjs CHANGED
@@ -4,10 +4,9 @@
4
4
  // Values can be overridden at runtime through the environment, so the same
5
5
  // build works before the domain is final and after it moves.
6
6
 
7
- import { createRequire } from "node:module";
8
-
9
- const require = createRequire(import.meta.url);
10
- const pkg = require("../package.json");
7
+ // A static JSON import (import attributes, Node 20.10+), so bundlers that
8
+ // target other runtimes (the site's Cloudflare Worker) can inline it.
9
+ import pkg from "../package.json" with { type: "json" };
11
10
 
12
11
  /** The npm package name, from package.json (the single config point). */
13
12
  export const PACKAGE_NAME = pkg.name;
@@ -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 { Client } from "@modelcontextprotocol/client";
6
- import { InMemoryTransport } from "@modelcontextprotocol/server";
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 Client({ name: clientName, version: "1.0.0" });
19
- await client.connect(clientTransport);
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,
@@ -31,7 +31,9 @@ import { tools } from "./tools/index.mjs";
31
31
  import { resources } from "./resources.mjs";
32
32
  import { prompts } from "./prompts.mjs";
33
33
 
34
- const HERE = dirname(fileURLToPath(import.meta.url));
34
+ // import.meta.url is undefined when the package is bundled for another runtime
35
+ // (the site's Cloudflare Worker), which always passes a snapshot object instead.
36
+ const HERE = import.meta.url ? dirname(fileURLToPath(import.meta.url)) : ".";
35
37
  export const BUNDLED_SNAPSHOT = join(
36
38
  HERE,
37
39
  "..",