This MCP server integrates OpenStreetMap data to enhance LLMs with powerful location-based capabilities. It enables geospatial features like geocoding, route planning, POI search, and neighborhood analysis without requiring direct API access.
To use the OpenStreetMap MCP server with compatible hosts like Claude Desktop, Cursor, or Windsurf, add the following configuration:
"mcpServers": {
"osm-mcp-server": {
"command": "uvx",
"args": [
"osm-mcp-server"
]
}
}
To install and run the server locally:
pip install -e .
osm-mcp-server
The server will listen for MCP requests on the standard input/output.
The server provides these geospatial tools:
The server implements these location-based resources:
location://place/{query}
: Get information about places by name or addresslocation://map/{style}/{z}/{x}/{y}
: Get styled map tiles at specified coordinatesYou can test the server with the included example client:
python examples/client.py
This demonstrates:
For LLM integration, try the helper class:
python examples/llm_client.py
This shows how an LLM can use the Location Assistant to:
To build a custom client:
from mcp.client import Client
client = Client("http://localhost:8000")
# Example: Geocode an address
results = await client.invoke_tool("geocode_address", {"address": "New York City"})
To configure Claude Desktop to use your local server:
~/Library/Application\ Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
Add the following configuration:
"mcpServers": {
"osm-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/path/to/osm-mcp-server",
"run",
"osm-mcp-server"
]
}
}
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.