kskadart/2gis-mcp-server
If you are the rightful owner of 2gis-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The 2GIS Search MCP Server is a Model Context Protocol server that provides access to the 2GIS Search API, enabling AI assistants and other MCP clients to perform various location-based searches and geocoding tasks.
2GIS Search MCP Server
A simple Model Context Protocol (MCP) server that provides access to the 2GIS Search API. This server allows AI assistants and other MCP clients to search for places, geocode addresses, get location suggestions, and more using the 2GIS mapping service.
What is This?
This is an MCP server that exposes 2GIS Search API functionality through a standardized protocol. It includes tools for:
- Places - Search for places by name and location
- Geocoder - Convert addresses to coordinates
- Suggest - Get autocomplete suggestions for locations
- Categories - Search for business categories
- Regions - Find regions by name
- Markers - Get map markers for search results
Prerequisites
- Python 3.13+
- npx (for running MCP Inspector)
- A 2GIS API key
Getting Your 2GIS API Key
To use this MCP server, you need a 2GIS API key:
- Visit the 2GIS API Console
- Sign up or log in to your account
- Create a new project
- Generate an API key for the "Search API"
- Copy your API key for use in the setup below
Note: 2GIS may require you to provide information about your use case and may have geographic or usage restrictions depending on your region.
Setup
-
Clone or download this repository
-
Create a
.envfile in the project root:
DGIS_API_KEY=your_api_key_here
DGIS_SEARCH_API_URL=https://catalog.api.2gis.com
Replace your_api_key_here with the API key you obtained from 2GIS.
- Install dependencies using uv:
uv sync
Running the Server
Start the MCP server with:
python3 -m src.main --transport stdio
Available Options
--transport: Choose transport protocol (stdio,sse, orstreamable-http). Default:stdio--host: Host to bind the server to. Default:0.0.0.0--port: Port to bind the server to. Default:8101--debug: Enable debug mode for verbose logging
Example with custom port and debug mode:
python3 -m src.main --transport streamable-http --host 0.0.0.0 --port 8101 --debug
Running with Docker
The easiest way to run the server is using Docker Compose with streamable-http transport:
# Start the server
docker-compose up -d
# Check logs
docker-compose logs -f
# Stop the server
docker-compose down
The Docker container runs with streamable-http transport on port 8101, making it accessible at http://localhost:8101.
Testing with MCP Inspector
Testing stdio transport (local development):
npx @modelcontextprotocol/inspector uv run src/main.py --transport stdio
Testing streamable-http transport (Docker):
-
Start the MCP Inspector:
npx @modelcontextprotocol/inspector -
Open your browser and navigate to
http://localhost:6274 -
Connect to your server:
- Transport type: Select "Streamable HTTP"
- URL: Enter
http://localhost:8101/mcp - Click "Connect"
-
Test your tools - You should now see all 6 available tools and can test them interactively!
Available Tools
Once running, the MCP server exposes the following tools:
place_tool(query, location, point, radius)- Search for placesgeocoder_tool(query, location)- Geocode addressessuggest_tool(query, location)- Get location suggestionscategories_tool(query, region_id)- Search categoriesregions_tool(query)- Search regionsmarkers_tool(query, location)- Get map markers
Testing 2GIS API Directly
The https/ directory contains .http files for testing the 2GIS API endpoints directly. These files can be used with REST client extensions (like REST Client for VS Code or IntelliJ HTTP Client) to explore and verify the API responses:
geocode.http- Test geocoding endpointssuggest.http- Test autocomplete suggestionsplace.http- Test place searchcategories.http- Test category searchregions.http- Test region searchmarkers.http- Test marker endpoints
To use these files:
- Configure your API key in
.vscode/settings.json(see.vscode/settings.json.examplefor reference) - Open any
.httpfile in your IDE - Click "Send Request" (or equivalent in your IDE)
- View the API response directly
These are useful for understanding the raw 2GIS API responses before testing through the MCP server.
Documentation
For detailed 2GIS API documentation, see the official 2GIS Search API documentation.
License
This project is licensed under the MIT License - see the file for details.