MCP ExplorerExplorer

Osm Mcp Server

@tpp6meon 10 months ago
1 MIT
FreeCommunity
AI Systems
MCP server for Nominatim and OSRM applications

Overview

What is Osm Mcp Server

osm-mcp-server is a server designed for accessing various OpenStreetMap (OSM) functionalities, specifically focusing on geocoding, reverse geocoding, and distance calculations using the Nominatim and OSRM APIs.

Use cases

Use cases for osm-mcp-server include retrieving coordinates for specific locations, converting coordinates back to addresses, calculating distances between cities (e.g., San Jose and San Francisco), and integrating geographical functionalities into web applications.

How to use

To use osm-mcp-server, install the required dependencies using ‘npm install’. Create a directory called ‘.vscode’ in your working directory, and add a configuration file named ‘mcp.json’ with the necessary server settings. Update the paths to your Node.js installation and API keys as needed.

Key features

Key features of osm-mcp-server include geocoding and reverse geocoding via the Nominatim API, route distance calculations using OSRM, and haversine distance calculations between two geographical points.

Where to use

osm-mcp-server can be used in various applications that require geographical data processing, such as mapping services, location-based applications, and logistics management systems.

Content

MCP Server for OSM

Overview

This is an MCP server for accessing some OSM functions. We will access nominatim functionality of geocoding and reverse geocoding and some of the distance APIs from OSRM.

Please note that these are open servers, use them lightly and fairly. For production usage consider installing you own servers and using them. The base urls are at the beginning of the file index.js

This can be used as a simple started code to understand MCP servers. It gives implementations of APIs and also haversine distance a non-API implementation.

Requirements

It need Node version 20 and above

Features

The following geo services are coded

  1. Geocoding using Nominatim API. Sample prompt -Give coordinates of New York
  2. Reverse geocoding using Nominatim API. Sample prompt - Give address of (12.77, 78.32)
  3. Route distance between 2 points using OSRM.
  4. Haversine distance between 2 points

You can ask for the distance between San Jose and San Fransisco and the server will get the coordinates for both San Jose and San Fransisco and get the straight distance and route distance.

Installation

To install the dependancies

npm install

Else you can install the dependancy

npm install @modelcontextprotocol/sdk

To enable the MCP server in the workspace we have create a directory and a configuration file in that directory.

mkdir .vscode
cd .vscode
touch mcp.json

Make a directory called .vscode in you working directory, create a file called mcp.json and add the configuration below. Update the paths to you node and your API key

{
    "servers": {
        "my-mcp-server-bfba9100": {
            "type": "stdio",
            "command": "/path/to/node",
            "args": [       
                "/path/to/index.js"
            ],
            "env": {

            },
        }
    }
}

Global VScode

Add the configuration file in ~/.vscode to make it accessible across all directories

Cursor

The global and local workspace will work for cursor also. The directories will be called .cursor. You can place the configuration file.

Claude Integration

The MCP server can be added to Claude Desktop app. Find the file claude_desktop_config.json. In MAC they will be available at

` ~/Library/Application\ Support/Claude/claude_desktop_config.json

Using custom Nominatim and OSRM servers

This MCP server can be used with custom Nominatim and OSRM servers, for e.g. your own servers if you choose to host them. This is usually recommended for production use. Change the lines

const NOMINATIM_BASE_URL = "<CUSTOM NOMINATIM SERVER>";
const OSRM_BASE_URL = "<CUSTOM OSRM SERVER>";





Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers