GeoLens is an open-source, self-hostable alternative to ArcGIS Online whose core feature is a spatial data catalog, with support for maps, stories, and dashboards, served via the OGC API and STAC standards. The mcp directory in this repository contains an Apache-2.0-licensed Model Context Protocol (MCP) server for connecting coding agents (such as Claude Code, Cursor, Codex, etc.) to a GeoLens instance.
Purpose: This MCP server lets coding agents interact directly with GeoLens during development sessions, discover datasets, inspect schemas, read features and maps, and run read-only SQL queries. With a map_author API key, agents can also create private maps and add, style, and adjust layers.
Main capabilities:
- Read tools (limited by the caller's access permissions): search_datasets, get_dataset_schema, and get_features are used to find datasets, read column information, and page through features; list_maps and get_map are used to retrieve saved maps and their layers; list_stories and get_story are used to retrieve published stories and their chapters (drafts are not read; for older servers that do not support chapter counting, chapter_count is null); aggregate is used to perform exact counts, statistics, histograms, grouping, and row pagination on a single dataset; query is used to execute a sandboxed SELECT statement (aggregate is recommended for counts and summaries).
- Write tools (require a map_author API key): create_map creates a private map (optional description and basemap) and returns an id and an application URL; add_layer adds a dataset as a layer (optional style and popup fields); new layers are drawn below existing layers and keys cannot reorder them, so layers you want on top should be added first; update_layer_style restyles a layer or changes popup fields; set_camera and set_basemap set the view and basemap when the map opens. Styles can be a single color, colored by text/boolean/integer column values, or colored by classification of a numeric column (equal interval, quantile, natural breaks, standard deviation, or custom breaks), with colors from a named color ramp or a list of hex colors, mapsThe builder opens the layer with the same settings.
Usage: the server reads GEOLENS_INSTANCE from environment variables; for non-public data it also needs GEOLENS_API_KEY. Client setup, tool list, and credential rules are detailed in the MCP guide. A map_author key must be created under API keys in settings and granted the Map author scope; this key can read what read-only keys can read, but can only change maps it created, cannot edit maps created by the app or other keys, cannot delete anything, cannot rename maps or layers, and cannot share maps. These write tools reject other credentials (including full keys, publish keys, or GEOLENS_TOKEN) and will clearly indicate this; read tools remain usable.
Limits: aggregate is subject to routing limits; if it returns too_wide, the number of rows in the bbox exceeds 500,000 and the range must be narrowed; if it returns query_busy, two aggregations are already running and you must retry later. This server has no data ingestion, deletion, sharing, or administration tools.