bharatlas-mcp 1.6.0 → 1.6.1

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/index.js CHANGED
@@ -9,11 +9,11 @@ import {
9
9
  import { readFileSync, writeFileSync, existsSync, chmodSync } from "node:fs";
10
10
  import { homedir } from "node:os";
11
11
  import { join } from "node:path";
12
- import { INSTRUCTIONS_CORE, READ_TOOLS, readToolRequest, shapeReadResult, toSearchParams } from "./read-tools.js";
12
+ import { INSTRUCTIONS_CORE, READ_TOOLS, readToolRequest, shapeReadResult, toSearchParams, idSegment } from "./read-tools.js";
13
13
  import { withClientIds, importSummary } from "./import-records.js";
14
14
 
15
15
  /** One version for the server and its user agent; bump with every release (version.test.js). */
16
- const VERSION = "1.6.0";
16
+ const VERSION = "1.6.1";
17
17
 
18
18
  const API = process.env.BHARATLAS_API || "https://bharatlas.com/api/v1";
19
19
 
@@ -281,7 +281,7 @@ async function handleTool(name, args) {
281
281
  }
282
282
 
283
283
  case "moderate_record":
284
- return collectApi("POST", `/records/${args.record_id}/moderate`, {
284
+ return collectApi("POST", `/records/${idSegment(args.record_id, "record_id")}/moderate`, {
285
285
  token: tokenFor(args.id, "admin"),
286
286
  body: { status: args.status, reason: args.reason },
287
287
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bharatlas-mcp",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "MCP server for India's open geo data. Query layers, locate points, find nearby features, filter and group data. Also authors collect maps: register a share link, moderate contributions, and publish to the catalog.",
5
5
  "keywords": ["mcp", "india", "geo", "geospatial", "gis", "boundaries", "parquet", "pmtiles", "llm", "claude", "bharatlas", "collect"],
6
6
  "repository": { "type": "git", "url": "git+https://github.com/urbanmorph/geodata.git", "directory": "mcp" },
package/read-tools.js CHANGED
@@ -255,6 +255,14 @@ const READ_NAMES = new Set(READ_TOOLS.map((t) => t.name));
255
255
  const QUERY_RESERVED = new Set(["select", "group_by", "sum", "limit", "where", "order_by", "include_centroid"]);
256
256
 
257
257
  const LAYER_ID = /^[a-zA-Z0-9_-]+$/;
258
+ /** A value going into a URL path (e.g. a collect record id): letters, digits, _ and -
259
+ * only, so a crafted id can't walk to another endpoint (review 2026-11-18). */
260
+ export function idSegment(value, name) {
261
+ const v = String(value ?? "");
262
+ if (!/^[A-Za-z0-9_-]{1,64}$/.test(v)) throw new Error(`${name} must be an id (letters, digits, _ and -)`);
263
+ return v;
264
+ }
265
+
258
266
  function layerPath(id, suffix = "") {
259
267
  if (!LAYER_ID.test(String(id ?? ""))) {
260
268
  throw new Error("layer_id must be a layer ID such as lgd_states (letters, digits, _ and -)");
package/server.json CHANGED
@@ -25,12 +25,12 @@
25
25
  ]
26
26
  }
27
27
  ],
28
- "version": "1.6.0",
28
+ "version": "1.6.1",
29
29
  "packages": [
30
30
  {
31
31
  "registryType": "npm",
32
32
  "identifier": "bharatlas-mcp",
33
- "version": "1.6.0",
33
+ "version": "1.6.1",
34
34
  "transport": {
35
35
  "type": "stdio"
36
36
  }