catastro-gps-mcp 1.3.2 → 2.1.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +11 -5
  3. package/build/client/catastrogps-api.d.ts +8 -2
  4. package/build/client/catastrogps-api.js +28 -10
  5. package/build/server.js +12 -0
  6. package/build/tools/compare-parcels.js +15 -15
  7. package/build/tools/get-agriculture.js +2 -2
  8. package/build/tools/get-boundaries.js +5 -6
  9. package/build/tools/get-crop-catalog.d.ts +4 -0
  10. package/build/tools/get-crop-catalog.js +44 -0
  11. package/build/tools/get-ground-motion.js +3 -3
  12. package/build/tools/get-market.js +39 -14
  13. package/build/tools/get-neighbors.d.ts +4 -0
  14. package/build/tools/get-neighbors.js +31 -0
  15. package/build/tools/get-parcel-subparcels.d.ts +4 -0
  16. package/build/tools/get-parcel-subparcels.js +57 -0
  17. package/build/tools/get-parcel.js +42 -29
  18. package/build/tools/get-score.js +12 -18
  19. package/build/tools/get-solar.js +13 -13
  20. package/build/tools/get-terrain.js +3 -3
  21. package/build/tools/get-units.js +25 -25
  22. package/build/tools/get-value-history.js +7 -7
  23. package/build/tools/list-municipalities.d.ts +4 -0
  24. package/build/tools/list-municipalities.js +21 -0
  25. package/build/tools/list-provinces.d.ts +4 -0
  26. package/build/tools/list-provinces.js +19 -0
  27. package/build/tools/list-streets.d.ts +4 -0
  28. package/build/tools/list-streets.js +24 -0
  29. package/build/tools/search-address.js +17 -17
  30. package/build/tools/shared.js +1 -0
  31. package/build/types/index.d.ts +308 -206
  32. package/build/types/index.js +1 -0
  33. package/build/version.d.ts +2 -2
  34. package/build/version.js +1 -1
  35. package/package.json +1 -1
  36. package/server.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.0 (2026-10-21)
4
+
5
+ - New `get_parcel_subparcels`: every crop or land-use subparcel (`crop_code`, `crop` in `lang`, `crop_original`, `area_m2`, `kind`, `use_class`, `intensity`, `land_type`, `land_class`, `source`, outline with `include_geometry`). Spain (foral territories included), Austria, Estonia and Greece. `SUB_001` (source down) is explained as retryable and not charged.
6
+ - New `get_crop_catalog` (free, no quota): crop codes with names in 10 languages, filterable by `code` or `source`.
7
+ - New `get_neighbors`: adjoining parcels with reference and centre point.
8
+ - New `list_provinces`, `list_municipalities`, `list_streets`: the Spanish cadastre lists.
9
+ - `get_parcel` takes `lang` and returns `subparcel_count` and `crop_summary` (the API no longer embeds subparcels in the parcel).
10
+ - `get_market_data` returns `zone_prices` for Spanish parcels: official province prices for housing (€/m²) and farmland (€/ha).
11
+
12
+ ## 2.0.0 (2026-10-20)
13
+
14
+ - Every tool calls the English v1 API (`/v1/parcels/...`, `/v1/search/...`, `/v1/resolve`) instead of the legacy `/api/...` routes, which answer in Spanish field names and are now deprecated.
15
+ - Breaking: `get_parcel`, `search_address` and `get_units` return `region` instead of `province`; `get_parcel` by coordinates also returns `parcel_reference`.
16
+ - Breaking: the nested blocks passed through from the API are English camelCase: `get_agriculture.agriculture` (`landUse`, `mainCrop`, `ndvi.cropHealth`, `cropPrice`...), `get_terrain.relief`/`protected_areas`/`climate` (`meanPct`, `overlapPct`...) and `get_ground_motion.ground_motion` (`meanMmYear`...).
17
+ - `get_investment_score` ratings are English: `excellent`, `good`, `moderate`, `low`, `very_low`, `no_data`; risk and opportunity factors are English sentences.
18
+ - `get_boundaries` returns GeoJSON for every country (the `outline_lat_lng` ring of non-Spanish parcels is gone; use `get_parcel` for it).
19
+ - Errors read the v1 `{code, message, details}` body; the legacy `{error, data}` body is still understood.
20
+
3
21
  ## 1.3.2 (2026-10-06)
4
22
 
5
23
  - Coverage stated the same way as the website: 29 European countries, including the Basque Country and Navarre foral cadastres; by cadastral reference in 27 and by coordinates in all 29 (United Kingdom and Croatia are coordinates only). The "31 official cadastres" count is gone.
package/README.md CHANGED
@@ -45,23 +45,27 @@ Use the same `npx -y catastro-gps-mcp` command with `CATASTROGPS_API_KEY` in the
45
45
 
46
46
  | Tool | What it does | Countries |
47
47
  |------|--------------|-----------|
48
- | `get_parcel` | Parcel by cadastral reference **or** WGS84 coordinates: reference, location, address, municipality, area, land use, outline | All 29 countries, Basque Country and Navarre included (UK and HR: coordinates only) |
48
+ | `get_parcel` | Parcel by cadastral reference **or** WGS84 coordinates: reference, location, address, municipality, area, land use, outline, number of crop subparcels and a crop summary (`lang` for crop names) | All 29 countries, Basque Country and Navarre included (UK and HR: coordinates only) |
49
49
  | `search_address` | Postal address in free text to ranked parcels, with confidence and whether the number and municipality match | ES (with PV and NA entrances) and FR, IT, DE, AT, NL, BE, PL, CH, CZ, DK, NO, FI, EE, LV, LT, SI, SK, BG, GR, CY, LU, LI, IS, IE, UK, PT |
50
50
  | `get_units` | Every unit (dwelling, shop, garage, storage) of a Spanish building: stair, floor, door, use, area, participation, year. Paginated, 200 per page | ES, PV, NA |
51
51
  | `resolve_reference` | Free, no quota: is this text a reference, coordinates or a place name, and of which country | All |
52
+ | `get_parcel_subparcels` | Every crop or land-use part of the parcel: crop code, crop name in 10 languages, original label, area, land-use class, source and (optionally) outline. A source failure is `SUB_001`, not charged | ES (with Bizkaia, Álava, Navarre, Gipuzkoa), AT, EE, GR |
53
+ | `get_crop_catalog` | Free, no quota: every crop code with its name in the chosen language and its land-use class | All crop catalogues |
54
+ | `get_neighbors` | Parcels that touch or surround the parcel (up to 60) with reference and centre point | ES from the cadastre; elsewhere from our own copy (`supported: false` when not) |
55
+ | `list_provinces`, `list_municipalities`, `list_streets` | Spanish cadastre provinces, municipalities (with INE code) and streets of a municipality | ES (common territory) |
52
56
  | `get_boundaries` | Parcel outline as GeoJSON / `[lat, lng]` ring, centroid and area | 30 codes (all but UK) |
53
57
  | `get_terrain` | Relief over the parcel outline (Copernicus DEM GLO-30), Natura 2000 / protected areas (EEA) and ERA5-Land climate normals with the recent change | Every reference country but HR; outside ES, PV, NA, PT, FR, IT, DE pass `latitude`/`longitude` |
54
58
  | `get_ground_motion` | Ground motion measured by satellite (Copernicus EGMS, 2020-2024): subsidence or uplift in mm/year, fastest-sinking cell, east-west motion, yearly displacement; says so when there are no radar reflectors | Same as `get_terrain` |
55
59
  | `get_solar_potential` | PVGIS photovoltaic estimate: kWp, kWh/year, savings, payback, CO2, tilt | ES, PV, NA, PT, FR, IT, DE |
56
60
  | `get_agriculture` | Land use, main crop, NDVI and a reference crop price (SIGPAC detail in Spain) | ES, PV, NA, PT, FR, IT, DE |
57
- | `get_market_data` | Aggregated price reference for the parcel's area. Never individual sales | Figures: FR, IT, DE (NRW only). ES, PV, NA, PT: note without figures |
61
+ | `get_market_data` | Aggregated price reference for the parcel's area. Never individual sales | Sales: FR, IT, DE (NRW only). ES, PV, NA: official province prices (`zone_prices`). PT: none |
58
62
  | `get_investment_score` | Score 0-100 with a rating and qualitative factor levels (high / medium / low / not available) | ES, PV, NA, PT, FR, IT, DE |
59
63
  | `get_value_history` | Area and land-use snapshots of the parcel over time | ES, PV, NA, PT, FR, IT, DE, AT |
60
64
  | `compare_parcels` | Two or three parcels side by side: location, solar, agriculture, score | ES, PT, FR, IT, DE (not PV or NA) |
61
65
 
62
66
  ## Quota, prepaid balance and limits
63
67
 
64
- - Only successful answers with data spend quota: a not found, a validation error, `CNV_COVERAGE`, `CNV_AMBIGUOUS`, a 5xx and an answer without data (`available: false`) are free. `resolve_reference` never spends.
68
+ - Only successful answers with data spend quota: a not found, a validation error, `CNV_COVERAGE`, `CNV_AMBIGUOUS`, a 5xx and an answer without data (`available: false`) are free. `resolve_reference` and `get_crop_catalog` never spend; `get_parcel_subparcels` is free when the parcel has none.
65
69
  - Each successful call costs 1 unit, except `get_units` (one unit per unit served in the page, minimum 1) and `compare_parcels` (one per parcel found).
66
70
  - Every result carries a `quota` object read from that same response: `remaining`, `limit`, `resets_at`, `plan`, and when they apply `prepaid_overage`, `prepaid_balance_eur`, `overage_units_left`, `per_minute_remaining`, and on `get_units` with a contract per-finca cap `finca_cap` / `finca_cap_used`.
67
71
  - When the monthly quota runs out the API does not cut you off if you have prepaid balance: each extra unit is paid from it (top up at [parcelgps.com/app/developer](https://parcelgps.com/app/developer)). With the quota used up and no balance the call fails with `KEY_AUTH_004` (HTTP 429, never 402) and the error says whether to top up or upgrade, and when the quota resets.
@@ -69,7 +73,7 @@ Use the same `npx -y catastro-gps-mcp` command with `CATASTROGPS_API_KEY` in the
69
73
 
70
74
  ### What the market, score and history tools can and cannot tell
71
75
 
72
- - **`get_market_data`** has numbers only where an official source gives them: France (DVF recorded sales: average €/m², number of sales, last sale date, estimated value), Italy (OMI zone values from the Agenzia delle Entrate) and Germany (official *Bodenrichtwert* land value per m², North Rhine-Westphalia only; elsewhere in Germany it answers `available: false`). In Spain and Portugal it answers with a note and no figures: there is no per-parcel price source yet.
76
+ - **`get_market_data`** has numbers only where an official source gives them: France (DVF recorded sales: average €/m², number of sales, last sale date, estimated value), Italy (OMI zone values from the Agenzia delle Entrate) and Germany (official *Bodenrichtwert* land value per m², North Rhine-Westphalia only; elsewhere in Germany it answers `available: false`). In Spain (PV and NA included) it returns `zone_prices`: the official average prices of the parcel's province (housing per built m² from MIVAU, farmland per hectare from MAPA) with statistic, authority and period; there are no parcel-level sales. Portugal answers `available: false`.
73
77
  - **`get_investment_score`** combines what the API can gather for the parcel: solar potential and agricultural use everywhere it answers, market prices only in France, Italy and Germany (NRW). Accessibility and risk are not computed yet and come back as `not_available`, so the score is relative to the factors that were available. You get the score, the rating and qualitative factor levels, never the weights.
74
78
  - **`get_value_history`** starts the first time anyone looks the parcel up through Catastro GPS (at most one snapshot every 30 days). A parcel nobody has queried returns an empty list. It records area and land use; the official cadastral value is not recorded yet, so `cadastral_value_eur` is always `null` and `change_pct` is the change in area.
75
79
  - **`compare_parcels`** fills area, land use and municipality only for Spanish parcels; for Portugal, France, Italy and Germany it returns the location, solar, agriculture and score. It does not include market prices. A parcel that is not found comes back with an error and the others are still compared.
@@ -137,7 +141,7 @@ What a `get_parcel` call returns (shortened; values are illustrative):
137
141
  "longitude": -3.7038,
138
142
  "address": "CL MAYOR 1",
139
143
  "municipality": "MADRID",
140
- "province": "MADRID",
144
+ "region": "MADRID",
141
145
  "area_m2": 512,
142
146
  "land_use": "Residencial",
143
147
  "outline_lat_lng": [[40.41662, -3.70391], [40.41671, -3.70362], "..."],
@@ -145,6 +149,8 @@ What a `get_parcel` call returns (shortened; values are illustrative):
145
149
  }
146
150
  ```
147
151
 
152
+ Every call goes to the English v1 REST API (`https://api.parcelgps.com/v1/...`), so nested blocks such as `agriculture`, `relief` or `ground_motion` use the same English camelCase field names as the [API docs](https://www.parcelgps.com/en/api/docs).
153
+
148
154
  Errors come back as a code plus a sentence the agent can act on, for example:
149
155
 
150
156
  ```text
@@ -1,4 +1,4 @@
1
- import type { Quota, ServerConfig, ApiResponse, ParcelData, PolygonData, SolarData, TerrainData, GroundMotionData, AgroData, MarketData, ScoreData, ValueHistoryData, CompareData, CoordinatesSearchData, AddressCandidatesData, UnitsPageData, ResolveData } from "../types/index.js";
1
+ import type { Quota, ServerConfig, ApiResponse, ParcelData, PolygonData, SolarData, TerrainData, GroundMotionData, AgroData, MarketData, ScoreData, ValueHistoryData, CompareData, CoordinatesSearchData, AddressCandidatesData, UnitsPageData, ResolveData, SubparcelsData, CropCatalogData, NeighborsData, ProvincesData, MunicipalitiesData, StreetsData } from "../types/index.js";
2
2
  export interface ApiErrorExtras {
3
3
  quota?: Quota;
4
4
  retryAfterSeconds?: number;
@@ -23,7 +23,13 @@ export declare class CatastroGPSClient {
23
23
  private buildUrl;
24
24
  private send;
25
25
  private parcelPath;
26
- getParcelByReference(reference: string, country?: string): Promise<ApiResponse<ParcelData>>;
26
+ getParcelByReference(reference: string, country?: string, lang?: string): Promise<ApiResponse<ParcelData>>;
27
+ getSubparcels(reference: string, country?: string, lang?: string): Promise<ApiResponse<SubparcelsData>>;
28
+ getNeighbors(reference: string, country?: string): Promise<ApiResponse<NeighborsData>>;
29
+ getCropCatalog(lang?: string): Promise<ApiResponse<CropCatalogData>>;
30
+ listProvinces(): Promise<ApiResponse<ProvincesData>>;
31
+ listMunicipalities(region: string): Promise<ApiResponse<MunicipalitiesData>>;
32
+ listStreets(region: string, municipality: string, name?: string): Promise<ApiResponse<StreetsData>>;
27
33
  getParcelByCoordinates(lat: number, lng: number, country?: string): Promise<ApiResponse<CoordinatesSearchData>>;
28
34
  searchAddressCandidates(address: string, country?: string, limit?: number): Promise<ApiResponse<AddressCandidatesData>>;
29
35
  getUnits(reference: string, country?: string, cursor?: string): Promise<ApiResponse<UnitsPageData>>;
@@ -122,7 +122,7 @@ export class CatastroGPSClient {
122
122
  this.lastQuota = quota;
123
123
  if (!response.ok) {
124
124
  const errorBody = (await response.json().catch(() => ({})));
125
- throw new CatastroGPSApiError(errorBody.code || `HTTP_${response.status}`, errorBody.error || errorBody.message || `API returned ${response.status}`, response.status, errorBody.data ?? errorBody.parsed, { quota, retryAfterSeconds: retryAfterSeconds(response.headers) });
125
+ throw new CatastroGPSApiError(errorBody.code || `HTTP_${response.status}`, errorBody.message || errorBody.error || `API returned ${response.status}`, response.status, errorBody.details ?? errorBody.data, { quota, retryAfterSeconds: retryAfterSeconds(response.headers) });
126
126
  }
127
127
  const payload = (await response.json());
128
128
  if (quota && payload && typeof payload === "object") {
@@ -143,22 +143,40 @@ export class CatastroGPSClient {
143
143
  }
144
144
  }
145
145
  parcelPath(reference, suffix = "") {
146
- return `/api/catastro/${encodeURIComponent(reference)}${suffix}`;
146
+ return `/v1/parcels/${encodeURIComponent(reference)}${suffix}`;
147
147
  }
148
- async getParcelByReference(reference, country) {
149
- return this.send("GET", this.parcelPath(reference), { country });
148
+ async getParcelByReference(reference, country, lang) {
149
+ return this.send("GET", this.parcelPath(reference), { country, lang });
150
+ }
151
+ async getSubparcels(reference, country, lang) {
152
+ return this.send("GET", this.parcelPath(reference, "/subparcels"), { country, lang });
153
+ }
154
+ async getNeighbors(reference, country) {
155
+ return this.send("GET", this.parcelPath(reference, "/neighbors"), { country });
156
+ }
157
+ async getCropCatalog(lang) {
158
+ return this.send("GET", "/v1/reference/crops", { lang });
159
+ }
160
+ async listProvinces() {
161
+ return this.send("GET", "/v1/locations/provinces");
162
+ }
163
+ async listMunicipalities(region) {
164
+ return this.send("GET", "/v1/locations/municipalities", { region });
165
+ }
166
+ async listStreets(region, municipality, name) {
167
+ return this.send("GET", "/v1/locations/streets", { region, municipality, name });
150
168
  }
151
169
  async getParcelByCoordinates(lat, lng, country) {
152
- return this.send("GET", "/api/search/coordinates", { lat, lng, country });
170
+ return this.send("GET", "/v1/search/coordinates", { lat, lng, country });
153
171
  }
154
172
  async searchAddressCandidates(address, country, limit) {
155
- return this.send("GET", "/api/search/address/candidates", { q: address, country, limit });
173
+ return this.send("GET", "/v1/search/address/candidates", { q: address, country, limit });
156
174
  }
157
175
  async getUnits(reference, country, cursor) {
158
176
  return this.send("GET", this.parcelPath(reference, "/units"), { country, cursor });
159
177
  }
160
178
  async resolve(text, hint) {
161
- return this.send("GET", "/api/resolve", { q: text, hint });
179
+ return this.send("GET", "/v1/resolve", { q: text, hint });
162
180
  }
163
181
  async getPolygon(reference, country) {
164
182
  return this.send("GET", this.parcelPath(reference, "/polygon"), { country });
@@ -173,7 +191,7 @@ export class CatastroGPSClient {
173
191
  return this.send("GET", this.parcelPath(reference, "/ground-motion"), { country, lat: point?.lat, lng: point?.lng });
174
192
  }
175
193
  async getAgriculture(reference, country) {
176
- return this.send("GET", this.parcelPath(reference, "/agro"), { country });
194
+ return this.send("GET", this.parcelPath(reference, "/agriculture"), { country });
177
195
  }
178
196
  async getMarketData(reference, country) {
179
197
  return this.send("GET", this.parcelPath(reference, "/market"), { country });
@@ -185,8 +203,8 @@ export class CatastroGPSClient {
185
203
  return this.send("GET", this.parcelPath(reference, "/value-history"), { country });
186
204
  }
187
205
  async compareParcels(parcels) {
188
- return this.send("POST", "/api/catastro/compare", undefined, {
189
- parcelas: parcels.map((parcel) => ({ ref_catastral: parcel.reference, country: parcel.country })),
206
+ return this.send("POST", "/v1/parcels/compare", undefined, {
207
+ parcels: parcels.map((parcel) => ({ reference: parcel.reference, country: parcel.country })),
190
208
  });
191
209
  }
192
210
  }
package/build/server.js CHANGED
@@ -13,6 +13,12 @@ import { registerGetValueHistory } from "./tools/get-value-history.js";
13
13
  import { registerCompareParcels } from "./tools/compare-parcels.js";
14
14
  import { registerGetUnits } from "./tools/get-units.js";
15
15
  import { registerResolveReference } from "./tools/resolve-reference.js";
16
+ import { registerGetParcelSubparcels } from "./tools/get-parcel-subparcels.js";
17
+ import { registerGetCropCatalog } from "./tools/get-crop-catalog.js";
18
+ import { registerGetNeighbors } from "./tools/get-neighbors.js";
19
+ import { registerListProvinces } from "./tools/list-provinces.js";
20
+ import { registerListMunicipalities } from "./tools/list-municipalities.js";
21
+ import { registerListStreets } from "./tools/list-streets.js";
16
22
  import { SERVER_VERSION } from "./version.js";
17
23
  export const DEFAULT_API_URL = "https://api.parcelgps.com";
18
24
  export const DEFAULT_TIMEOUT_MS = 20000;
@@ -35,6 +41,12 @@ export function createServer(config) {
35
41
  registerCompareParcels(server, client);
36
42
  registerGetUnits(server, client);
37
43
  registerResolveReference(server, client);
44
+ registerGetParcelSubparcels(server, client);
45
+ registerGetCropCatalog(server, client);
46
+ registerGetNeighbors(server, client);
47
+ registerListProvinces(server, client);
48
+ registerListMunicipalities(server, client);
49
+ registerListStreets(server, client);
38
50
  return server;
39
51
  }
40
52
  export function loadEndpointConfig() {
@@ -3,26 +3,26 @@ import { COMPARE_COUNTRIES } from "../types/index.js";
3
3
  import { handleToolError, jsonResult } from "./shared.js";
4
4
  function summarize(item) {
5
5
  if (item.error) {
6
- return { reference: item.ref_catastral, country: item.country, error: item.error };
6
+ return { reference: item.reference, country: item.country, error: item.error };
7
7
  }
8
- const parcel = item.parcela ?? {};
8
+ const parcel = item.parcel ?? {};
9
9
  const solar = item.solar;
10
- const agro = item.agro;
10
+ const agro = item.agriculture;
11
11
  return {
12
- reference: item.ref_catastral,
12
+ reference: item.reference,
13
13
  country: item.country,
14
- latitude: parcel.latitud ?? null,
15
- longitude: parcel.longitud ?? null,
16
- area_m2: parcel.superficieParcela || null,
17
- land_use: parcel.uso || null,
18
- municipality: parcel.municipio || null,
19
- solar: solar?.disponible
20
- ? { production_kwh_year: solar.kwh_year ?? null, installable_kwp: solar.kw_instalables ?? null, solar_grade: solar.nota_solar ?? null }
14
+ latitude: parcel.latitude ?? null,
15
+ longitude: parcel.longitude ?? null,
16
+ area_m2: parcel.parcelArea || null,
17
+ land_use: parcel.use || null,
18
+ municipality: parcel.municipality || null,
19
+ solar: solar?.available
20
+ ? { production_kwh_year: solar.annualProductionKwh ?? null, installable_kwp: solar.installableKw ?? null, solar_grade: solar.solarGrade ?? null }
21
21
  : null,
22
- agriculture: agro?.disponible
23
- ? { is_agricultural: agro.es_agricola ?? null, land_use: agro.uso_suelo?.descripcion || null, crop_group: agro.uso_suelo?.grupo || null }
22
+ agriculture: agro?.available
23
+ ? { is_agricultural: agro.isAgricultural ?? null, land_use: agro.landUse || null, crop_group: agro.cropGroup || null }
24
24
  : null,
25
- score: item.score?.disponible ? { value: item.score.score_global ?? null, rating: item.score.clasificacion ?? null } : null,
25
+ score: item.score?.available ? { value: item.score.score ?? null, rating: item.score.rating ?? null } : null,
26
26
  };
27
27
  }
28
28
  export function registerCompareParcels(server, client) {
@@ -47,7 +47,7 @@ export function registerCompareParcels(server, client) {
47
47
  }, async ({ parcels }) => {
48
48
  try {
49
49
  const { data, quota } = await client.compareParcels(parcels);
50
- const items = data.comparacion ?? [];
50
+ const items = data.parcels ?? [];
51
51
  return jsonResult({ total: data.total ?? items.length, parcels: items.map(summarize) }, quota);
52
52
  }
53
53
  catch (error) {
@@ -7,7 +7,7 @@ export function registerGetAgriculture(server, client) {
7
7
  description: "Agricultural context for a rural parcel: land use and main crop from the agricultural " +
8
8
  "parcel registry (SIGPAC in Spain, with slope, altitude and irrigation), vegetation index " +
9
9
  "(NDVI) and a reference crop price when available. Richest in Spain; also Portugal, France, " +
10
- "Italy and Germany. Field names are returned in Spanish, as the API sends them.",
10
+ "Italy and Germany. Values from official registries (land use, crop) stay in the source language.",
11
11
  inputSchema: {
12
12
  reference: z.string().min(1).describe("Official cadastral reference of a rural parcel"),
13
13
  country: z
@@ -18,7 +18,7 @@ export function registerGetAgriculture(server, client) {
18
18
  }, async ({ reference, country }) => {
19
19
  try {
20
20
  const { data, quota } = await client.getAgriculture(reference, country);
21
- return jsonResult({ reference, country: country ?? null, agriculture: data.agro ?? data }, quota);
21
+ return jsonResult({ reference, country: country ?? null, agriculture: data }, quota);
22
22
  }
23
23
  catch (error) {
24
24
  return handleToolError(error);
@@ -18,12 +18,11 @@ export function registerGetBoundaries(server, client) {
18
18
  try {
19
19
  const { data: d, quota } = await client.getPolygon(reference, country);
20
20
  return jsonResult(compact({
21
- reference: d.refCatastral || d.refcat || reference,
22
- country: d.pais || country,
23
- latitude: d.latitud ?? d.centroid?.latitude,
24
- longitude: d.longitud ?? d.centroid?.longitude,
25
- area_m2: d.area || d.superficieParcela,
26
- outline_lat_lng: d.poligono,
21
+ reference: d.reference || reference,
22
+ country: d.country || country,
23
+ latitude: d.centroid?.latitude,
24
+ longitude: d.centroid?.longitude,
25
+ area_m2: d.area,
27
26
  geojson: d.geojson,
28
27
  }), quota);
29
28
  }
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { CatastroGPSClient } from "../client/catastrogps-api.js";
3
+ export declare function registerGetCropCatalog(server: McpServer, client: CatastroGPSClient): void;
4
+ //# sourceMappingURL=get-crop-catalog.d.ts.map
@@ -0,0 +1,44 @@
1
+ import { z } from "zod";
2
+ import { CROP_LANGUAGES } from "../types/index.js";
3
+ import { handleToolError, jsonResult } from "./shared.js";
4
+ export function registerGetCropCatalog(server, client) {
5
+ server.registerTool("get_crop_catalog", {
6
+ title: "Get Crop Catalog",
7
+ description: "Free and without quota: every crop or land-use code that can appear as crop_code (Spanish " +
8
+ "Catastro codes, the foral codes of Alava, Bizkaia, Gipuzkoa and Navarre, and the Austrian, " +
9
+ "Estonian and Greek catalogues) with its name in the requested language, the original label " +
10
+ "and its common use_class. Use it to translate or group crop codes; pass code to look one up.",
11
+ inputSchema: {
12
+ lang: z.enum(CROP_LANGUAGES).optional().describe("Language of the names (default English)"),
13
+ code: z.string().min(1).optional().describe("Return only this crop code (e.g. G-, NA:1501, AT:53)"),
14
+ source: z
15
+ .string()
16
+ .min(1)
17
+ .optional()
18
+ .describe("Return only codes of this catalogue: ES, AL, BI, GI, NA, AT, EE or GR"),
19
+ },
20
+ }, async ({ lang, code, source }) => {
21
+ try {
22
+ const { data } = await client.getCropCatalog(lang);
23
+ const crops = (data.crops ?? []).filter((crop) => (!code || crop.code === code) && (!source || crop.source === source.toUpperCase()));
24
+ return jsonResult({
25
+ locale: data.locale,
26
+ locales: data.locales,
27
+ sources: data.sources,
28
+ count: crops.length,
29
+ use_classes: (data.useClasses ?? []).map((useClass) => ({ code: useClass.code, name: useClass.name })),
30
+ crops: crops.map((crop) => ({
31
+ code: crop.code,
32
+ source: crop.source,
33
+ name: crop.name,
34
+ original: crop.original,
35
+ use_class: crop.useClass ?? null,
36
+ })),
37
+ });
38
+ }
39
+ catch (error) {
40
+ return handleToolError(error);
41
+ }
42
+ });
43
+ }
44
+ //# sourceMappingURL=get-crop-catalog.js.map
@@ -30,14 +30,14 @@ export function registerGetGroundMotion(server, client) {
30
30
  try {
31
31
  const { data, quota } = await client.getGroundMotion(reference, country, point);
32
32
  return jsonResult({
33
- reference: data.refcat,
33
+ reference: data.reference,
34
34
  country: data.country,
35
35
  status: data.status,
36
36
  reason: data.reason,
37
37
  period: data.period?.label,
38
- ground_motion: data.ground_motion,
38
+ ground_motion: data.groundMotion,
39
39
  source: data.source,
40
- calculated_at: data.calculated_at,
40
+ calculated_at: data.calculatedAt,
41
41
  }, quota);
42
42
  }
43
43
  catch (caught) {
@@ -1,6 +1,28 @@
1
1
  import { z } from "zod";
2
2
  import { ENRICHMENT_COUNTRIES } from "../types/index.js";
3
- import { handleToolError, jsonResult } from "./shared.js";
3
+ import { compact, handleToolError, jsonResult } from "./shared.js";
4
+ function zonePrice(price) {
5
+ if (!price)
6
+ return null;
7
+ return compact({
8
+ price_per_m2_eur: price.pricePerM2Eur,
9
+ price_per_ha_eur: price.pricePerHaEur,
10
+ statistic: price.statistic,
11
+ authority: price.authority,
12
+ period: price.period,
13
+ });
14
+ }
15
+ function zonePrices(prices) {
16
+ if (!prices)
17
+ return null;
18
+ return {
19
+ zone: prices.zone,
20
+ zone_level: prices.zoneLevel,
21
+ municipality: prices.municipality ?? null,
22
+ urban: zonePrice(prices.urban),
23
+ rural: zonePrice(prices.rural),
24
+ };
25
+ }
4
26
  export function registerGetMarket(server, client) {
5
27
  server.registerTool("get_market_data", {
6
28
  title: "Get Market Data",
@@ -8,8 +30,10 @@ export function registerGetMarket(server, client) {
8
30
  "individual sales. Price figures exist only in France (DVF recorded sales: average EUR/m2, " +
9
31
  "number of sales, last sale date, estimated value), Italy (OMI zone values from Agenzia delle " +
10
32
  "Entrate) and Germany (official Bodenrichtwert land value per m2, North Rhine-Westphalia only; " +
11
- "elsewhere in Germany it answers available=false). For Spain (ES, PV, NA) and Portugal it " +
12
- "returns a reference note without figures: there is no per-parcel price source yet. " +
33
+ "elsewhere in Germany it answers available=false). For Spain (ES, PV, NA) it returns zone_prices: " +
34
+ "the official average prices of the parcel's province (housing per built m2 from MIVAU, farmland " +
35
+ "per hectare from MAPA), each with statistic, authority and period; no parcel-level sales. " +
36
+ "Portugal answers available=false. " +
13
37
  "One API call.",
14
38
  inputSchema: {
15
39
  reference: z.string().min(1).describe("Official cadastral reference"),
@@ -21,21 +45,22 @@ export function registerGetMarket(server, client) {
21
45
  }, async ({ reference, country }) => {
22
46
  try {
23
47
  const { data: d, quota } = await client.getMarketData(reference, country);
24
- const hasFigures = (d.precio_m2_eur ?? 0) > 0 || (d.precio_estimado_eur ?? 0) > 0;
48
+ const hasFigures = (d.pricePerM2Eur ?? 0) > 0 || (d.estimatedPriceEur ?? 0) > 0;
25
49
  return jsonResult({
26
50
  reference,
27
51
  country: country ?? null,
28
- available: d.disponible,
52
+ available: d.available,
29
53
  has_price_figures: hasFigures,
30
- price_per_m2_eur: d.precio_m2_eur || null,
31
- estimated_value_eur: d.precio_estimado_eur || null,
32
- sales_count: d.num_transacciones || null,
33
- last_sale_date: d.fecha_ultima_transaccion || null,
34
- granularity: d.granularidad_display || d.granularidad || null,
35
- data_quality: d.data_quality ?? null,
36
- updated: d.fecha_actualizacion || null,
37
- source: d.fuente ?? null,
38
- note: d.mensaje_usuario ?? null,
54
+ price_per_m2_eur: d.pricePerM2Eur || null,
55
+ estimated_value_eur: d.estimatedPriceEur || null,
56
+ sales_count: d.salesCount || null,
57
+ last_sale_date: d.lastSaleDate || null,
58
+ granularity: d.granularity || null,
59
+ data_quality: d.dataQuality ?? null,
60
+ updated: d.updatedAt || null,
61
+ source: d.source ?? null,
62
+ note: d.message || null,
63
+ zone_prices: zonePrices(d.zonePrices),
39
64
  }, quota);
40
65
  }
41
66
  catch (error) {
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { CatastroGPSClient } from "../client/catastrogps-api.js";
3
+ export declare function registerGetNeighbors(server: McpServer, client: CatastroGPSClient): void;
4
+ //# sourceMappingURL=get-neighbors.d.ts.map
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ import { REFERENCE_COUNTRIES } from "../types/index.js";
3
+ import { handleToolError, jsonResult } from "./shared.js";
4
+ export function registerGetNeighbors(server, client) {
5
+ server.registerTool("get_neighbors", {
6
+ title: "Get Neighboring Parcels",
7
+ description: "Parcels that touch or surround a parcel (up to 60), each with its cadastral reference and " +
8
+ "centre point. Spain from the official cadastre; other countries from our own copy where we " +
9
+ "hold one. Where neighbours cannot be listed it answers supported=false with an empty list, " +
10
+ "free. One API call.",
11
+ inputSchema: {
12
+ reference: z.string().min(1).describe("Official cadastral reference of the parcel"),
13
+ country: z.enum(REFERENCE_COUNTRIES).optional().describe("Optional country code. Omit to auto-detect."),
14
+ },
15
+ }, async ({ reference, country }) => {
16
+ try {
17
+ const { data: d, quota } = await client.getNeighbors(reference, country);
18
+ return jsonResult({
19
+ reference,
20
+ country: d.country ?? country ?? null,
21
+ supported: d.supported,
22
+ count: d.count,
23
+ neighbors: d.neighbors ?? [],
24
+ }, quota);
25
+ }
26
+ catch (error) {
27
+ return handleToolError(error);
28
+ }
29
+ });
30
+ }
31
+ //# sourceMappingURL=get-neighbors.js.map
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { CatastroGPSClient } from "../client/catastrogps-api.js";
3
+ export declare function registerGetParcelSubparcels(server: McpServer, client: CatastroGPSClient): void;
4
+ //# sourceMappingURL=get-parcel-subparcels.d.ts.map
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ import { CROP_LANGUAGES, REFERENCE_COUNTRIES } from "../types/index.js";
3
+ import { compact, handleToolError, jsonResult } from "./shared.js";
4
+ export function registerGetParcelSubparcels(server, client) {
5
+ server.registerTool("get_parcel_subparcels", {
6
+ title: "Get Parcel Subparcels",
7
+ description: "What is on each part of a parcel: every crop or land-use subparcel with a stable crop_code, the " +
8
+ "crop name in the requested language, the original label of the source, area in m2, kind " +
9
+ "(cadastral, declaredCrop, landCover), a common use_class (arable, vineyard, olive, forest...), " +
10
+ "intensity, land type and class, source and, with include_geometry, its GeoJSON outline. " +
11
+ "Spain (Catastro, including Bizkaia, Alava, Navarre; Gipuzkoa without outlines), Austria, " +
12
+ "Estonia and Greece. One API call; free when the parcel has none. If the source does not " +
13
+ "answer it returns SUB_001: nothing is charged, retry in a few seconds. Translate codes with " +
14
+ "get_crop_catalog.",
15
+ inputSchema: {
16
+ reference: z.string().min(1).describe("Official cadastral reference of the parcel"),
17
+ country: z
18
+ .enum(REFERENCE_COUNTRIES)
19
+ .optional()
20
+ .describe("Optional country code (ES, PV, NA, AT, EE, GR...). Omit to auto-detect."),
21
+ lang: z.enum(CROP_LANGUAGES).optional().describe("Language of crop names (default English)"),
22
+ include_geometry: z
23
+ .boolean()
24
+ .optional()
25
+ .describe("Include the GeoJSON outline of each subparcel (large). Default false."),
26
+ },
27
+ }, async ({ reference, country, lang, include_geometry }) => {
28
+ try {
29
+ const { data: d, quota } = await client.getSubparcels(reference, country, lang);
30
+ return jsonResult({
31
+ reference: d.reference,
32
+ country: d.country ?? country ?? null,
33
+ parcel_area_m2: d.parcelArea ?? null,
34
+ count: d.count,
35
+ subparcels: (d.subparcels ?? []).map((row) => compact({
36
+ id: row.id,
37
+ crop_code: row.cropCode,
38
+ crop: row.crop,
39
+ crop_original: row.cropOriginal,
40
+ area_m2: row.area,
41
+ kind: row.kind,
42
+ use_class: row.useClass,
43
+ use_class_name: row.useClassName,
44
+ intensity: row.intensity,
45
+ land_type: row.landType,
46
+ land_class: row.landClass,
47
+ source: row.source,
48
+ geometry: include_geometry ? row.geometry : undefined,
49
+ })),
50
+ }, quota);
51
+ }
52
+ catch (error) {
53
+ return handleToolError(error);
54
+ }
55
+ });
56
+ }
57
+ //# sourceMappingURL=get-parcel-subparcels.js.map