tablegis-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tablegis_mcp-0.1.0/LICENSE +21 -0
- tablegis_mcp-0.1.0/PKG-INFO +122 -0
- tablegis_mcp-0.1.0/README.md +92 -0
- tablegis_mcp-0.1.0/pyproject.toml +46 -0
- tablegis_mcp-0.1.0/setup.cfg +4 -0
- tablegis_mcp-0.1.0/src/tablegis_mcp/__init__.py +3 -0
- tablegis_mcp-0.1.0/src/tablegis_mcp/server.py +503 -0
- tablegis_mcp-0.1.0/src/tablegis_mcp.egg-info/PKG-INFO +122 -0
- tablegis_mcp-0.1.0/src/tablegis_mcp.egg-info/SOURCES.txt +11 -0
- tablegis_mcp-0.1.0/src/tablegis_mcp.egg-info/dependency_links.txt +1 -0
- tablegis_mcp-0.1.0/src/tablegis_mcp.egg-info/entry_points.txt +2 -0
- tablegis_mcp-0.1.0/src/tablegis_mcp.egg-info/requires.txt +5 -0
- tablegis_mcp-0.1.0/src/tablegis_mcp.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Non-existent987
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tablegis-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP Server for TableGIS - Geospatial data processing tools for AI assistants
|
|
5
|
+
Author-email: Non-existent987 <jiaqi0425_000@163.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Non-existent987/tablegis-mcp
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/Non-existent987/tablegis-mcp/issues
|
|
9
|
+
Project-URL: Repository, https://github.com/Non-existent987/tablegis-mcp.git
|
|
10
|
+
Keywords: mcp,gis,geospatial,tablegis,claude,ai,nearest-neighbor,buffer,spatial-analysis
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: mcp[cli]>=1.0.0
|
|
25
|
+
Requires-Dist: tablegis>=0.0.14
|
|
26
|
+
Requires-Dist: pandas
|
|
27
|
+
Requires-Dist: geopandas
|
|
28
|
+
Requires-Dist: shapely
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# TableGIS MCP Server
|
|
32
|
+
|
|
33
|
+
Geospatial data processing tools for AI assistants via the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/).
|
|
34
|
+
|
|
35
|
+
Wraps [tablegis](https://github.com/Non-existent987/tablegis) functions as MCP tools, enabling AI clients (Claude Desktop, Cursor, etc.) to perform spatial analysis through natural language.
|
|
36
|
+
|
|
37
|
+
## Tools
|
|
38
|
+
|
|
39
|
+
| Tool | Description |
|
|
40
|
+
|------|-------------|
|
|
41
|
+
| `nearest_neighbor_one_table` | Find nearest n neighbors within a single point dataset |
|
|
42
|
+
| `nearest_neighbor_two_tables` | Find nearest n points from dataset B for each point in dataset A |
|
|
43
|
+
| `create_buffer` | Create circular or ring buffers around points (metres) |
|
|
44
|
+
| `create_polygon` | Create regular or star polygons around points |
|
|
45
|
+
| `create_sector` | Create sector (wedge) polygons for directional coverage |
|
|
46
|
+
| `points_to_geodataframe` | Convert lon/lat columns to Point geometries |
|
|
47
|
+
| `calculate_area` | Calculate polygon areas in square metres |
|
|
48
|
+
| `buffer_geometries` | Expand/shrink existing geometries by a distance |
|
|
49
|
+
| `cluster_by_distance` | Group nearby points into clusters by buffer distance |
|
|
50
|
+
| `convert_coordinates` | Convert between Chinese coordinate systems (WGS84/GCJ02/BD09) |
|
|
51
|
+
| `match_spatial_layer` | Spatial join: match points to a polygon layer file |
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install tablegis-mcp
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or use with `uvx` (no install needed):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uvx tablegis-mcp
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Configure
|
|
66
|
+
|
|
67
|
+
### Claude Desktop
|
|
68
|
+
|
|
69
|
+
Add to your `claude_desktop_config.json`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"tablegis": {
|
|
75
|
+
"command": "uvx",
|
|
76
|
+
"args": ["tablegis-mcp"]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Or if installed via pip:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"tablegis": {
|
|
88
|
+
"command": "python",
|
|
89
|
+
"args": ["-m", "tablegis_mcp.server"]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Cursor / Other MCP Clients
|
|
96
|
+
|
|
97
|
+
Use the same command configuration. The server communicates via stdio transport.
|
|
98
|
+
|
|
99
|
+
## Usage Examples
|
|
100
|
+
|
|
101
|
+
Once configured, you can ask your AI assistant:
|
|
102
|
+
|
|
103
|
+
- "Find the 3 nearest neighbors for each point in this dataset"
|
|
104
|
+
- "Draw 3km delivery zones around these store locations"
|
|
105
|
+
- "Calculate the area of each polygon in square metres"
|
|
106
|
+
- "Group points within 500m into clusters"
|
|
107
|
+
- "Match these coordinates to a shapefile of administrative boundaries"
|
|
108
|
+
- "Convert these WGS84 coordinates to GCJ-02 (Amap/高德)"
|
|
109
|
+
|
|
110
|
+
Data is passed as CSV or JSON strings; geometry results are returned as WKT.
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
git clone https://github.com/Non-existent987/tablegis-mcp.git
|
|
116
|
+
cd tablegis-mcp
|
|
117
|
+
pip install -e ".[dev]"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# TableGIS MCP Server
|
|
2
|
+
|
|
3
|
+
Geospatial data processing tools for AI assistants via the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/).
|
|
4
|
+
|
|
5
|
+
Wraps [tablegis](https://github.com/Non-existent987/tablegis) functions as MCP tools, enabling AI clients (Claude Desktop, Cursor, etc.) to perform spatial analysis through natural language.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
| `nearest_neighbor_one_table` | Find nearest n neighbors within a single point dataset |
|
|
12
|
+
| `nearest_neighbor_two_tables` | Find nearest n points from dataset B for each point in dataset A |
|
|
13
|
+
| `create_buffer` | Create circular or ring buffers around points (metres) |
|
|
14
|
+
| `create_polygon` | Create regular or star polygons around points |
|
|
15
|
+
| `create_sector` | Create sector (wedge) polygons for directional coverage |
|
|
16
|
+
| `points_to_geodataframe` | Convert lon/lat columns to Point geometries |
|
|
17
|
+
| `calculate_area` | Calculate polygon areas in square metres |
|
|
18
|
+
| `buffer_geometries` | Expand/shrink existing geometries by a distance |
|
|
19
|
+
| `cluster_by_distance` | Group nearby points into clusters by buffer distance |
|
|
20
|
+
| `convert_coordinates` | Convert between Chinese coordinate systems (WGS84/GCJ02/BD09) |
|
|
21
|
+
| `match_spatial_layer` | Spatial join: match points to a polygon layer file |
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install tablegis-mcp
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or use with `uvx` (no install needed):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uvx tablegis-mcp
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Configure
|
|
36
|
+
|
|
37
|
+
### Claude Desktop
|
|
38
|
+
|
|
39
|
+
Add to your `claude_desktop_config.json`:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"mcpServers": {
|
|
44
|
+
"tablegis": {
|
|
45
|
+
"command": "uvx",
|
|
46
|
+
"args": ["tablegis-mcp"]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or if installed via pip:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"tablegis": {
|
|
58
|
+
"command": "python",
|
|
59
|
+
"args": ["-m", "tablegis_mcp.server"]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Cursor / Other MCP Clients
|
|
66
|
+
|
|
67
|
+
Use the same command configuration. The server communicates via stdio transport.
|
|
68
|
+
|
|
69
|
+
## Usage Examples
|
|
70
|
+
|
|
71
|
+
Once configured, you can ask your AI assistant:
|
|
72
|
+
|
|
73
|
+
- "Find the 3 nearest neighbors for each point in this dataset"
|
|
74
|
+
- "Draw 3km delivery zones around these store locations"
|
|
75
|
+
- "Calculate the area of each polygon in square metres"
|
|
76
|
+
- "Group points within 500m into clusters"
|
|
77
|
+
- "Match these coordinates to a shapefile of administrative boundaries"
|
|
78
|
+
- "Convert these WGS84 coordinates to GCJ-02 (Amap/高德)"
|
|
79
|
+
|
|
80
|
+
Data is passed as CSV or JSON strings; geometry results are returned as WKT.
|
|
81
|
+
|
|
82
|
+
## Development
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git clone https://github.com/Non-existent987/tablegis-mcp.git
|
|
86
|
+
cd tablegis-mcp
|
|
87
|
+
pip install -e ".[dev]"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tablegis-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "MCP Server for TableGIS - Geospatial data processing tools for AI assistants"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
authors = [{ name = "Non-existent987", email = "jiaqi0425_000@163.com" }]
|
|
12
|
+
keywords = [
|
|
13
|
+
"mcp", "gis", "geospatial", "tablegis", "claude", "ai",
|
|
14
|
+
"nearest-neighbor", "buffer", "spatial-analysis"
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"Topic :: Scientific/Engineering :: GIS",
|
|
21
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
]
|
|
28
|
+
requires-python = ">=3.10"
|
|
29
|
+
dependencies = [
|
|
30
|
+
"mcp[cli]>=1.0.0",
|
|
31
|
+
"tablegis>=0.0.14",
|
|
32
|
+
"pandas",
|
|
33
|
+
"geopandas",
|
|
34
|
+
"shapely",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
tablegis-mcp = "tablegis_mcp.server:main"
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
"Homepage" = "https://github.com/Non-existent987/tablegis-mcp"
|
|
42
|
+
"Bug Tracker" = "https://github.com/Non-existent987/tablegis-mcp/issues"
|
|
43
|
+
"Repository" = "https://github.com/Non-existent987/tablegis-mcp.git"
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.packages.find]
|
|
46
|
+
where = ["src"]
|
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
"""TableGIS MCP Server.
|
|
2
|
+
|
|
3
|
+
Exposes tablegis geospatial processing functions as MCP tools so that AI
|
|
4
|
+
assistants (Claude, ChatGPT, etc.) can perform spatial analysis through
|
|
5
|
+
natural language.
|
|
6
|
+
|
|
7
|
+
Data is passed as CSV/JSON strings and returned as JSON. Geometry columns
|
|
8
|
+
are serialised as WKT so they remain portable across clients.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import io
|
|
14
|
+
import json
|
|
15
|
+
import warnings
|
|
16
|
+
from typing import Any
|
|
17
|
+
|
|
18
|
+
import geopandas as gpd
|
|
19
|
+
import numpy as np
|
|
20
|
+
import pandas as pd
|
|
21
|
+
import tablegis as tg
|
|
22
|
+
from mcp.server.fastmcp import FastMCP
|
|
23
|
+
from shapely import wkt as shapely_wkt
|
|
24
|
+
|
|
25
|
+
mcp = FastMCP("tablegis", instructions=(
|
|
26
|
+
"TableGIS MCP Server – geospatial data processing tools.\n"
|
|
27
|
+
"All tools accept tabular data as a CSV or JSON string and return results "
|
|
28
|
+
"as JSON. Geometry columns are returned as WKT strings.\n"
|
|
29
|
+
"Distances are in metres; coordinates default to WGS-84 (EPSG:4326)."
|
|
30
|
+
))
|
|
31
|
+
|
|
32
|
+
# ---------------------------------------------------------------------------
|
|
33
|
+
# Helpers
|
|
34
|
+
# ---------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
def _to_python_native(val: Any) -> Any:
|
|
37
|
+
"""Convert numpy/shapely types to JSON-serializable Python natives."""
|
|
38
|
+
if val is None or pd.isna(val):
|
|
39
|
+
return None
|
|
40
|
+
if hasattr(val, "wkt"):
|
|
41
|
+
return val.wkt
|
|
42
|
+
if isinstance(val, (np.integer,)):
|
|
43
|
+
return int(val)
|
|
44
|
+
if isinstance(val, (np.floating,)):
|
|
45
|
+
return float(val)
|
|
46
|
+
if isinstance(val, np.ndarray):
|
|
47
|
+
return val.tolist()
|
|
48
|
+
return val
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _parse_dataframe(data: str) -> pd.DataFrame:
|
|
52
|
+
"""Parse a CSV or JSON string into a DataFrame."""
|
|
53
|
+
data = data.strip()
|
|
54
|
+
if data.startswith("[") or data.startswith("{"):
|
|
55
|
+
return pd.read_json(io.StringIO(data))
|
|
56
|
+
return pd.read_csv(io.StringIO(data))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _serialize_result(result: pd.DataFrame | gpd.GeoDataFrame) -> str:
|
|
60
|
+
"""Serialize a DataFrame / GeoDataFrame to a JSON string.
|
|
61
|
+
|
|
62
|
+
Geometry columns are converted to WKT; all other columns are kept as-is.
|
|
63
|
+
"""
|
|
64
|
+
if isinstance(result, gpd.GeoDataFrame):
|
|
65
|
+
result = result.copy()
|
|
66
|
+
# Convert all geometry columns to WKT strings, then treat as plain DataFrame
|
|
67
|
+
geom_cols = [col for col in result.columns
|
|
68
|
+
if isinstance(result[col].dtype, gpd.array.GeometryDtype)]
|
|
69
|
+
with warnings.catch_warnings():
|
|
70
|
+
warnings.simplefilter("ignore", UserWarning)
|
|
71
|
+
for col in geom_cols:
|
|
72
|
+
result[col] = result[col].apply(
|
|
73
|
+
lambda g: g.wkt if g is not None and hasattr(g, "wkt") else None
|
|
74
|
+
)
|
|
75
|
+
result = pd.DataFrame(result)
|
|
76
|
+
# Convert non-serializable types (numpy ints/floats) to native Python types
|
|
77
|
+
result = result.copy()
|
|
78
|
+
for col in result.columns:
|
|
79
|
+
result[col] = result[col].apply(_to_python_native)
|
|
80
|
+
return result.to_json(orient="records", force_ascii=False)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _gdf_from_json_with_geometry(data: str, geometry_col: str = "geometry",
|
|
84
|
+
crs: str = "EPSG:4326") -> gpd.GeoDataFrame:
|
|
85
|
+
"""Parse JSON that contains a WKT geometry column into a GeoDataFrame."""
|
|
86
|
+
df = pd.read_json(io.StringIO(data.strip()))
|
|
87
|
+
if geometry_col in df.columns:
|
|
88
|
+
df[geometry_col] = df[geometry_col].apply(
|
|
89
|
+
lambda w: shapely_wkt.loads(w) if pd.notna(w) else None
|
|
90
|
+
)
|
|
91
|
+
return gpd.GeoDataFrame(df, geometry=geometry_col, crs=crs)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# ===========================================================================
|
|
95
|
+
# MCP Tools
|
|
96
|
+
# ===========================================================================
|
|
97
|
+
|
|
98
|
+
@mcp.tool()
|
|
99
|
+
def nearest_neighbor_one_table(
|
|
100
|
+
data: str,
|
|
101
|
+
lon: str = "lon",
|
|
102
|
+
lat: str = "lat",
|
|
103
|
+
idname: str = "id",
|
|
104
|
+
n: int = 1,
|
|
105
|
+
include_self: bool = False,
|
|
106
|
+
) -> str:
|
|
107
|
+
"""Find the nearest n neighbors for each point in a dataset.
|
|
108
|
+
|
|
109
|
+
Given a table of points with longitude/latitude columns, computes the
|
|
110
|
+
nearest n neighbors for every row using a KD-tree. Returns the original
|
|
111
|
+
columns plus nearest-neighbor ids, coordinates and distances (metres).
|
|
112
|
+
|
|
113
|
+
Parameters
|
|
114
|
+
----------
|
|
115
|
+
data : str
|
|
116
|
+
Input table as CSV or JSON string. Must contain the columns
|
|
117
|
+
referenced by lon, lat and idname.
|
|
118
|
+
lon : str
|
|
119
|
+
Longitude column name (default "lon").
|
|
120
|
+
lat : str
|
|
121
|
+
Latitude column name (default "lat").
|
|
122
|
+
idname : str
|
|
123
|
+
Identifier column name (default "id").
|
|
124
|
+
n : int
|
|
125
|
+
Number of nearest neighbors to find (default 1).
|
|
126
|
+
include_self : bool
|
|
127
|
+
Whether to include the point itself among neighbors (default False).
|
|
128
|
+
"""
|
|
129
|
+
df = _parse_dataframe(data)
|
|
130
|
+
result = tg.min_distance_onetable(df, lon=lon, lat=lat, idname=idname,
|
|
131
|
+
n=n, include_self=include_self)
|
|
132
|
+
return _serialize_result(result)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@mcp.tool()
|
|
136
|
+
def nearest_neighbor_two_tables(
|
|
137
|
+
data1: str,
|
|
138
|
+
data2: str,
|
|
139
|
+
lon1: str = "lon1",
|
|
140
|
+
lat1: str = "lat1",
|
|
141
|
+
lon2: str = "lon2",
|
|
142
|
+
lat2: str = "lat2",
|
|
143
|
+
df2_id: str = "id",
|
|
144
|
+
n: int = 1,
|
|
145
|
+
) -> str:
|
|
146
|
+
"""Compute distances from each point in data1 to the nearest n points in data2.
|
|
147
|
+
|
|
148
|
+
Uses a KD-tree for efficient nearest-neighbor searches. Both datasets
|
|
149
|
+
should use WGS-84 (EPSG:4326) coordinates. Distances are in metres.
|
|
150
|
+
|
|
151
|
+
Parameters
|
|
152
|
+
----------
|
|
153
|
+
data1 : str
|
|
154
|
+
Source table (CSV or JSON) containing query points.
|
|
155
|
+
data2 : str
|
|
156
|
+
Target table (CSV or JSON) containing reference points.
|
|
157
|
+
lon1, lat1 : str
|
|
158
|
+
Longitude/latitude column names in data1 (default "lon1"/"lat1").
|
|
159
|
+
lon2, lat2 : str
|
|
160
|
+
Longitude/latitude column names in data2 (default "lon2"/"lat2").
|
|
161
|
+
df2_id : str
|
|
162
|
+
Identifier column in data2 (default "id").
|
|
163
|
+
n : int
|
|
164
|
+
Number of nearest neighbors to find (default 1).
|
|
165
|
+
"""
|
|
166
|
+
df1 = _parse_dataframe(data1)
|
|
167
|
+
df2 = _parse_dataframe(data2)
|
|
168
|
+
result = tg.min_distance_twotable(df1, df2, lon1=lon1, lat1=lat1,
|
|
169
|
+
lon2=lon2, lat2=lat2, df2_id=df2_id, n=n)
|
|
170
|
+
return _serialize_result(result)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
@mcp.tool()
|
|
174
|
+
def create_buffer(
|
|
175
|
+
data: str,
|
|
176
|
+
lon: str = "lon",
|
|
177
|
+
lat: str = "lat",
|
|
178
|
+
dis: float | str = 1000,
|
|
179
|
+
min_distance: float | str | None = None,
|
|
180
|
+
geometry: str = "geometry",
|
|
181
|
+
) -> str:
|
|
182
|
+
"""Create accurate buffers in metres around points.
|
|
183
|
+
|
|
184
|
+
Projects to an appropriate UTM zone for metre-based accuracy, then
|
|
185
|
+
converts back to WGS-84. Supports ring buffers (donut shape) when
|
|
186
|
+
min_distance is provided.
|
|
187
|
+
|
|
188
|
+
Parameters
|
|
189
|
+
----------
|
|
190
|
+
data : str
|
|
191
|
+
Input table (CSV or JSON) with lon/lat columns.
|
|
192
|
+
lon, lat : str
|
|
193
|
+
Longitude/latitude column names (default "lon"/"lat").
|
|
194
|
+
dis : float or str
|
|
195
|
+
Outer buffer distance in metres. If a string, treated as a column
|
|
196
|
+
name containing per-row distances (default 1000).
|
|
197
|
+
min_distance : float or str, optional
|
|
198
|
+
Inner radius for ring buffers in metres. If None, creates a filled
|
|
199
|
+
circle.
|
|
200
|
+
geometry : str
|
|
201
|
+
Name for the output geometry column (default "geometry").
|
|
202
|
+
"""
|
|
203
|
+
df = _parse_dataframe(data)
|
|
204
|
+
result = tg.add_buffer(df, lon=lon, lat=lat, dis=dis,
|
|
205
|
+
min_distance=min_distance, geometry=geometry)
|
|
206
|
+
return _serialize_result(result)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
@mcp.tool()
|
|
210
|
+
def create_polygon(
|
|
211
|
+
data: str,
|
|
212
|
+
lon: str = "lon",
|
|
213
|
+
lat: str = "lat",
|
|
214
|
+
num_sides: int = 4,
|
|
215
|
+
radius: float | None = None,
|
|
216
|
+
side_length: float | None = None,
|
|
217
|
+
interior_angle: float | None = None,
|
|
218
|
+
rotation: float = 0.0,
|
|
219
|
+
geometry: str = "geometry",
|
|
220
|
+
) -> str:
|
|
221
|
+
"""Create regular polygons (or star polygons) around points.
|
|
222
|
+
|
|
223
|
+
Projects to UTM for metre-based accuracy, outputs WGS-84 WKT.
|
|
224
|
+
|
|
225
|
+
Parameters
|
|
226
|
+
----------
|
|
227
|
+
data : str
|
|
228
|
+
Input table (CSV or JSON) with lon/lat columns.
|
|
229
|
+
lon, lat : str
|
|
230
|
+
Longitude/latitude column names (default "lon"/"lat").
|
|
231
|
+
num_sides : int
|
|
232
|
+
Number of polygon sides, >= 3 (default 4).
|
|
233
|
+
radius : float, optional
|
|
234
|
+
Outer radius in metres. Either radius or side_length must be given.
|
|
235
|
+
side_length : float, optional
|
|
236
|
+
Side length in metres. If given (and radius is None), radius is
|
|
237
|
+
computed automatically.
|
|
238
|
+
interior_angle : float, optional
|
|
239
|
+
Interior angle in degrees for star/concave polygons.
|
|
240
|
+
rotation : float
|
|
241
|
+
Additional rotation in degrees (default 0).
|
|
242
|
+
geometry : str
|
|
243
|
+
Output geometry column name (default "geometry").
|
|
244
|
+
"""
|
|
245
|
+
df = _parse_dataframe(data)
|
|
246
|
+
result = tg.add_polygon(df, lon=lon, lat=lat, num_sides=num_sides,
|
|
247
|
+
radius=radius, side_length=side_length,
|
|
248
|
+
interior_angle=interior_angle, rotation=rotation,
|
|
249
|
+
geometry=geometry)
|
|
250
|
+
return _serialize_result(result)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
@mcp.tool()
|
|
254
|
+
def create_sector(
|
|
255
|
+
data: str,
|
|
256
|
+
lon: str = "lon",
|
|
257
|
+
lat: str = "lat",
|
|
258
|
+
azimuth: float | str = 0,
|
|
259
|
+
distance: float | str = 1000,
|
|
260
|
+
angle: float | str = 60,
|
|
261
|
+
difference_distance: float | str | None = None,
|
|
262
|
+
geometry: str = "geometry",
|
|
263
|
+
) -> str:
|
|
264
|
+
"""Create sector (wedge) polygons around points.
|
|
265
|
+
|
|
266
|
+
Useful for modelling directional coverage such as cell-tower sectors or
|
|
267
|
+
radar beams. Projects to UTM for metre accuracy, outputs WGS-84 WKT.
|
|
268
|
+
|
|
269
|
+
Parameters
|
|
270
|
+
----------
|
|
271
|
+
data : str
|
|
272
|
+
Input table (CSV or JSON) with lon/lat columns.
|
|
273
|
+
lon, lat : str
|
|
274
|
+
Longitude/latitude column names (default "lon"/"lat").
|
|
275
|
+
azimuth : float or str
|
|
276
|
+
Bearing in degrees (0 = north, clockwise). String = column name.
|
|
277
|
+
distance : float or str
|
|
278
|
+
Outer radius in metres. String = column name.
|
|
279
|
+
angle : float or str
|
|
280
|
+
Total sector angle in degrees. String = column name.
|
|
281
|
+
difference_distance : float or str, optional
|
|
282
|
+
Inner radius for ring-sector in metres. String = column name.
|
|
283
|
+
geometry : str
|
|
284
|
+
Output geometry column name (default "geometry").
|
|
285
|
+
"""
|
|
286
|
+
df = _parse_dataframe(data)
|
|
287
|
+
result = tg.add_sectors(df, lon=lon, lat=lat, azimuth=azimuth,
|
|
288
|
+
distance=distance, angle=angle,
|
|
289
|
+
difference_distance=difference_distance,
|
|
290
|
+
geometry=geometry)
|
|
291
|
+
return _serialize_result(result)
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
@mcp.tool()
|
|
295
|
+
def points_to_geodataframe(
|
|
296
|
+
data: str,
|
|
297
|
+
lon: str = "lon",
|
|
298
|
+
lat: str = "lat",
|
|
299
|
+
geometry: str = "geometry",
|
|
300
|
+
crs: str = "epsg:4326",
|
|
301
|
+
) -> str:
|
|
302
|
+
"""Convert a table with lon/lat columns to a GeoDataFrame of Points.
|
|
303
|
+
|
|
304
|
+
Parameters
|
|
305
|
+
----------
|
|
306
|
+
data : str
|
|
307
|
+
Input table (CSV or JSON) with lon/lat columns.
|
|
308
|
+
lon, lat : str
|
|
309
|
+
Longitude/latitude column names (default "lon"/"lat").
|
|
310
|
+
geometry : str
|
|
311
|
+
Name for the output geometry column (default "geometry").
|
|
312
|
+
crs : str
|
|
313
|
+
Coordinate reference system (default "epsg:4326").
|
|
314
|
+
"""
|
|
315
|
+
df = _parse_dataframe(data)
|
|
316
|
+
result = tg.add_points(df, lon=lon, lat=lat, geometry=geometry, crs=crs)
|
|
317
|
+
return _serialize_result(result)
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
@mcp.tool()
|
|
321
|
+
def calculate_area(
|
|
322
|
+
data: str,
|
|
323
|
+
geometry_col: str = "geometry",
|
|
324
|
+
column: str = "add_area",
|
|
325
|
+
crs_epsg: int | None = None,
|
|
326
|
+
area_type: str = "int",
|
|
327
|
+
) -> str:
|
|
328
|
+
"""Calculate the area of polygon geometries in square metres.
|
|
329
|
+
|
|
330
|
+
Temporarily projects to an appropriate UTM zone for accurate area
|
|
331
|
+
computation, then converts back to the original CRS.
|
|
332
|
+
|
|
333
|
+
Parameters
|
|
334
|
+
----------
|
|
335
|
+
data : str
|
|
336
|
+
Input GeoJSON or JSON string with a WKT geometry column.
|
|
337
|
+
geometry_col : str
|
|
338
|
+
Name of the geometry column (default "geometry").
|
|
339
|
+
column : str
|
|
340
|
+
Name for the output area column (default "add_area").
|
|
341
|
+
crs_epsg : int, optional
|
|
342
|
+
EPSG code for the projection to use. If None, UTM is auto-selected.
|
|
343
|
+
area_type : str
|
|
344
|
+
"int" or "float" for the output data type (default "int").
|
|
345
|
+
"""
|
|
346
|
+
gdf = _gdf_from_json_with_geometry(data, geometry_col=geometry_col)
|
|
347
|
+
result = tg.add_area(gdf, column=column, crs_epsg=crs_epsg,
|
|
348
|
+
area_type=area_type)
|
|
349
|
+
return _serialize_result(result)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
@mcp.tool()
|
|
353
|
+
def buffer_geometries(
|
|
354
|
+
data: str,
|
|
355
|
+
distance: float,
|
|
356
|
+
geometry_col: str = "geometry",
|
|
357
|
+
) -> str:
|
|
358
|
+
"""Expand or shrink existing geometries by a buffer distance in metres.
|
|
359
|
+
|
|
360
|
+
Takes a GeoDataFrame with existing polygon/point geometries, projects to
|
|
361
|
+
UTM, applies the buffer, and converts back to WGS-84.
|
|
362
|
+
|
|
363
|
+
Parameters
|
|
364
|
+
----------
|
|
365
|
+
data : str
|
|
366
|
+
Input GeoJSON or JSON string with a WKT geometry column.
|
|
367
|
+
distance : float
|
|
368
|
+
Buffer distance in metres. Positive = expand, negative = shrink.
|
|
369
|
+
geometry_col : str
|
|
370
|
+
Name of the geometry column (default "geometry").
|
|
371
|
+
"""
|
|
372
|
+
gdf = _gdf_from_json_with_geometry(data, geometry_col=geometry_col)
|
|
373
|
+
result = tg.buffer(gdf, distance=distance, geometry_col=geometry_col)
|
|
374
|
+
return _serialize_result(result)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
@mcp.tool()
|
|
378
|
+
def cluster_by_distance(
|
|
379
|
+
data: str,
|
|
380
|
+
lon: str = "lon",
|
|
381
|
+
lat: str = "lat",
|
|
382
|
+
distance: float = 50,
|
|
383
|
+
columns_name: str = "clusterid",
|
|
384
|
+
id_label_prefix: str = "cluster_",
|
|
385
|
+
geom: bool = False,
|
|
386
|
+
) -> str:
|
|
387
|
+
"""Group points into clusters by buffer distance and assign cluster IDs.
|
|
388
|
+
|
|
389
|
+
Creates buffers around points, dissolves overlapping buffers into cluster
|
|
390
|
+
polygons, and assigns each point a cluster ID.
|
|
391
|
+
|
|
392
|
+
Parameters
|
|
393
|
+
----------
|
|
394
|
+
data : str
|
|
395
|
+
Input table (CSV or JSON) with lon/lat columns.
|
|
396
|
+
lon, lat : str
|
|
397
|
+
Longitude/latitude column names (default "lon"/"lat").
|
|
398
|
+
distance : float
|
|
399
|
+
Buffer distance in metres for grouping (default 50).
|
|
400
|
+
columns_name : str
|
|
401
|
+
Name of the output cluster ID column (default "clusterid").
|
|
402
|
+
id_label_prefix : str
|
|
403
|
+
Prefix for cluster labels, e.g. "cluster_0" (default "cluster_").
|
|
404
|
+
geom : bool
|
|
405
|
+
If True, include cluster polygon geometry in output (default False).
|
|
406
|
+
"""
|
|
407
|
+
df = _parse_dataframe(data)
|
|
408
|
+
result = tg.add_buffer_groupbyid(df, lon=lon, lat=lat, distance=distance,
|
|
409
|
+
columns_name=columns_name,
|
|
410
|
+
id_label_prefix=id_label_prefix,
|
|
411
|
+
geom=geom)
|
|
412
|
+
return _serialize_result(result)
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
@mcp.tool()
|
|
416
|
+
def convert_coordinates(
|
|
417
|
+
data: str,
|
|
418
|
+
lon: str = "lon",
|
|
419
|
+
lat: str = "lat",
|
|
420
|
+
from_crs: str = "wgs84",
|
|
421
|
+
to_crs: str = "gcj02",
|
|
422
|
+
) -> str:
|
|
423
|
+
"""Convert coordinates between Chinese coordinate systems.
|
|
424
|
+
|
|
425
|
+
Supports: wgs84 (EPSG:4326), gcj02 (Mars/高德), bd09 (百度),
|
|
426
|
+
web_mercator (EPSG:3857), cgcs2000 (EPSG:4490).
|
|
427
|
+
|
|
428
|
+
Parameters
|
|
429
|
+
----------
|
|
430
|
+
data : str
|
|
431
|
+
Input table (CSV or JSON) with lon/lat columns.
|
|
432
|
+
lon, lat : str
|
|
433
|
+
Longitude/latitude column names (default "lon"/"lat").
|
|
434
|
+
from_crs : str
|
|
435
|
+
Source CRS name: "wgs84", "gcj02", "bd09", "web_mercator", "cgcs2000"
|
|
436
|
+
(default "wgs84").
|
|
437
|
+
to_crs : str
|
|
438
|
+
Target CRS name, same options as from_crs (default "gcj02").
|
|
439
|
+
"""
|
|
440
|
+
df = _parse_dataframe(data)
|
|
441
|
+
result = tg.to_lonlat(df, lon=lon, lat=lat, from_crs=from_crs,
|
|
442
|
+
to_crs=to_crs)
|
|
443
|
+
return _serialize_result(result)
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
@mcp.tool()
|
|
447
|
+
def match_spatial_layer(
|
|
448
|
+
data: str,
|
|
449
|
+
layer_path: str,
|
|
450
|
+
lon: str = "lon",
|
|
451
|
+
lat: str = "lat",
|
|
452
|
+
columns: str | None = None,
|
|
453
|
+
default_value: str | float | None = None,
|
|
454
|
+
match_method: str = "one",
|
|
455
|
+
sep: str = ",",
|
|
456
|
+
predicate: str = "intersects",
|
|
457
|
+
) -> str:
|
|
458
|
+
"""Match points to a spatial layer (shapefile/GeoJSON) and add attributes.
|
|
459
|
+
|
|
460
|
+
Performs a spatial join between the input points and a polygon layer,
|
|
461
|
+
adding columns from the layer to the point data.
|
|
462
|
+
|
|
463
|
+
Parameters
|
|
464
|
+
----------
|
|
465
|
+
data : str
|
|
466
|
+
Input table (CSV or JSON) with lon/lat columns.
|
|
467
|
+
layer_path : str
|
|
468
|
+
Path to a spatial file (shp, geojson, gpkg, etc.).
|
|
469
|
+
lon, lat : str
|
|
470
|
+
Longitude/latitude column names (default "lon"/"lat").
|
|
471
|
+
columns : str, optional
|
|
472
|
+
Comma-separated column names from the layer to add. If None, adds all.
|
|
473
|
+
default_value : str or float, optional
|
|
474
|
+
Fill value for points with no match.
|
|
475
|
+
match_method : str
|
|
476
|
+
"one" = first match, "multi_cell" = join values with separator,
|
|
477
|
+
"multi_row" = expand rows (default "one").
|
|
478
|
+
sep : str
|
|
479
|
+
Separator for multi_cell mode (default ",").
|
|
480
|
+
predicate : str
|
|
481
|
+
Spatial predicate: "intersects", "within", "contains", etc.
|
|
482
|
+
(default "intersects").
|
|
483
|
+
"""
|
|
484
|
+
df = _parse_dataframe(data)
|
|
485
|
+
cols = [c.strip() for c in columns.split(",")] if columns else None
|
|
486
|
+
result = tg.match_layer(df, layer=layer_path, lon=lon, lat=lat,
|
|
487
|
+
columns=cols, default_value=default_value,
|
|
488
|
+
match_method=match_method, sep=sep,
|
|
489
|
+
predicate=predicate)
|
|
490
|
+
return _serialize_result(result)
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
# ===========================================================================
|
|
494
|
+
# Entry point
|
|
495
|
+
# ===========================================================================
|
|
496
|
+
|
|
497
|
+
def main():
|
|
498
|
+
"""Run the TableGIS MCP server."""
|
|
499
|
+
mcp.run()
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
if __name__ == "__main__":
|
|
503
|
+
main()
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tablegis-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP Server for TableGIS - Geospatial data processing tools for AI assistants
|
|
5
|
+
Author-email: Non-existent987 <jiaqi0425_000@163.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Non-existent987/tablegis-mcp
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/Non-existent987/tablegis-mcp/issues
|
|
9
|
+
Project-URL: Repository, https://github.com/Non-existent987/tablegis-mcp.git
|
|
10
|
+
Keywords: mcp,gis,geospatial,tablegis,claude,ai,nearest-neighbor,buffer,spatial-analysis
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: mcp[cli]>=1.0.0
|
|
25
|
+
Requires-Dist: tablegis>=0.0.14
|
|
26
|
+
Requires-Dist: pandas
|
|
27
|
+
Requires-Dist: geopandas
|
|
28
|
+
Requires-Dist: shapely
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# TableGIS MCP Server
|
|
32
|
+
|
|
33
|
+
Geospatial data processing tools for AI assistants via the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/).
|
|
34
|
+
|
|
35
|
+
Wraps [tablegis](https://github.com/Non-existent987/tablegis) functions as MCP tools, enabling AI clients (Claude Desktop, Cursor, etc.) to perform spatial analysis through natural language.
|
|
36
|
+
|
|
37
|
+
## Tools
|
|
38
|
+
|
|
39
|
+
| Tool | Description |
|
|
40
|
+
|------|-------------|
|
|
41
|
+
| `nearest_neighbor_one_table` | Find nearest n neighbors within a single point dataset |
|
|
42
|
+
| `nearest_neighbor_two_tables` | Find nearest n points from dataset B for each point in dataset A |
|
|
43
|
+
| `create_buffer` | Create circular or ring buffers around points (metres) |
|
|
44
|
+
| `create_polygon` | Create regular or star polygons around points |
|
|
45
|
+
| `create_sector` | Create sector (wedge) polygons for directional coverage |
|
|
46
|
+
| `points_to_geodataframe` | Convert lon/lat columns to Point geometries |
|
|
47
|
+
| `calculate_area` | Calculate polygon areas in square metres |
|
|
48
|
+
| `buffer_geometries` | Expand/shrink existing geometries by a distance |
|
|
49
|
+
| `cluster_by_distance` | Group nearby points into clusters by buffer distance |
|
|
50
|
+
| `convert_coordinates` | Convert between Chinese coordinate systems (WGS84/GCJ02/BD09) |
|
|
51
|
+
| `match_spatial_layer` | Spatial join: match points to a polygon layer file |
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install tablegis-mcp
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or use with `uvx` (no install needed):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uvx tablegis-mcp
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Configure
|
|
66
|
+
|
|
67
|
+
### Claude Desktop
|
|
68
|
+
|
|
69
|
+
Add to your `claude_desktop_config.json`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"tablegis": {
|
|
75
|
+
"command": "uvx",
|
|
76
|
+
"args": ["tablegis-mcp"]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Or if installed via pip:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"tablegis": {
|
|
88
|
+
"command": "python",
|
|
89
|
+
"args": ["-m", "tablegis_mcp.server"]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Cursor / Other MCP Clients
|
|
96
|
+
|
|
97
|
+
Use the same command configuration. The server communicates via stdio transport.
|
|
98
|
+
|
|
99
|
+
## Usage Examples
|
|
100
|
+
|
|
101
|
+
Once configured, you can ask your AI assistant:
|
|
102
|
+
|
|
103
|
+
- "Find the 3 nearest neighbors for each point in this dataset"
|
|
104
|
+
- "Draw 3km delivery zones around these store locations"
|
|
105
|
+
- "Calculate the area of each polygon in square metres"
|
|
106
|
+
- "Group points within 500m into clusters"
|
|
107
|
+
- "Match these coordinates to a shapefile of administrative boundaries"
|
|
108
|
+
- "Convert these WGS84 coordinates to GCJ-02 (Amap/高德)"
|
|
109
|
+
|
|
110
|
+
Data is passed as CSV or JSON strings; geometry results are returned as WKT.
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
git clone https://github.com/Non-existent987/tablegis-mcp.git
|
|
116
|
+
cd tablegis-mcp
|
|
117
|
+
pip install -e ".[dev]"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/tablegis_mcp/__init__.py
|
|
5
|
+
src/tablegis_mcp/server.py
|
|
6
|
+
src/tablegis_mcp.egg-info/PKG-INFO
|
|
7
|
+
src/tablegis_mcp.egg-info/SOURCES.txt
|
|
8
|
+
src/tablegis_mcp.egg-info/dependency_links.txt
|
|
9
|
+
src/tablegis_mcp.egg-info/entry_points.txt
|
|
10
|
+
src/tablegis_mcp.egg-info/requires.txt
|
|
11
|
+
src/tablegis_mcp.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tablegis_mcp
|