Skip to main content

Lightweight client for connecting to GIS MCP servers to perform geospatial operations

Project description

GIS MCP Client

Lightweight Python client that connects to remote GIS MCP servers via SSE (Server-Sent Events) to enable agentic AI operations on the cloud. Perform geospatial operations remotely without installing heavy GIS libraries.

Features

  • 🔹 Lightweight - No heavy GIS libraries required, just MCP client dependencies
  • 🔹 SSE Connection - Connects to remote GIS MCP servers via Server-Sent Events for real-time agentic AI operations
  • 🔹 Cloud-Based - Perform agentic AI operations on the cloud without local GIS dependencies
  • 🔹 HTTP & SSE Support - Connect via HTTP or Server-Sent Events
  • 🔹 Remote Storage - Upload/download files to/from remote server storage
  • 🔹 Authentication - Support for token-based and basic authentication
  • 🔹 Easy to Use - Simple API for calling remote GIS operations

Installation

pip install gis-mcp-client

Quick Start

Basic Usage

from gis_mcp_client import GISMCPClient

# Connect to a GIS MCP server
client = GISMCPClient("http://localhost:9010/mcp")

# List available tools
tools = client.list_tools()
print(f"Available tools: {[t['name'] for t in tools]}")

# Call a remote GIS operation
result = client.call_tool("buffer", {
    "geometry": "POINT(0 0)",
    "distance": 10
})
print(result)

With Authentication

# Token-based authentication
client = GISMCPClient(
    "http://remote-server:9010/mcp",
    credentials={"token": "your-api-token"}
)

# Username/password authentication
client = GISMCPClient(
    "http://remote-server:9010/mcp",
    credentials={"username": "user", "password": "pass"}
)

Remote Storage

from gis_mcp_client import RemoteStorage

# Connect to remote storage
storage = RemoteStorage("http://localhost:9010/storage")

# Upload a file
result = storage.upload("local_file.shp", "remote_file.shp")
print(result['message'])

# Download a file
result = storage.download("remote_file.shp", "downloaded_file.shp")
print(result['message'])

# List files
files = storage.list_files()
print(files['files'])

Context Manager

# Use as context manager for automatic cleanup
with GISMCPClient("http://localhost:9010/mcp") as client:
    result = client.call_tool("transform_coordinates", {
        "coordinates": [0, 0],
        "source_crs": "EPSG:4326",
        "target_crs": "EPSG:3857"
    })
    print(result)

API Reference

GISMCPClient

Main client for connecting to GIS MCP servers.

Methods

  • list_tools() - List all available tools
  • call_tool(name, arguments) - Call a remote tool
  • get_tool_info(name) - Get information about a specific tool
  • connect_sse() - Connect via Server-Sent Events

RemoteStorage

Client for managing remote storage.

Methods

  • upload(local_path, remote_path) - Upload a file
  • download(remote_path, local_path) - Download a file
  • list_files(remote_path) - List files in storage

Examples

See the examples directory for comprehensive examples including:

  • SSE connections with credentials
  • Remote storage upload/download
  • OpenAI integration
  • Complete workflows

Basic Example with Credentials

from gis_mcp_client import GISMCPClient

# Connect with authentication
client = GISMCPClient(
    "https://remote-gis-mcp.com/mcp",
    credentials={"token": "your-access-token"}
)

# List available tools
tools = client.list_tools()

# Call a remote GIS operation
result = client.call_tool("transform_coordinates", {
    "coordinates": [-74.0060, 40.7128],
    "source_crs": "EPSG:4326",
    "target_crs": "EPSG:32633"
})

Calculate Distance

from gis_mcp_client import GISMCPClient

client = GISMCPClient("http://localhost:9010/mcp")

result = client.call_tool("calculate_geodetic_distance", {
    "point1": [0, 0],
    "point2": [1, 1],
    "ellps": "WGS84"
})
print(f"Distance: {result['distance']} meters")

Transform Coordinates

result = client.call_tool("transform_coordinates", {
    "coordinates": [-122.4194, 37.7749],  # San Francisco
    "source_crs": "EPSG:4326",
    "target_crs": "EPSG:3857"
})
print(f"Transformed: {result['coordinates']}")

Create Buffer

result = client.call_tool("buffer", {
    "geometry": "POINT(0 0)",
    "distance": 1000,
    "resolution": 16
})
print(f"Buffered geometry: {result['geometry']}")

Requirements

  • Python 3.10+
  • mcp - MCP protocol client
  • requests - HTTP client
  • sseclient-py - Server-Sent Events support

License

MIT License - see LICENSE file for details.

Related Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gis_mcp_client-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gis_mcp_client-0.1.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file gis_mcp_client-0.1.0.tar.gz.

File metadata

  • Download URL: gis_mcp_client-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for gis_mcp_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1453d41ad1adb792798f525418969a9bfaf14bb2ade4170ce6fe15cfabaaf955
MD5 636fdf02fe0f292b77726d8d2d206050
BLAKE2b-256 48aa45e44e022f98621c999f2eb2b3c7c93674fdc5f2be22c446c926c5b399fc

See more details on using hashes here.

File details

Details for the file gis_mcp_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gis_mcp_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for gis_mcp_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 106baef55bbb8671afd41215d9508479d5ac4d435a93caa3219a1ddce78e9e7a
MD5 95c83b10d5c671c5d4ae42f9d643c23e
BLAKE2b-256 6b6f99e583f7095f9679aa4030ef4b828376d4b5ba67bc3ce836ef4373f892fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page