bharatlas-mcp 1.1.1 → 1.2.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/README.md CHANGED
@@ -36,7 +36,7 @@ Add to your MCP client config:
36
36
  |------|-------------|
37
37
  | **list_layers** | Discover layers by category, level, source, or text search |
38
38
  | **get_layer_schema** | Column names, types, distinct values. Call before querying. |
39
- | **query_layer** | Filter, select, group_by on any column. Runtime parquet reads. |
39
+ | **query_layer** | Filter, select, group_by on any column, with per-group sums of numeric columns. Runtime parquet reads. |
40
40
  | **locate** | Point-in-polygon: what state, district, ward, zone is this point in? |
41
41
  | **nearby** | Find features within a radius. Works for points, polygons, and lines. |
42
42
  | **get_layer_detail** | Download URLs in 5 formats (parquet, pmtiles, geojson, kml, shapefile) |
package/index.js CHANGED
@@ -28,14 +28,16 @@ Workflow patterns:
28
28
  - **Discovery**: start with list_layers or list_categories to find relevant layers. Use the q parameter for text search.
29
29
  - **Schema first**: always call get_layer_schema BEFORE query_layer. Column names vary per layer (e.g. "state" vs "State_LGD" vs "stname"). The schema shows exact names and sample values.
30
30
  - **Filtering**: query_layer where conditions are case-insensitive. Pass column=value pairs. Check the schema for the right column name and value format.
31
- - **Counting**: use group_by to count features by any column. Example: group_by "type" on wildlife layer returns counts per category.
32
- - **Location queries**: locate returns all admin boundaries + zones at a lat/lng. Use it to answer "what state/district/ward is this point in?"
31
+ - **Counting**: use group_by to count features by any column. Example: group_by "category" on the gs_wildlife layer returns national parks vs sanctuaries.
32
+ - **Totals**: add sum (numeric columns) to group_by to total values per group, e.g. group_by "district" + sum ["area_ha"] rolls block-level areas up to districts. Percentages are not additive: sum the underlying amounts and recompute shares.
33
+ - **Location queries**: locate returns all admin boundaries + zones at a lat/lng, and (for the ~30 covered cities) auto-includes the municipal ward layer that contains the point — so "what ward is this?" just works with lat/lng alone. Use it to answer "what state/district/ward is this point in?"
33
34
  - **Spatial joins** (multi-step): to answer "which X are in Y?" when layers don't share a common column:
34
35
  1. Use locate to find the admin context (state, district) of the target area
35
36
  2. Use query_layer with a where filter to narrow the other layer by that admin context
36
37
  3. For precise spatial containment, test individual points via locate against the target layer
37
38
  - **Community layers**: list_submissions returns user-contributed datasets. These work with query_layer and get_layer_schema exactly like curated layers.
38
39
  - **Downloads**: get_layer_detail returns direct URLs for parquet, pmtiles, geojson, kml, and shapefile formats.
40
+ - **Honor the terms**: every layer and community submission carries its own source and open licence. When you use, quote, or publish results from a layer, credit its source and respect that licence; get_layer_detail returns the attribution and licence, and each /view page's Dataset JSON-LD carries a creditText to reproduce.
39
41
 
40
42
  Source preference (multiple layers often cover the same level):
41
43
  - **Admin boundaries** (state, district, subdistrict, block, village): prefer LGD (lgd_*) as the authoritative source. SOI, Bhuvan, and geoBoundaries are cross-reference alternates with slightly different counts/boundaries. Mention alternates if the user asks about discrepancies.
@@ -75,7 +77,7 @@ Collect (author your own map): this server also drives collect.bharatlas.com, th
75
77
  - view link -> get_map, get_records: read / query / export that map's published points (analyse or back up what has been collected).
76
78
  - collect link -> the above; field capture itself is done in the browser on a phone via the collect link.
77
79
  - admin link -> everything: edit_map (settings), moderate_record (approve/reject), import_points (bulk data you already hold, with a source + rights), and publish.
78
- - publish bakes approved points into a bharatlas catalog submission. It is then queryable through the read tools above (list_submissions, query_layer, locate) — the full loop, gather -> moderate -> publish -> query, in one server.
80
+ - publish submits a collect map's approved points to the bharatlas catalog FOR REVIEW — nothing is auto-approved. A bharatlas maintainer approves the submission before it goes live; the response's status is "pending" until then. Once approved it is queryable through the read tools above (list_submissions, query_layer, locate).
79
81
  - No accounts: the link is the credential. A tool that needs more than your link allows will say which link you need. create_map is optional and needs COLLECT_API_KEY (request-only); prefer creating online.`;
80
82
 
81
83
  const TOOLS = [
@@ -131,7 +133,8 @@ const TOOLS = [
131
133
  name: "query_layer",
132
134
  description:
133
135
  "Query a layer's data with filters and grouping. Reads the parquet file at runtime. " +
134
- "Supports: select specific columns, filter by column values, group by a column to get counts. " +
136
+ "Supports: select specific columns, filter by column values, group by a column to get counts, " +
137
+ "and sum numeric columns per group (e.g. roll block areas up to district totals). " +
135
138
  "Use get_layer_schema first to discover column names. " +
136
139
  "Examples: 'airports in Karnataka' -> where: {state: 'KA'}, " +
137
140
  "'forest types' -> group_by: 'type', " +
@@ -157,6 +160,11 @@ const TOOLS = [
157
160
  type: "string",
158
161
  description: "Column to group by. Returns {value: count} instead of rows.",
159
162
  },
163
+ sum: {
164
+ type: "array",
165
+ items: { type: "string" },
166
+ description: "Numeric columns to total per group (requires group_by). Adds {sums: {group: {col: total}}}. Use this to roll finer units up, e.g. block-level areas to district totals. Shares/percentages are not additive: sum the area columns and recompute shares.",
167
+ },
160
168
  limit: { type: "number", description: "Max rows (default 100, max 1000)" },
161
169
  include_centroid: {
162
170
  type: "boolean",
@@ -171,7 +179,8 @@ const TOOLS = [
171
179
  description:
172
180
  "Given a latitude/longitude, find which administrative boundaries, zones, and regions " +
173
181
  "contain that point. Returns state, district, subdistrict, block, parliament/assembly " +
174
- "constituency, pincode, seismic zone, high court jurisdiction, and more. " +
182
+ "constituency, pincode, seismic zone, high court jurisdiction, the municipal ward (for " +
183
+ "the ~30 cities with ward data), and more. " +
175
184
  "The 'where am I?' tool. Also accepts specific layer IDs to check.",
176
185
  inputSchema: {
177
186
  type: "object",
@@ -187,7 +196,7 @@ const TOOLS = [
187
196
  layers: {
188
197
  type: "array",
189
198
  items: { type: "string" },
190
- description: "Specific layer IDs to check (default: 12 essential layers covering all admin levels + zones)",
199
+ description: "Specific layer IDs to check. Omit to use the default: 12 essential admin/zone layers PLUS the city ward layer(s) covering the point (for the ~30 cities with ward data). Passing this replaces the default entirely (no ward auto-include).",
191
200
  },
192
201
  },
193
202
  required: ["lat", "lng"],
@@ -342,8 +351,9 @@ const TOOLS = [
342
351
  {
343
352
  name: "publish",
344
353
  description:
345
- "Bake a collect map's approved points into a bharatlas catalog submission (needs the admin link). " +
346
- "Once published it is queryable via list_submissions / query_layer / locate above.",
354
+ "Submit a collect map's approved points to the bharatlas catalog for review (needs the admin link). " +
355
+ "Nothing goes live automatically — a maintainer approves the submission first; the response status is 'pending' until then. " +
356
+ "Once approved it is queryable via list_submissions / query_layer / locate above.",
347
357
  inputSchema: { type: "object", properties: { id: { type: "string" } }, required: ["id"] },
348
358
  },
349
359
  {
@@ -481,10 +491,11 @@ async function handleTool(name, args) {
481
491
  }
482
492
 
483
493
  case "query_layer": {
484
- const { layer_id, select, where, group_by, limit, include_centroid } = args;
494
+ const { layer_id, select, where, group_by, sum, limit, include_centroid } = args;
485
495
  const params = {};
486
496
  if (select?.length) params.select = select.join(",");
487
497
  if (group_by) params.group_by = group_by;
498
+ if (sum?.length) params.sum = sum.join(",");
488
499
  if (limit) params.limit = limit;
489
500
  if (include_centroid) params.include_centroid = "true";
490
501
  if (where) params.where = Object.entries(where).map(([k, v]) => `${k}=${v}`).join(",");
@@ -597,7 +608,7 @@ async function handleTool(name, args) {
597
608
  }
598
609
 
599
610
  const server = new Server(
600
- { name: "bharatlas-mcp", version: "1.1.1" },
611
+ { name: "bharatlas-mcp", version: "1.2.0" },
601
612
  { capabilities: { tools: {} }, instructions: SERVER_INSTRUCTIONS },
602
613
  );
603
614
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bharatlas-mcp",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
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/server.json CHANGED
@@ -2,12 +2,12 @@
2
2
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
3
  "name": "io.github.sathya-sankaran/bharatlas-mcp",
4
4
  "description": "Query India's open geo data, and author collect maps: register a link, moderate, publish.",
5
- "version": "1.1.1",
5
+ "version": "1.2.0",
6
6
  "packages": [
7
7
  {
8
8
  "registryType": "npm",
9
9
  "identifier": "bharatlas-mcp",
10
- "version": "1.1.1",
10
+ "version": "1.2.0",
11
11
  "transport": { "type": "stdio" }
12
12
  }
13
13
  ]