Geo MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.

AliSoft Geo MCP Ollama
By Dr. Ali Abbas aabbas7@gmail.com
Programming Language: Python
Geo MCP Ollama
Connecting GIS & Local LLMs: Geo MCP with Ollama Tutorial

A fully local AI assistant that answers GIS questions by calling real geospatial tools. A small LLM running in Ollama decides which tool to use, a FastMCP server executes it with Shapely, and the LLM explains the result. No cloud service and no API keys.
Why this project
Language models are unreliable at precise geometry and distance maths. Instead of letting the model guess, this project gives it a toolbox of exact functions exposed through the Model Context Protocol (MCP). The same server can be reused by any MCP-capable client.
Related MCP server: ArcGIS Pro Local MCP
Architecture
sequenceDiagram
participant U as User
participant C as ollama_client.py (MCP client)
participant L as Ollama (qwen3:4b)
participant S as geo_server.py (MCP server)
U->>C: Question
C->>S: Start subprocess (stdio) and list_tools()
S-->>C: Tool names + JSON schemas
loop Agent loop (max 5 turns)
C->>L: chat(messages, tools)
L-->>C: tool_calls or final answer
C->>S: call_tool(name, args)
S-->>C: JSON result
end
C-->>U: Final answerComponent | File | Role |
MCP server |
| Exposes three GIS tools over stdio (FastMCP + Shapely) |
MCP client / agent |
| Discovers tools, passes them to the LLM, executes tool calls, loops until an answer |
LLM runtime | Ollama | Serves |
Available tools
Tool | Inputs | Output |
|
| Buffer polygon as WKT and its area in km² |
|
| Haversine distance in km |
|
|
|
WKT uses longitude first, then latitude:
POLYGON ((lon lat, lon lat, ...)).
Requirements
Python 3.10 or newer
Ollama installed
About 4 to 6 GB of free RAM for the 4B model
Windows for the provided
.batlaunchers (the Python code itself is cross-platform)
Quick start (Windows)
:: 1. One-time setup: creates .venv and installs dependencies
01_setup.bat
:: 2. Start Ollama (skip if the Ollama app is already running)
02_start_ollama.bat
:: 3. Download the model (one time, in a new terminal)
ollama pull qwen3:4b
:: 4. Run the client; it starts the GIS server automatically
03_start_ai_geo_server_ollama_client.batLinux / macOS
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
ollama serve & # if not already running
ollama pull qwen3:4b
export NO_PROXY=localhost,127.0.0.1,::1
python ollama_client.py geo_server.pyUsage
ollama_client.py runs two demo questions. Edit the queries list in main() to ask your own:
queries = [
"What is the distance between Seattle (47.6062, -122.3321) and Portland (45.5152, -122.6784)?",
]Expected console output for a tool-using question:
[Client] Discovered 3 tools: ['buffer_point', 'distance_between_points', 'point_in_polygon']
[Client] LLM requested tool: distance_between_points({'lat1': 47.6062, 'lon1': -122.3321, ...})
[Client] Tool result: {"distance_km": 234.011}
[Client] Final answer (turn 2)
Assistant: The geodesic distance ... is 234.01 kilometers.Test the tools without any LLM:
import asyncio
from fastmcp import Client
from geo_server import mcp
async def main():
async with Client(mcp) as c:
print(await c.call_tool("distance_between_points", {
"lat1": 47.6062, "lon1": -122.3321, "lat2": 45.5152, "lon2": -122.6784}))
asyncio.run(main())Project structure
geo-mcp-ollama/
├── geo_server.py # MCP server with the GIS tools
├── ollama_client.py # MCP client + Ollama agent loop
├── requirements.txt # Pinned dependencies
├── 01_setup.bat # Create .venv and install packages
├── 02_start_ollama.bat # ollama serve
└── 03_start_ai_geo_server_ollama_client.bat # Run client (spawns the server)Configuration
Setting | Where | Default |
Model |
|
|
Ollama URL |
|
|
Max agent turns |
|
|
Proxy bypass |
| enabled |
Force CPU |
| off |
Adding a new tool
Add a typed, documented function to geo_server.py. FastMCP turns the signature and docstring into the schema the LLM sees, so write clear docstrings (units, coordinate order).
@mcp.tool
def bounding_box(polygon_wkt: str) -> str:
"""Return the bounding box (min_lon, min_lat, max_lon, max_lat) of a WKT geometry."""
try:
return json.dumps({"bbox": shapely_wkt.loads(polygon_wkt).bounds})
except Exception as e:
return json.dumps({"error": str(e)})Do not use print() in the server: stdout is the MCP transport. Log to stderr instead.
Known limitations
buffer_pointaccuracy. It converts km to degrees with the longitude factor on both axes, so the buffer is stretched north-south by 1/cos(latitude) and the area is overstated (116.4 km² instead of about 78.4 km² for a 5 km buffer at 47.65°N). Fix: build the buffer geodesically withpyproj.Geod(already listed inrequirements.txtbut not yet used).Small models may skip tools. In testing,
qwen3:4banswered a buffer-area question by itself instead of callingbuffer_point. Use a strict system prompt ("you MUST call the matching tool"),temperature: 0, or a larger model.Speed on CPU.
qwen3:4bresolves to a reasoning ("Thinking") build. On a CPU-only laptop it generated 5 to 7 tokens/s and one question took several minutes. An instruct (non-thinking) model is much faster.Haversine assumes a spherical Earth (about 0.5% error); use
pyproj.Geodfor ellipsoidal accuracy.A new server process is started for every question.
Troubleshooting
Symptom | Fix |
| Install Python 3.10+ and add it to PATH |
Connection refused on | Start Ollama ( |
| Run |
| Ollama is already running; skip that step |
Proxy-related errors to localhost | Launch through script 03 (sets |
Ollama crash | Uncomment |
| Rephrase the question, raise |
Roadmap
Geodesic
buffer_pointusingpyproj.GeodInput validation and error feedback to the LLM on failed tool calls
Interactive chat mode with one persistent MCP session
More tools: polygon area, centroid, reprojection, nearest neighbour, GeoJSON layers
Automated tests with a scripted fake LLM
Documentation
A detailed step-by-step guide with diagrams is available in docs/Geo_MCP_Ollama_Project_Guide.docx.
Author
Dr. Ali Abbas Software engineer and researcher (Computer Vision, GIS, UAV systems, embedded and Android development)
Email: aabbas7@gmail.com
Website: aabbas77-web.github.io
Questions, bug reports and collaboration ideas are welcome. Please open an issue or get in touch by email.
License
This project is licensed under the MIT License. Copyright (c) 2026 Dr. Ali Abbas.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Pay-per-call GIS tools for AI agents: coordinates, measurement, reprojection, elevation, terrain.
Verifiable geospatial tools: distances, topology, isochrones, Overture Maps, with sources.
Bounded tools for rendering, extraction, RAG, enrichment, local discovery and review analysis.
Ask in plain English, get a rendered, shareable map from live public data. 24 geospatial tools.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables LLMs to geocode and reverse geocode places, find nearby points of interest, search categories within an area, get turn-by-turn routing, suggest meeting points, and analyze neighborhoods, commutes, schools, EV charging, and parking through OpenStreetMap data services. It also serves place and map tile resources over stdio, SSE, or Streamable HTTP transports.12MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI clients to inspect and modify maps and scenes open in a locally running desktop GIS session through natural language, exposing 38 fixed tools for session and layer queries, fields, selection, visibility and renaming, symbology, transparency, camera and elevation, map switching, raster, layout export, whitelisted geoprocessing, and attribute editing. It routes stdio MCP calls through a Windows named pipe to a C# add-in, with no network ports and no arbitrary code execution.MIT
- AlicenseAqualityCmaintenanceEnables agents to perform local Houston retail site-selection analysis by calling ArcPy/numpy tools over stdio for geocoding, hex profiling, overlay suitability, embedding similarity, hot-spot detection, and validation, with sources, checks, and caveats included.6MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to inspect geospatial vector and raster metadata and run bounded analysis on administrator-registered datasets, including planar buffering, clipping, spatial joins, and PNG map rendering delivered as checksummed artifacts. All data access is read-only and controlled through a curated dataset catalog.Apache 2.0