SS

sherlyhu00/spatial-reasoning-mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

0 stars 0 forks 品質 68 トレンド 14

An MCP server that gives an LLM agent real geospatial computation as tools, so that spatial claims in an answer are computed from a named source rather than recalled from the model's parameters.

概要

An MCP server that gives an LLM agent real geospatial computation as tools, so that spatial claims in an answer are computed from a named source rather than recalled from the model's parameters. Ask a language model how far apart two places are, or how long a multi-stop trip takes, and it will produce a confident number. The number is often wrong, and nothing in the answer says where it came from. This server answers those questions with a tool call instead. Two rules follow: 1. Each tool returns result, source and params, so the caller can see what produced the value and with which settings. 2. If a place cannot be resolved or a router is unavailable, the tool raises. It does not return an estimate, because an estimate that reads like a measurement is the problem this server addresses. The driving route is 1.75 times the straight line. A model answering from memory gives one number somewhere in that range, with no way to tell which quantity it meant.

README

以下は原文 README の抜粋です。原文を見る。

spatial-reasoning-mcp

An MCP server that gives an LLM agent real geospatial computation as tools, so that spatial claims in an answer are computed from a named source rather than recalled from the model’s parameters.

Why

Ask a language model how far apart two places are, or how long a multi-stop trip takes, and it will produce a confident number. The number is often wrong, and nothing in the answer says where it came from.

This server answers those questions with a tool call instead. Two rules follow:

  1. Every result carries its provenance. Each tool returns result, source and params, so the caller can see what produced the value and with which settings.
  2. No silent fallback. If a place cannot be resolved or a router is unavailable, the tool raises. It does not return an estimate, because an estimate that reads like a measurement is the problem this server addresses.

An example

Georgia Tech to Piedmont Park, Atlanta:

value source
distance_between 2,874.9 m spherical distance, R = 6,371,008.8 m
route_between, drive 5,022.0 m, 12.7 min OSM routing via Valhalla (auto)

The driving route is 1.75 times the straight line. A model answering from memory gives one number somewhere in that range, with no way to tell which quantity it meant. Both numbers above say what they are and what computed them.

Tools

Tool What it does Source
geocode_place place name to coordinates OSM / Nominatim
reverse_geocode coordinates to the nearest addressable place OSM / Nominatim
distance_between great-circle distance between two points spherical Earth model
point_in_region which polygon of a GeoJSON layer contains a point the layer you pass in
route_between network distance and travel time OSM routing (see backends)
order_stops visiting order with the shortest total travel time OSM routing (see backends)

order_stops searches orderings exhaustively and accepts at most eight stops, so the order it returns is optimal for its travel-time matrix rather than a heuristic the caller has to trust.

Install and run

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python -m spatial_reasoning_mcp

The server communicates over stdio, so on its own it will sit there waiting for a client. Register it with one (Claude Desktop, Claude Code, Cursor):

{
  "mcpServers": {
    "spatial-reasoning": {
      "command": "/absolute/path/to/.venv/bin/python",
      "args": ["-m", "spatial_reasoning_mcp"],
      "cwd": "/absolute/path/to/spatial-reasoning-mcp"
    }
  }
}

To see the tools work without a client, run python scripts/smoke.py, which calls each one against live data and prints the results.

Routing backends

Set SRM_ROUTING_BACKEND to choose. All six tools work on either.

valhalla (default) calls a hosted OpenStreetMap router, by default the

GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "spatial-reasoning": { "command": "/absolute/path/to/.venv/bin/python", "args": ["-m", "spatial_reasoning_mcp"], "cwd": "/absolute/path/to/spatial-reasoning-mcp" } } }