Skip to main content

MCP server

The 2GIS MCP server provides AI agents with access to 2GIS geodata: maps, addresses, routes, and business information. It uses the open Model Context Protocol, routing requests from AI agents to the 2GIS API and returning results in a format suitable for processing. AI assistants use this data to answer user questions about places, addresses, businesses, and routes, as well as to analyze and visualize data.

How it works:

  1. A user sends a request to an AI agent (for example, Find all 24-hour pharmacies).
  2. The agent determines what geodata and services are needed (maps, POI search, etc.) and calls the MCP server.
  3. The MCP server sends requests to the appropriate 2GIS APIs (for example, Static API for map images, Places API for searching and retrieving information about places).
  4. The agent receives the result and generates a response for the user.

The MCP server provides access to the same data as direct API calls and is subject to the same pricing and rate limits.

Available tools and APIs

The MCP server provides the following tools:

ToolFunction
2GIS API used
search_poiSearching for places and businesses by query and coordinatesPlaces API, Geocoder API
calculate_routeBuilding routes for various transport modes, calculating travel time and distanceRouting API
geocodeForward geocoding: converting an address to coordinatesGeocoder API
reverse_geocodeReverse geocoding: converting coordinates to an addressGeocoder API
create_map_viewCreating a static map with markers in PNG formatStatic API
calculate_isochroneBuilding areas reachable from a starting point within a given time (isochrones)Isochrone API

1. Get an access key

  1. Sign up in the Platform Manager dashboard.

  2. Get a key for the required APIs:

    • Get a free demo key (valid for 30 days, with request limits). The demo key has all the APIs required for the MCP server enabled automatically.

    • Purchase a subscription and create API keys. It is recommended to create two keys for the MCP server to separately control usage of maps and search APIs and routing APIs. The number of keys does not affect subscription cost. Recommended API distribution by keys:

      • One key for maps and search: Static API, Geocoder API, Places API.
      • One key for routing: Routing API, Isochrone API.

    If you create only one key, make sure all the APIs required for the MCP server are enabled. For more information about keys and subscriptions, see the dashboard documentation.

For pricing details, see the Prices section.

2. Install and build the MCP server

  1. Clone the MCP server repository.

  2. Install dependencies:

    npm install
  3. Build the MCP server:

    npm run build

    After the build, a dist/index.js file is created in the repository root. You will need to specify the path to this file in the launch configuration in the next step.

3. Connect the MCP server to an application

  1. Download and install Claude Desktop.

  2. Add the 2GIS MCP server configuration to the claude_desktop_config.json settings file:

    {
    "mcpServers": {
    "2gis": {
    "command": "node",
    "args": ["PATH_TO_REPO/dist/index.js"],
    "env": {
    "MAPGL_API_KEY": "YOUR_MAPS_API_KEY",
    "ROUTING_API_KEY": "YOUR_ROUTING_API_KEY"
    }
    }
    }
    }

    Where:

    • PATH_TO_REPO - path to the MCP server repository folder containing the built dist/index.js file.
    • YOUR_MAPS_API_KEY - your API key for maps and search.
    • YOUR_ROUTING_API_KEY - your API key for routing. If you use a single key for all APIs, specify it in both variables.

    If the server is deployed remotely (accessible via HTTP), use Supergateway:

    {
    "mcpServers": {
    "2gis": {
    "command": "npx",
    "args": [
    "-y",
    "supergateway",
    "--streamableHttp",
    "https://YOUR_HOST/mcp"
    ]
    }
    }
    }

Example

Images below show examples of the 2GIS MCP server used in a dialogue between the user and the AI assistant:

  • Searching for objects by criteria:

    Dialogue for searching objects
  • Displaying an object on the map:

    Dialogue for displaying an object on the map
  • Calculating a route:

    Dialogue for routing