Skip to main content

MCP server providing 15 AI-optimized tools for GDScript code analysis via Godot's built-in LSP

Project description

GodotLens: AI-First Code Analysis for GDScript

GitHub Release npm PyPI License: MIT

An MCP server providing 15 semantic analysis tools for GDScript, powered by Godot's built-in Language Server.

Built for AI Agents

AI coding agents work with text files but lack semantic understanding of GDScript. When an agent uses grep to find usages of a function, it cannot distinguish a function call from a comment containing the same name, a signal declaration from a signal emission, or an overridden method from an unrelated function.

GodotLens bridges this gap by exposing Godot's built-in Language Server through the Model Context Protocol (MCP), giving AI agents compiler-accurate code intelligence for GDScript — go to definition, find references, diagnostics, rename, and more.

Example: Finding all usages of _on_player_hit:

Approach Result
grep "_on_player_hit" 12 matches including comments, strings, and similarly named functions
gdscript_references Exactly 4 call sites where _on_player_hit is invoked

Prerequisites

  • Godot 4.x editor must be running with your project open — Godot's LSP server starts automatically when the editor opens a project
  • Python 3.10+ (for pip install) or Node.js 16+ (for npx)

Quick Start

Option A: npx (recommended for MCP clients)

Add to your MCP configuration (e.g., .mcp.json for Claude Code):

{
  "mcpServers": {
    "godotlens": {
      "command": "npx",
      "args": ["-y", "godotlens-mcp"]
    }
  }
}

The npm package bundles the full server (~20 KB of Python). Zero external Python dependencies.

Option B: pip

pip install godotlens-mcp
{
  "mcpServers": {
    "godotlens": {
      "command": "godotlens-mcp"
    }
  }
}

Configuration

Environment Variable Default Description
GODOT_LSP_HOST 127.0.0.1 Godot LSP server host
GODOT_LSP_PORT 6005 Godot LSP server port

Tools

Health

Tool Description
gdscript_status Check if Godot LSP is connected

Navigation (6 tools)

Tool Description
gdscript_definition Go to definition of a symbol
gdscript_declaration Go to declaration of a symbol
gdscript_references Find all references to a symbol
gdscript_hover Get hover information (type, docs) for a symbol
gdscript_symbols List all symbols in a file
gdscript_signature_help Get function signature at call site

Refactoring

Tool Description
gdscript_rename Rename a symbol across all files

Synchronization (3 tools)

Tool Description
gdscript_sync_file Notify LSP that a file changed, returns diagnostics
gdscript_sync_files Batch sync multiple files
gdscript_delete_file Notify LSP that a file was deleted

Batch Operations (3 tools)

Tool Description
gdscript_symbols_batch Get symbols from multiple files
gdscript_definitions_batch Get definitions for multiple positions
gdscript_references_batch Find references for multiple positions

Diagnostics

Tool Description
gdscript_diagnostics Get errors/warnings for files

Architecture

┌──────────────┐         ┌────────────────────┐         ┌───────────────────┐
│   AI Agent   │  stdio  │  GodotLens (MCP)   │   TCP   │  Godot Editor     │
│ (Claude, etc)├────────►│  JSON-RPC 2.0      ├────────►│  Built-in LSP     │
│              │◄────────┤  Python 3.10+      │◄────────┤  Port 6005        │
└──────────────┘         └────────────────────┘         └───────────────────┘

GodotLens acts as a bridge between the AI agent and Godot's built-in Language Server. The AI agent communicates with GodotLens via MCP (JSON-RPC over stdio). GodotLens translates MCP tool calls into LSP requests and sends them to the Godot editor over TCP. Responses are compacted for efficient AI consumption.

Zero dependencies — the server uses only the Python standard library. The MCP and LSP protocols are implemented directly, keeping the server lightweight and self-contained.

Important: File Synchronization

Godot's LSP does not automatically detect file changes made outside the editor. When the AI agent modifies a .gd file, it should call gdscript_sync_file or gdscript_sync_files so the LSP re-analyzes the changed code. Without this, diagnostics and navigation results may be stale.

Recommended workflow:

  1. Use GodotLens tools to analyze code
  2. Write changes to files
  3. Call gdscript_sync_file to refresh LSP state
  4. Use GodotLens tools to verify changes

Coordinate System

All line and character parameters are 0-indexed, matching the LSP specification:

  • Line 0, Character 0 = first character of the file

License

MIT License — see LICENSE for details.

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

godotlens_mcp-1.0.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

godotlens_mcp-1.0.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file godotlens_mcp-1.0.0.tar.gz.

File metadata

  • Download URL: godotlens_mcp-1.0.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for godotlens_mcp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 085f8f3dd6b4886afc767e9d230b2fa441e92b8e1af7a3dff408f3ef609b8b4d
MD5 228dd120128a698723bdc6e263238f9b
BLAKE2b-256 a8b541d00996a028b6c6fe05e00b6a7962b9bd5f6b7686d6f7aee5657cbd83b0

See more details on using hashes here.

File details

Details for the file godotlens_mcp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: godotlens_mcp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for godotlens_mcp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4c54763ba8aa7a42973c1466dece691d39688ce3dc863f99eb36e9338c07a02
MD5 9827ed3264115260cc2bdbcee47bcac8
BLAKE2b-256 97acf601f0262c2147a95e65bf5f4a84118df1a4c5eab0733abbd11d52f998e1

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