A Model Context Protocol (MCP) server for interacting with GeoNode APIs. This server provides comprehensive access to GeoNode functionality including resource management, user administration, data uploads/downloads, and permission management.
- List Resources: Browse and filter resources by type, status, categories, keywords, and more
- Resource Details: Get detailed information about specific resources and datasets
- Search: Full-text search across resource titles and abstracts
- Download: Generate download URLs for datasets and documents
- Upload: Upload datasets (Shapefiles, GeoTIFFs, CSV) and documents
- Delete: Remove resources from GeoNode
- Metadata Updates: Update dataset titles, abstracts, and licenses
- List Users: Browse users with pagination
- User Details: Get detailed user information
- Create Users: Add new users to the system
- View Permissions: Check current resource permissions
- Set Permissions: Configure user, group, and organization permissions for resources
- Authentication: Support for Basic Auth and Bearer tokens
- Upload Tracking: Monitor upload progress with execution status
- Linked Resources: Discover relationships between resources
- Filtering: Advanced filtering by resource type, publication status, featured status, categories, and more
- Install dependencies:
pip install mcp httpx pydantic- Run the server:
python main.py
# or
python cli.pyThe MCP GeoNode server is configured exclusively through environment variables or a .env file for security and simplicity.
Create a .env file in the project directory or set environment variables:
# Copy the example file
cp .env.example .env
# Edit with your GeoNode configuration
nano .envRequired Environment Variables:
GEONODE_BASE_URL- Base URL of the GeoNode instance
Optional Environment Variables:
GEONODE_USERNAME- Username for authenticationGEONODE_PASSWORD- Password for authenticationGEONODE_TOKEN- Bearer token for authentication (alternative to username/password)GEONODE_VERIFY_SSL- Verify SSL certificates (default: true)GEONODE_MAX_CONCURRENT_UPLOADS- Maximum concurrent upload requests handled by the server (default: 5)GEONODE_LOG_FILE- Persistent server log file path (default:./geonode-mcp.log)
Example .env file:
GEONODE_BASE_URL=https://demo.geonode.org
GEONODE_USERNAME=your_username
GEONODE_PASSWORD=your_password
GEONODE_VERIFY_SSL=trueThe server will automatically load configuration on startup. Use the get_configuration_status tool to check the current configuration.
Server logs are written to ./geonode-mcp.log by default, which is useful when the MCP host hides stderr. Set GEONODE_LOG_FILE to change the path.
For public GeoNode instances where you only need to read public data:
GEONODE_BASE_URL=https://demo.geonode.orgFor GeoNode instances requiring login:
GEONODE_BASE_URL=https://your-geonode.org
GEONODE_USERNAME=your_username
GEONODE_PASSWORD=your_passwordFor GeoNode instances supporting API tokens:
GEONODE_BASE_URL=https://your-geonode.org
GEONODE_TOKEN=your_api_token# List all resources
list_resources()
# Filter by resource type
list_resources(resource_type="dataset")
# Search with text query
list_resources(search="climate", page=1, page_size=10)
# Filter by multiple criteria
list_resources(
resource_type="dataset",
published=True,
featured=True,
category="environment"
)# Get basic resource information
get_resource_details(resource_id=123)
# Get detailed dataset information (includes additional metadata)
get_dataset_details(dataset_id=123)# Upload a Shapefile dataset
upload_dataset(
base_file_path="/path/to/data.shp",
title="My Dataset",
abstract="Description of the dataset"
)
# Upload a document
upload_document(
file_path="/path/to/document.pdf",
title="My Document",
abstract="Document description"
)
# Reference a remote document
upload_document(
doc_url="https://example.com/document.pdf",
title="Remote Document"
)# View current permissions
get_resource_permissions(resource_id=123)
# Set permissions for users and groups
set_resource_permissions(
resource_id=123,
users=[
{"id": 1, "permissions": "edit"},
{"id": 2, "permissions": "view"}
],
groups=[
{"id": 1, "permissions": "view"}
]
)# List users
list_users(page=1, page_size=20)
# Get user details
get_user_details(user_id=1)
# Create new user
create_user(
username="newuser",
password="secure_password",
email="user@example.com",
first_name="John",
last_name="Doe"
)# Update supported dataset fields
update_dataset_metadata(
dataset_id=123,
title="Updated Dataset Title",
abstract="Updated description",
license_id=7
)configure_geonode: Set up connection to GeoNode instance (overrides environment)get_configuration_status: Check current configuration status and source
list_resources: List and filter resourceslist_categories: List available categorieslist_tkeywords: List thesaurus taxonomy keywordsget_resource_details: Get basic resource informationget_dataset_details: Get detailed dataset informationsearch_resources: Search resources by text querydownload_resource: Get download URLsdelete_resource: Remove resourcesupdate_dataset_metadata: Update dataset title, abstract, and licenselist_linked_resources: Find linked resources
upload_dataset: Upload spatial datasetsupload_document: Upload or reference documentscheck_upload_status: Monitor upload progress
list_users: Browse usersget_user_details: Get user informationcreate_user: Add new users
get_resource_permissions: View permissionsset_resource_permissions: Configure permissions
This MCP server is designed to work with GeoNode 3.x and 4.x instances that provide the standard REST API v2. It supports:
- GeoNode 3.3+
- GeoNode 4.0+
- Custom GeoNode deployments with API v2
The server implements the following GeoNode API endpoints:
/api/v2/resources- Resource listing and filtering/api/v2/resources/{id}- Resource details and operations/api/v2/datasets/{id}- Dataset metadata updates via PATCH/api/v2/uploads/upload- Dataset uploads/api/v2/documents- Document operations/api/v2/users- User management/api/v2/executionrequest/{id}- Upload status tracking- Permission management endpoints
The server includes comprehensive error handling:
- HTTP status code validation
- Network error recovery
- Authentication failure detection
- Detailed error messages with context
- Graceful degradation for optional features
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
docker build -t mcp-geonode .docker run --rm \
-e GEONODE_BASE_URL=https://your-geonode.org \
-e GEONODE_USERNAME=your_username \
-e GEONODE_PASSWORD=your_password \
-p 8000:8000 \
mcp-geonode# Create your .env file first
docker run --rm --env-file .env -p 8000:8000 mcp-geonodedocker run --rm \
-e GEONODE_BASE_URL=https://demo.geonode.org \
-p 8000:8000 \
mcp-geonodeAll the same environment variables work in Docker:
GEONODE_BASE_URL(required)GEONODE_USERNAME(optional)GEONODE_PASSWORD(optional)GEONODE_TOKEN(optional)GEONODE_VERIFY_SSL(optional, default: true)
The container will automatically load your configuration and start the MCP server.
This project is licensed under the MIT License.
For issues and questions:
- Check the GeoNode API documentation: https://docs.geonode.org/en/master/devel/api/usage/index.html
- Review MCP documentation: https://github.com/modelcontextprotocol/python-sdk
- Open an issue in this repository