nextbillion-mcp 0.1.7 → 0.1.10

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.
Files changed (2) hide show
  1. package/dist/index.js +33 -25
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -5,9 +5,6 @@ var __export = (target, all) => {
5
5
  __defProp(target, name, { get: all[name], enumerable: true });
6
6
  };
7
7
 
8
- // src/index.ts
9
- import { createRequire } from "node:module";
10
-
11
8
  // ../../node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
12
9
  var __create = Object.create;
13
10
  var __defProp2 = Object.defineProperty;
@@ -5308,6 +5305,14 @@ function object(shape, params) {
5308
5305
  };
5309
5306
  return new ZodObject(def);
5310
5307
  }
5308
+ function strictObject(shape, params) {
5309
+ return new ZodObject({
5310
+ type: "object",
5311
+ shape,
5312
+ catchall: never(),
5313
+ ...util_exports.normalizeParams(params)
5314
+ });
5315
+ }
5311
5316
  function looseObject(shape, params) {
5312
5317
  return new ZodObject({
5313
5318
  type: "object",
@@ -20350,7 +20355,7 @@ ${JSON.stringify(structuredContent)}`;
20350
20355
  }
20351
20356
 
20352
20357
  // src/tools/shared/geo.ts
20353
- var CoordinateSchema = object({
20358
+ var CoordinateSchema = strictObject({
20354
20359
  latitude: number2().min(-90).max(90),
20355
20360
  longitude: number2().min(-180).max(180)
20356
20361
  });
@@ -20360,7 +20365,7 @@ function toLatLng(coordinate) {
20360
20365
  function toLatLngList(coordinates) {
20361
20366
  return coordinates.map(toLatLng).join("|");
20362
20367
  }
20363
- var BoundingBoxSchema = object({
20368
+ var BoundingBoxSchema = strictObject({
20364
20369
  west: number2().min(-180).max(180).describe("Western longitude"),
20365
20370
  south: number2().min(-90).max(90).describe("Southern latitude"),
20366
20371
  east: number2().min(-180).max(180).describe("Eastern longitude"),
@@ -20429,7 +20434,7 @@ ${lines.join("\n")}${more}`;
20429
20434
  }
20430
20435
 
20431
20436
  // src/tools/places/text-search.ts
20432
- var TextSearchSchema = object({
20437
+ var TextSearchSchema = strictObject({
20433
20438
  query: string2().min(1).describe("Free-text search query"),
20434
20439
  ...PlacesFilterShape
20435
20440
  });
@@ -20449,7 +20454,7 @@ function textSearchTool(options) {
20449
20454
  }
20450
20455
  };
20451
20456
  }
20452
- var ForwardGeocodeSchema = object({
20457
+ var ForwardGeocodeSchema = strictObject({
20453
20458
  query: string2().min(1).describe("Free-text search query"),
20454
20459
  ...PlacesFilterShape,
20455
20460
  types: PlaceTypesSchema.optional()
@@ -20492,18 +20497,21 @@ var autocomplete = textSearchTool({
20492
20497
  });
20493
20498
 
20494
20499
  // src/tools/places/geocode-batch.ts
20495
- var BatchQuerySchema = object({
20500
+ var BatchQuerySchema = strictObject({
20496
20501
  query: string2().min(1).describe("Free-text search query for this entry"),
20497
20502
  ...PlacesFilterShape,
20498
20503
  types: PlaceTypesSchema.optional()
20499
20504
  });
20500
- var Schema = object({
20501
- queries: array(BatchQuerySchema).min(1).max(100).describe("Up to 100 forward-geocode queries resolved in a single request")
20505
+ var Schema = strictObject({
20506
+ queries: array(BatchQuerySchema).min(1).max(100).describe("Up to 100 forward-geocode queries resolved in a single request"),
20507
+ types: PlaceTypesSchema.optional().describe(
20508
+ "Default result-type filter applied to every query that does not set its own `types` (houseNumber, addressBlock, street, intersection, place, area)"
20509
+ )
20502
20510
  });
20503
20511
  var geocodeBatch = {
20504
20512
  name: "geocode_batch",
20505
20513
  title: "Batch Geocode",
20506
- description: "Forward-geocode up to 100 free-text queries in one request; returns one ranked result set per query, in input order. Strongly prefer this over repeated geocode_forward calls when resolving several addresses \u2014 this endpoint has a dedicated (low) rate limit of 60 requests per minute, so batch as much as possible into each call.",
20514
+ description: 'Forward-geocode up to 100 free-text queries in one request; returns one ranked result set per query, in input order. Strongly prefer this over repeated geocode_forward calls when resolving several addresses \u2014 this endpoint has a dedicated (low) rate limit of 60 requests per minute, so batch as much as possible into each call. Each query object accepts the same filters as geocode_forward \u2014 near, radius_m, country_codes, bounding_box, limit, language, view, and types \u2014 for example: {"queries": [{"query": "600-699 Golden Gate Ave, San Francisco, CA", "types": ["addressBlock"]}]}. A top-level `types` sets the default for all queries.',
20507
20515
  inputSchema: Schema,
20508
20516
  annotations: READ_ONLY,
20509
20517
  async run(args, nb) {
@@ -20515,7 +20523,7 @@ var geocodeBatch = {
20515
20523
  in: filters.in,
20516
20524
  limit: filters.limit,
20517
20525
  lang: filters.lang,
20518
- types: entry.types?.join(",")
20526
+ types: (entry.types ?? args.types)?.join(",")
20519
20527
  };
20520
20528
  });
20521
20529
  const response = await nb.postJson("/geocode/batch", {}, body);
@@ -20536,7 +20544,7 @@ ${lines.join("\n")}`, {
20536
20544
  };
20537
20545
 
20538
20546
  // src/tools/places/geocode-reverse.ts
20539
- var Schema2 = object({
20547
+ var Schema2 = strictObject({
20540
20548
  coordinate: CoordinateSchema.describe("The location to reverse geocode"),
20541
20549
  country_codes: CountryCodesSchema.optional(),
20542
20550
  bounding_box: BoundingBoxSchema.optional().describe("Hard-limit results to this bounding box"),
@@ -20562,7 +20570,7 @@ var geocodeReverse = {
20562
20570
  };
20563
20571
 
20564
20572
  // src/tools/places/geocode-structured.ts
20565
- var Schema3 = object({
20573
+ var Schema3 = strictObject({
20566
20574
  country_code: string2().regex(/^[A-Za-z]{3}$/, "ISO 3166-1 alpha-3 code, e.g. USA").describe('Country of the address (required, ISO 3166-1 alpha-3, e.g. "USA")'),
20567
20575
  state: string2().optional(),
20568
20576
  county: string2().optional(),
@@ -20610,7 +20618,7 @@ var geocodeStructured = {
20610
20618
  };
20611
20619
 
20612
20620
  // src/tools/places/place-lookup.ts
20613
- var Schema4 = object({
20621
+ var Schema4 = strictObject({
20614
20622
  id: string2().min(1).describe("Unique place id, as returned by the other place/geocoding tools"),
20615
20623
  view: ViewSchema.optional()
20616
20624
  });
@@ -20630,7 +20638,7 @@ var placeLookup = {
20630
20638
  };
20631
20639
 
20632
20640
  // src/tools/places/postcode-lookup.ts
20633
- var Schema5 = object({
20641
+ var Schema5 = strictObject({
20634
20642
  postal_code: string2().optional().describe("Postal/ZIP code to look up (requires `country`; do not combine with `coordinate`)"),
20635
20643
  country: string2().optional().describe(
20636
20644
  "Country of the postal code \u2014 name, alpha-2, or alpha-3 ISO code. Required with `postal_code`"
@@ -20690,7 +20698,7 @@ var AVOID_VALUES = [
20690
20698
  "tunnel",
20691
20699
  "none"
20692
20700
  ];
20693
- var Schema6 = object({
20701
+ var Schema6 = strictObject({
20694
20702
  origin: CoordinateSchema.describe("Route start (must be a routable land location)"),
20695
20703
  destination: CoordinateSchema.describe("Route end (must be a routable land location)"),
20696
20704
  waypoints: array(CoordinateSchema).max(200).optional().describe("Intermediate stops visited in order (max 200)"),
@@ -20713,7 +20721,7 @@ var Schema6 = object({
20713
20721
  geometry: _enum(["polyline", "polyline6"]).optional().describe(
20714
20722
  "Route geometry encoding (default polyline, precision 5 \u2014 directly usable with static_route_map)"
20715
20723
  ),
20716
- truck_size_cm: object({ height: number2(), width: number2(), length: number2() }).optional().describe("Truck dimensions in cm (flexible + mode=truck only)"),
20724
+ truck_size_cm: strictObject({ height: number2(), width: number2(), length: number2() }).optional().describe("Truck dimensions in cm (flexible + mode=truck only)"),
20717
20725
  truck_weight_kg: number2().int().max(1e5).optional().describe("Truck gross weight in kg (flexible + mode=truck only)")
20718
20726
  });
20719
20727
  var directions = {
@@ -20762,7 +20770,7 @@ Geometry (encoded polyline) is in structured content.` : "No route found.",
20762
20770
  };
20763
20771
 
20764
20772
  // src/tools/routing/distance-matrix.ts
20765
- var Schema7 = object({
20773
+ var Schema7 = strictObject({
20766
20774
  origins: array(CoordinateSchema).min(1).max(1e3).describe("Start points (matrix rows)"),
20767
20775
  destinations: array(CoordinateSchema).min(1).max(1e3).describe("End points (matrix columns)"),
20768
20776
  mode: _enum(["car", "truck", "motorcycle", "bike", "walk"]).optional().describe("Travel mode (default car). Modes other than car/truck require service=flexible"),
@@ -20777,7 +20785,7 @@ var Schema7 = object({
20777
20785
  honor_restrictions: boolean2().optional().describe(
20778
20786
  "When true, enforce restricted-area rules for origin/destination points instead of routing through with a warning (flexible service only)"
20779
20787
  ),
20780
- truck_size_cm: object({ height: number2(), width: number2(), length: number2() }).optional().describe("Truck dimensions in cm (flexible + mode=truck only)"),
20788
+ truck_size_cm: strictObject({ height: number2(), width: number2(), length: number2() }).optional().describe("Truck dimensions in cm (flexible + mode=truck only)"),
20781
20789
  truck_weight_kg: number2().int().max(1e5).optional().describe("Truck gross weight in kg (flexible + mode=truck only)")
20782
20790
  });
20783
20791
  var distanceMatrix = {
@@ -20820,7 +20828,7 @@ var distanceMatrix = {
20820
20828
  };
20821
20829
 
20822
20830
  // src/tools/routing/isochrone.ts
20823
- var Schema8 = object({
20831
+ var Schema8 = strictObject({
20824
20832
  origin: CoordinateSchema.describe("Starting point of the reachability analysis"),
20825
20833
  contours_minutes: array(number2().int().min(1).max(40)).max(4).optional().describe("Travel times in minutes, one contour each (max 4 values, increasing, max 40)"),
20826
20834
  contours_meters: array(number2().int().min(1).max(6e4)).max(4).optional().describe("Travel distances in meters, one contour each (max 4 values, increasing, max 60000)"),
@@ -20864,7 +20872,7 @@ var isochrone = {
20864
20872
  };
20865
20873
 
20866
20874
  // src/tools/routing/search-along-route.ts
20867
- var Schema9 = object({
20875
+ var Schema9 = strictObject({
20868
20876
  route_points: array(CoordinateSchema).min(2).describe("Waypoints defining the route to search along, in travel order"),
20869
20877
  query: string2().min(1).describe('What to find along the route, e.g. "gas station", "coffee"'),
20870
20878
  max_detour_seconds: number2().int().min(1).max(3600).optional().describe("Max driving time to reach a result after leaving the route (default 900 = 15 min)"),
@@ -20972,7 +20980,7 @@ async function saveImage(data, prefix, ext) {
20972
20980
  }
20973
20981
 
20974
20982
  // src/tools/maps/static-map-image.ts
20975
- var Schema10 = object({
20983
+ var Schema10 = strictObject({
20976
20984
  center: CoordinateSchema.describe("Center of the map view"),
20977
20985
  zoom: number2().min(0).max(22).describe("Zoom level (0 = world, ~10 = city, ~15 = streets; fractional values allowed)"),
20978
20986
  markers: array(CoordinateSchema.extend({ color: string2().optional() })).optional().describe('Markers to draw, each with optional color (e.g. "red", "#0000ff")'),
@@ -21102,7 +21110,7 @@ function fitPolylineToBudget(points, maxEncodedChars) {
21102
21110
  }
21103
21111
 
21104
21112
  // src/tools/maps/static-route-map.ts
21105
- var Schema11 = object({
21113
+ var Schema11 = strictObject({
21106
21114
  encoded_polyline: string2().optional().describe(
21107
21115
  "Route geometry as a Google encoded polyline (precision 5) \u2014 exactly what the directions tool returns with its default geometry setting"
21108
21116
  ),
@@ -21346,7 +21354,7 @@ function extractApiMessage(bodyText) {
21346
21354
  }
21347
21355
 
21348
21356
  // src/index.ts
21349
- var pkg = createRequire(import.meta.url)("../package.json");
21357
+ var pkg = true ? { version: "0.1.10" } : createRequire(import.meta.url)("../package.json");
21350
21358
  function main() {
21351
21359
  const args = process.argv.slice(2);
21352
21360
  if (args.includes("--version") || args.includes("-v")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextbillion-mcp",
3
- "version": "0.1.7",
3
+ "version": "0.1.10",
4
4
  "description": "MCP server exposing NextBillion.ai location APIs (geocoding, places, routing, maps) as tools for AI agents",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "prepublishOnly": "npm run typecheck && npm run test && npm run build",
32
- "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && esbuild src/index.ts --bundle --platform=node --format=esm --target=node20 --outfile=dist/index.js --log-level=warning && node -e \"require('fs').chmodSync('dist/index.js', 0o755)\"",
32
+ "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && esbuild src/index.ts --bundle --platform=node --format=esm --target=node20 --outfile=dist/index.js --log-level=warning --define:__NBMCP_VERSION__=\\\"$npm_package_version\\\" && node -e \"require('fs').chmodSync('dist/index.js', 0o755)\"",
33
33
  "typecheck": "tsc -p tsconfig.json --noEmit",
34
34
  "test": "vitest run tests/unit tests/conformance",
35
35
  "test:e2e": "vitest run tests/e2e",