QGIS-MCP-Server

dkudom/QGIS-MCP-Server

3.1

If you are the rightful owner of QGIS-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The BABMA Maps - QGIS MCP Server Project provides GIS mapping data and analysis tools for the Bibiani-Anhwiaso-Bekwai Municipal Assembly in Ghana, along with a Model Context Protocol server for AI interaction with QGIS and shapefile data.

Tools
5
Resources
0
Prompts
0

BABMA Maps - QGIS MCP Server Project

🗺️ Overview

This project contains GIS mapping data and analysis tools for the Bibiani-Anhwiaso-Bekwai Municipal Assembly (BABMA) in Ghana, along with a powerful Model Context Protocol (MCP) server that enables AI assistants to interact with QGIS and shapefile data.

📊 Project Contents

🗂️ GIS Data

  • Population Maps: 2025 and 2029 population projections
  • Transportation Networks: Road systems and infrastructure
  • Administrative Boundaries: Municipal, regional, and national contexts
  • Development Maps: Existing development and situational analysis
  • Shapefiles: Comprehensive spatial data for BABMA region

🤖 MCP Server

A custom Model Context Protocol server (qgis_shapefile_mcp.py) that provides AI assistants with GIS capabilities:

  • 📖 Read and analyze shapefiles
  • 🛠️ Create new shapefiles with custom fields
  • 🔍 Query spatial features with filters
  • 📋 Extract detailed GIS metadata
  • 🎯 Integrate with QGIS projects

🚀 Quick Start

Prerequisites

  • Python 3.8+
  • pip package manager
  • QGIS (optional, falls back to GeoPandas)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/babma-maps-qgis-mcp.git
    cd babma-maps-qgis-mcp
    
  2. Install dependencies:

    pip install -r requirements.txt
    

    Or run the setup script (Windows):

    setup_mcp.bat
    
  3. Test the MCP server:

    python qgis_shapefile_mcp.py
    

🔧 Cursor AI Integration

To use this MCP server with Cursor AI:

  1. Configure Cursor AI (Settings → Features → MCP Servers):

    {
      "qgis-shapefile": {
        "command": "python",
        "args": ["qgis_shapefile_mcp.py"],
        "cwd": "/path/to/your/project",
        "env": {
          "PYTHONPATH": "/path/to/your/project"
        }
      }
    }
    
  2. Restart Cursor AI

  3. Test integration: Ask "Can you list the available MCP tools?"

📁 Directory Structure

BABMA MAPS/
├── qgis_shapefile_mcp.py           # MCP Server
├── requirements.txt                # Python dependencies  
├── mcp_server_config.json         # MCP configuration
├── setup_mcp.bat                  # Windows setup script
├── README_MCP_Setup.md            # Detailed setup guide
├── 
├── SHAPEFILES/                    # Spatial data
│   ├── BABMA/                     # Municipal boundaries
│   ├── BABMA Towns/               # Settlement data
│   ├── BABMA Road/                # Road networks
│   ├── Districts/                 # District boundaries
│   └── ...                       # Other spatial datasets
├── 
├── PICTURES/                      # Generated maps (JPG)
├── Layouts/                       # QGIS layout templates
└── Map/                          # QGIS project files

🛠️ Available Tools

The MCP server provides these tools for AI assistants:

ToolDescription
read_shapefileAnalyze shapefile structure and properties
create_shapefileCreate new shapefiles with custom schema
query_shapefileQuery features with attribute filters
get_shapefile_infoExtract detailed shapefile metadata
add_layer_to_qgisAdd layers to QGIS projects

💡 Example AI Interactions

Once configured, you can ask AI assistants:

  • "Analyze all shapefiles in the BABMA project"
  • "What's the coordinate system used in the road data?"
  • "Create a point shapefile for GPS coordinates with elevation data"
  • "Query the towns shapefile for settlements with population > 1000"
  • "What administrative levels are available in this dataset?"

🌍 About BABMA

Bibiani-Anhwiaso-Bekwai Municipal Assembly is located in the Western North Region of Ghana. This project contains comprehensive spatial analysis and mapping data for:

  • Population distribution and projections
  • Transportation infrastructure
  • Administrative boundaries
  • Development planning
  • Regional context mapping

📖 Documentation

  • - Detailed setup instructions
  • - Python dependencies
  • - MCP server config

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test the MCP server
  5. Submit a pull request

📄 License

This project is open source. Please respect data usage guidelines for the GIS datasets.

🔧 Troubleshooting

  • QGIS not found: The server works in fallback mode with GeoPandas
  • Import errors: Ensure all dependencies are installed
  • Path issues: Check working directory in MCP configuration
  • Permission errors: Verify read/write access to shapefile directories

📞 Support

For issues or questions:

  1. Check the
  2. Verify dependencies are installed
  3. Test the MCP server independently
  4. Check Cursor AI MCP server logs

🚀 Transform your GIS workflow with AI-powered spatial analysis! 🗺️