godotlens-mcp

godotlens-mcp

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

Category
访问服务器

README

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 connection to Godot LSP. Use to verify editor is running before other tools.

Navigation (6 tools)

Tool Description
gdscript_definition Navigate to where a symbol is defined. Returns file path and line number.
gdscript_declaration Navigate to the declaration site of a symbol.
gdscript_references Find all references to a symbol across the project. Essential for impact analysis before refactoring.
gdscript_hover Get type information and documentation for a symbol. Use to understand types and return values.
gdscript_symbols List all symbols (classes, functions, variables, signals) in a file. Use to explore file structure.
gdscript_signature_help Get function signature and parameter info at a call site.

Refactoring

Tool Description
gdscript_rename Rename a symbol across all files. Workflow: references to preview impact, rename, then sync.

Synchronization (3 tools)

Tool Description
gdscript_sync_file Sync a modified file with the LSP and get updated diagnostics. Call after editing .gd files.
gdscript_sync_files Batch sync multiple modified files. More efficient than syncing individually.
gdscript_delete_file Notify LSP a file was deleted. Clears stale diagnostics.

Batch Operations (3 tools)

Tool Description
gdscript_symbols_batch Get symbols from multiple files in one call.
gdscript_definitions_batch Get definitions for multiple positions in one call.
gdscript_references_batch Find references for multiple symbols in one call. Use for bulk impact analysis.

Diagnostics

Tool Description
gdscript_diagnostics Get compiler errors and warnings. Workflow: edit, sync, then diagnostics to verify.

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.

<!-- mcp-name: io.github.pzalutski-pixel/godotlens -->

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选