SS

sherlyhu00/spatial-reasoning-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

0 stars 0 forks 质量 68 趋势 14

一个MCP服务器,为LLM代理提供真实的地理空间计算工具,使答案中的空间主张是从指定来源计算的,而不是从模型参数中回忆。

概览

一个MCP服务器,为LLM代理提供真实的地理空间计算工具,使答案中的空间主张是从指定来源计算的,而不是从模型参数中回忆。 问一个语言模型两个地方相距多远,或者多次停靠需要多长时间,它会给出一个有信心的数字。这个数字往往是错误的,答案中也没有说明它的来源。 该服务器通过工具调用来回答这些问题。以下有两条规则: 1. 每个工具返回结果、源和参数,方便调用者查看是什么产生了该值以及使用了哪些设置。2. 如果某个位置无法解析或路由器不可用,工具会提交数据。它不会返回估计值,因为该服务器解决的问题是读取到类似测量值的估计值。 行驶路线是直线的1.75倍。模型凭记忆回答时,给出的数字在该范围内某处,无法判断具体指的是哪个数字。

概述(AI 翻译)

一个MCP服务器,为LLM代理提供了真实的地理空间计算工具,因此 答案中的空间主张是从指定来源计算的,而不是 从模型参数中回忆。

为什么

问一个语言模型两个地方相距多远,或者多重停车有多长 trip 需要,并且会得到一个有把握的数字。这个数字经常是错误的, 答案中也没有说明它来自哪里。

该服务器通过工具调用来回答这些问题。以下有两条规则:

  1. 每个结果都带有其来源。 每个工具返回result, [source 和 params),这样调用者可以看到是什么产生了该值和 用什么设置?
  2. 无静默备份。 如果某个地点无法解决或路由器无法解决 不可用时,工具会升高。它不会返回估计值,因为 这个服务器解决的问题是估计值读起来像测量值。

一个例子

佐治亚理工至亚特兰大皮埃蒙特公园:

价值 来源
distance_between 2,874.9 米 球面距离,R = 6,371,008.8 米
route_between,行驶 5,022.0 米,12.7分钟 OSM路线经瓦尔哈拉(自动)

驾驶路线是直线的1.75倍。

本页由 AI 翻译,技术细节请以原文为准。

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 新手?先看 mcpskill.org 教程 →

配置

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