godotlens-mcp
GodotLens: GDScript를 위한 AI 우선 코드 분석
Godot의 내장 언어 서버를 기반으로 GDScript를 위한 15가지 의미론적 분석 도구를 제공하는 MCP 서버입니다.
AI 에이전트를 위해 구축됨
AI 코딩 에이전트는 텍스트 파일로 작업하지만 GDScript에 대한 의미론적 이해가 부족합니다. 에이전트가 grep을 사용하여 함수의 사용처를 찾을 때, 함수 호출과 동일한 이름이 포함된 주석, 신호 선언과 신호 방출, 또는 재정의된 메서드와 관련 없는 함수를 구분할 수 없습니다.
GodotLens는 Godot의 내장 언어 서버를 MCP(Model Context Protocol)를 통해 노출함으로써 이 격차를 해소합니다. 이를 통해 AI 에이전트는 정의로 이동, 참조 찾기, 진단, 이름 변경 등 GDScript에 대한 컴파일러 수준의 정확한 코드 인텔리전스를 얻을 수 있습니다.
예시: _on_player_hit의 모든 사용처 찾기:
접근 방식 | 결과 |
| 주석, 문자열, 유사한 이름의 함수를 포함한 12개의 일치 항목 |
|
|
Related MCP server: Godot MCP Server
사전 요구 사항
Godot 4.x 에디터가 프로젝트를 연 상태로 실행 중이어야 합니다. Godot의 LSP 서버는 에디터가 프로젝트를 열면 자동으로 시작됩니다.
Python 3.10+ (pip 설치용) 또는 Node.js 16+ (npx용)
빠른 시작
옵션 A: npx (MCP 클라이언트에 권장)
MCP 구성(예: Claude Code의 경우 .mcp.json)에 추가하세요:
{
"mcpServers": {
"godotlens": {
"command": "npx",
"args": ["-y", "godotlens-mcp"]
}
}
}npm 패키지는 전체 서버(~20 KB의 Python)를 번들로 제공합니다. 외부 Python 의존성이 없습니다.
옵션 B: pip
pip install godotlens-mcp{
"mcpServers": {
"godotlens": {
"command": "godotlens-mcp"
}
}
}구성
환경 변수 | 기본값 | 설명 |
|
| Godot LSP 서버 호스트 |
|
| Godot LSP 서버 포트 |
도구
상태(Health)
도구 | 설명 |
| Godot LSP 연결을 확인합니다. 다른 도구를 사용하기 전에 에디터가 실행 중인지 확인하는 데 사용하세요. |
탐색(6개 도구)
도구 | 설명 |
| 심볼이 정의된 곳으로 이동합니다. 파일 경로와 줄 번호를 반환합니다. |
| 심볼의 선언 위치로 이동합니다. |
| 프로젝트 전체에서 심볼에 대한 모든 참조를 찾습니다. 리팩토링 전 영향 분석에 필수적입니다. |
| 심볼에 대한 타입 정보와 문서를 가져옵니다. 타입과 반환 값을 이해하는 데 사용하세요. |
| 파일 내의 모든 심볼(클래스, 함수, 변수, 신호)을 나열합니다. 파일 구조를 탐색하는 데 사용하세요. |
| 호출 지점에서 함수 시그니처와 매개변수 정보를 가져옵니다. |
리팩토링
도구 | 설명 |
| 모든 파일에서 심볼의 이름을 변경합니다. 워크플로우: 참조를 통해 영향 미리보기, 이름 변경, 동기화 순으로 진행하세요. |
동기화(3개 도구)
도구 | 설명 |
| 수정된 파일을 LSP와 동기화하고 업데이트된 진단 정보를 가져옵니다. .gd 파일 편집 후 호출하세요. |
| 수정된 여러 파일을 일괄 동기화합니다. 개별적으로 동기화하는 것보다 효율적입니다. |
| 파일이 삭제되었음을 LSP에 알립니다. 오래된 진단 정보를 지웁니다. |
일괄 작업(3개 도구)
도구 | 설명 |
| 한 번의 호출로 여러 파일에서 심볼을 가져옵니다. |
| 한 번의 호출로 여러 위치에 대한 정의를 가져옵니다. |
| 한 번의 호출로 여러 심볼에 대한 참조를 찾습니다. 대규모 영향 분석에 사용하세요. |
진단
도구 | 설명 |
| 컴파일러 오류와 경고를 가져옵니다. 워크플로우: 편집, 동기화, 진단 확인 순으로 진행하세요. |
아키텍처
┌──────────────┐ ┌────────────────────┐ ┌───────────────────┐
│ AI Agent │ stdio │ GodotLens (MCP) │ TCP │ Godot Editor │
│ (Claude, etc)├────────►│ JSON-RPC 2.0 ├────────►│ Built-in LSP │
│ │◄────────┤ Python 3.10+ │◄────────┤ Port 6005 │
└──────────────┘ └────────────────────┘ └───────────────────┘GodotLens는 AI 에이전트와 Godot의 내장 언어 서버 사이의 가교 역할을 합니다. AI 에이전트는 MCP(stdio를 통한 JSON-RPC)를 통해 GodotLens와 통신합니다. GodotLens는 MCP 도구 호출을 LSP 요청으로 변환하여 TCP를 통해 Godot 에디터로 보냅니다. 응답은 효율적인 AI 소비를 위해 압축됩니다.
의존성 제로 — 서버는 Python 표준 라이브러리만 사용합니다. MCP 및 LSP 프로토콜은 직접 구현되어 서버를 가볍고 독립적으로 유지합니다.
중요: 파일 동기화
Godot의 LSP는 에디터 외부에서 이루어진 파일 변경 사항을 자동으로 감지하지 않습니다. AI 에이전트가 .gd 파일을 수정하면 gdscript_sync_file 또는 gdscript_sync_files를 호출하여 LSP가 변경된 코드를 다시 분석하도록 해야 합니다. 그렇지 않으면 진단 및 탐색 결과가 오래된 상태일 수 있습니다.
권장 워크플로우:
GodotLens 도구를 사용하여 코드 분석
파일에 변경 사항 작성
gdscript_sync_file을 호출하여 LSP 상태 새로 고침GodotLens 도구를 사용하여 변경 사항 확인
좌표계
모든 줄 및 문자 매개변수는 LSP 사양에 맞춰 **0부터 시작(0-indexed)**합니다:
0번째 줄, 0번째 문자 = 파일의 첫 번째 문자
라이선스
MIT 라이선스 — 자세한 내용은 LICENSE를 참조하세요.
Available Tools
49 toolsdebug_continueB
Resume a paused game. Returns: confirmation.
Inputs: thread_id.
debug_evaluateARead-only
Evaluate a GDScript expression in the context of a paused frame. Returns: the resulting value and its type. Use to check state at a breakpoint without adding print() calls and re-running.
Inputs: expression (required), frame_id.
debug_inspectARead-only
Inspect variables visible in a stack frame. Returns: each scope (locals, members, globals) with its variables, values and types. Use the frame_id from debug_stack_trace. Only meaningful while execution is paused.
Inputs: frame_id (required).
debug_outputARead-only
Read what a game started with debug_run produced: print() output and stdout/stderr lines, plus structured errors - push_error, push_warning, engine errors and runtime script errors - each with file, function, ZERO-BASED line and call stack. Returns: lines, errors, and their counts. THIS IS THE ONLY WAY to see what the game actually did; the language server reports whether code compiles, not what it printed. Output and errors are drained on each call, so successive calls return only what is new.
Inputs: wait, clear.
debug_pauseA
Pause the running game. Returns: where it stopped. Use to inspect state at an arbitrary moment rather than a preset breakpoint.
Inputs: thread_id.
debug_runA
Run the project from the open Godot editor and collect what it prints. Returns: captured output, structured errors with call stacks, whether the game exited, and any stop reason. THIS CLOSES THE LOOP: edit, sync, run, and read the actual behaviour, without the developer pressing F5 or pasting console output back. The editor has ONE run slot: a second debug_run stops the first game. Set breakpoints with debug_set_breakpoints BEFORE calling this if you want execution to pause. Long-running games keep going - use debug_output to keep reading and debug_terminate to stop.
Inputs: args, scene, collect, timeout.
debug_set_breakpointsAIdempotent
Set breakpoints in a GDScript file, replacing any previously set in that file. Returns: each breakpoint with whether Godot verified it and the line it bound to. IMPORTANT: lines are ZERO-BASED, matching every other tool here. Set these before running the game, then use debug_stack_trace and debug_inspect once execution stops.
Inputs: file (required), lines (required).
debug_stack_traceARead-only
Get the call stack where execution is currently paused. Returns: frames with function name, file and ZERO-BASED line, plus why it stopped. An empty frame list means execution is not paused - frames exist only while stopped at a breakpoint or a runtime error.
Inputs: thread_id.
debug_statusARead-only
Check the connection to Godot's debug adapter and report whether the game is running, paused, or finished. The adapter is served by the Godot editor on port 6006 and needs no addon. Use this first if any debug_* tool behaves unexpectedly.
Inputs: no named parameters.
debug_step_overA
Step over one line in the paused game. Returns: the new stop location.
Inputs: thread_id.
debug_terminateBDestructiveIdempotent
Stop the running game. Returns: confirmation.
Inputs: no named parameters.
gdscript_completeARead-only
Get valid completions at a cursor position, from Godot's own completion engine. Returns: candidate labels with kind and detail. IMPORTANT: Uses ZERO-BASED coordinates. This is the only SCENE-AWARE query available: Godot resolves the scene that owns this script and completes against the real node, so $NodePath entries and the signals actually present on that node are included. No analysis of the .gd file alone can reproduce that.
Inputs: file (required), line (required), character (required), limit.
gdscript_definitionARead-only
Navigate to the definition of a symbol at a given position. Returns: file path and line number where the symbol is defined. IMPORTANT: Uses ZERO-BASED coordinates (editor line 1 = pass line 0). Use when you need to find where a function, variable, or class is defined.
Inputs: file (required), line (required), character (required).
gdscript_definitions_batchARead-only
Get definitions for multiple symbol positions in a single call. Returns: list of definition locations for each position. IMPORTANT: Uses ZERO-BASED coordinates. More efficient than calling gdscript_definition repeatedly.
Inputs: positions (required).
gdscript_diagnosticsARead-only
Get compiler errors and warnings for one or more files. Returns: list of diagnostics with line, severity (1=Error, 2=Warning, 3=Info, 4=Hint), and message. WORKFLOW: (1) Edit files, (2) gdscript_sync_files to refresh, (3) gdscript_diagnostics to check for errors. Use before committing to catch issues early.
Inputs: files (required).
gdscript_engine_apiARead-only
Get authoritative documentation for a Godot ENGINE class or member, from the exact editor build in use. Returns: signature with argument names, types and defaults, plus documentation. USE THIS instead of recalling Godot's API from memory - it is the ground truth for the user's version and prevents inventing methods that do not exist. Pass 'member' for a specific method/property/signal; omit it to check a class exists.
Inputs: class_name (required), member.
gdscript_findARead-only
Find where a symbol is declared BY NAME, without needing its position. Returns: declaration sites with file, ZERO-BASED line and character, kind, and containing class. USE THIS FIRST when you know a name but not its location - the returned line/character feed directly into gdscript_references, gdscript_hover and gdscript_rename. Guessing a character offset and landing one column off returns an empty result that looks identical to 'no such symbol'. Positions come from the language server, not from text matching.
Inputs: name (required), file, max_files, include_references.
gdscript_hoverARead-only
Get type information and documentation for a symbol at a given position. Returns: type signature, documentation string, or description of the symbol. IMPORTANT: Uses ZERO-BASED coordinates. Use to understand what type a variable is, or what a function returns.
Inputs: file (required), line (required), character (required).
gdscript_referencesARead-only
Find all references to a symbol across the entire project. Returns: list of locations (file, line, character) where the symbol is used. IMPORTANT: Uses ZERO-BASED coordinates. Essential for impact analysis before refactoring: 'What code uses this symbol?'
Inputs: file (required), line (required), character (required).
gdscript_references_batchARead-only
Find references for multiple symbols in a single call. Returns: list of reference locations for each position. IMPORTANT: Uses ZERO-BASED coordinates. More efficient than calling gdscript_references repeatedly. Use for bulk impact analysis across multiple symbols.
Inputs: positions (required).
gdscript_references_in_fileARead-only
Find occurrences of a symbol within ONE file. Returns: list of line/char positions. IMPORTANT: Uses ZERO-BASED coordinates. Much cheaper than gdscript_references, which reparses every .gd file in the project on Godot 4.6+. Requires Godot 4.7+; reports unsupported otherwise.
Inputs: file (required), line (required), character (required).
gdscript_release_fileAIdempotent
Release a file from the LSP session, so Godot stops serving the copy this session opened and reads from disk again. Returns: whether the file was open, and what was actually done. WHEN TO CALL: after deleting a .gd file, or when you want the LSP to forget content you synced earlier. NOTE: Godot removed its file-deletion notification in 4.6, so this cannot purge project-wide state; that clears when the editor rescans.
Inputs: file (required).
gdscript_renameARead-onlyIdempotent
Rename a symbol across all files in the project. Returns: workspace edit with all changes needed. IMPORTANT: Uses ZERO-BASED coordinates. WORKFLOW: (1) gdscript_references to preview impact, (2) gdscript_rename to rename, (3) gdscript_sync_files to refresh LSP state.
Inputs: file (required), line (required), new_name (required), character (required), +1 more.
gdscript_signature_helpARead-only
Get function signature and parameter information at a call site. Returns: function name, parameters with types, and return type. IMPORTANT: Uses ZERO-BASED coordinates. Use when you need to know the correct parameters for a function call.
Inputs: file (required), line (required), character (required).
gdscript_statusARead-only
Check connection status to the Godot LSP server. Returns: connection status, host, and port. Use this to verify Godot editor is running before using other tools. If disconnected, start Godot editor with your project open.
Inputs: no named parameters.
gdscript_symbolsARead-only
List all symbols (classes, functions, variables, signals, enums) in a file. Returns: symbol tree with name, kind, and line number for each symbol. Use to understand the structure of a file before making changes. WORKFLOW: gdscript_symbols to explore, then gdscript_hover or gdscript_definition for details.
Inputs: file (required).
gdscript_symbols_batchARead-only
Get symbols from multiple files in a single call. Returns: map of file path to symbol tree for each file. More efficient than calling gdscript_symbols repeatedly. Use to understand the structure of multiple files at once.
Inputs: files (required).
gdscript_sync_fileAIdempotent
Notify Godot's LSP that a file was modified and get updated diagnostics. Returns: diagnostics (errors/warnings) for the synced file. WHEN TO CALL: After using Edit/Write tools to modify a .gd file. The LSP does not watch files, so you must call this to refresh analysis. Optionally pass content directly to avoid reading from disk.
Inputs: file (required), content.
gdscript_sync_filesAIdempotent
Batch sync multiple modified files with Godot's LSP. Returns: diagnostics for all synced files. WHEN TO CALL: After modifying multiple .gd files with Edit/Write tools. More efficient than calling gdscript_sync_file repeatedly. Reads content from disk for all specified files.
Inputs: files (required).
gdscript_validateARead-only
Check proposed file content for errors WITHOUT writing it to disk. Returns: valid flag, errors and warnings. WHEN TO CALL: before writing an edit, so broken code never reaches the project. The LSP is restored to the on-disk content afterwards.
Inputs: file (required), content (required).
project_configARead-only
Get the project's resolved configuration: autoload singletons, input action names, class_name globals, and the main scene. Autoload and input action names are BARE STRINGS at the point of use - GameState.add_score(1), Input.is_action_pressed("jump") - and nothing validates them. Neither the compiler nor the language server catches a typo; it is a silent runtime no-op. Check names here before writing them. Values come from ProjectSettings via the engine, so defaults and feature-tagged overrides resolve correctly. Requires a Godot binary.
Inputs: no named parameters.
project_validateARead-only
Find references that no longer resolve, project-wide: scene and resource dependencies pointing at moved or deleted files, missing autoload scripts, and a missing main scene. Returns: broken references with the file that holds each, plus stale UIDs (Godot falls back to the text path and warns). WHEN TO CALL: after moving, renaming or deleting files. Nothing else reports these until the reference is loaded at runtime. Uses the engine's own resolution: a reference whose UID still resolves is not broken. Script preload()/extends paths are compile errors - gdscript_diagnostics reports them. Requires a Godot binary; runs no project code.
Inputs: no named parameters.
runtime_evalA
Evaluate an expression in a running game, while it runs - no breakpoint needed. Uses Godot's Expression: calls, operators, member access and constructors, no statements or assignment. Names available: the base node's members (default the current scene), autoloads, engine singletons such as Input, and class_name globals. Calls run for real and may change the game. Returns: the value, or the engine's error text.
Inputs: expression (required), node, session_id.
runtime_inputA
Press an input action in a running game, as a player would: pressed for the given number of frames, then released, through the normal input path, so is_action_just_pressed and _unhandled_input see it. Actions come from the project's Input Map (project_config lists them). Returns: once released.
Inputs: action (required), frames, strength, session_id.
runtime_inspectBRead-only
Current property values of one node or object in a running game, as the engine reports them. Returns: class and each property's type and value.
Inputs: node, object_id, properties, session_id.
runtime_monitorsARead-only
Performance monitors of a running game, about once a second: FPS, frame times, object, node and orphan-node counts, memory, draw calls, physics, plus any custom monitors the game registers. Returns: latest values, and a history of the requested monitors - a rising orphan count is the usual sign of a leak.
Inputs: names, session_id.
runtime_outputARead-only
Read what a running game printed and every structured error it reported since the last call - push_error, push_warning, engine and script errors, each with file, function, ZERO-BASED line and call stack. Drained on each call.
Inputs: wait, session_id.
runtime_pauseB
Freeze or unfreeze a running game's scene tree. Returns: the new state.
Inputs: paused (required), session_id.
runtime_reloadA
Hot-reload changed scripts into a running game, keeping its state. Refuses when the language server reports errors in them: a script that fails to compile is disabled in the running game. Covers .gd scripts only - edited .tscn files and new or changed assets need a restart.
Inputs: files (required), session_id.
runtime_runA
Launch the game as its own process, connected straight back to GodotLens - no editor run slot, so several agents can each run one at once. Returns: session_id, and the output and structured errors from the first seconds. Runs HEADLESS by default (no window, no sound); pass windowed=true only when you need runtime_screenshot - the window is placed off-screen and takes no focus. Script errors are reported, never stop the game. Then use runtime_tree, runtime_inspect and runtime_output to see what the game is doing. The game runs through GodotLens's helper (loaded for this run only, nothing is written to the project), which adds runtime_eval and runtime_input.
Inputs: args, scene, helper, collect, +3 more.
runtime_screenshotARead-only
Capture what a windowed game is drawing. Returns: the image, with its size. Needs a session started with windowed=true; a headless game has no pixels.
Inputs: session_id.
runtime_setA
Change a property on a node in a running game, then read it back. Values are converted to the property's own type: pass [1, 2] or 'Vector2(1, 2)' for a Vector2, '#ff0000' for a Color, a res:// path for a resource. Returns: the value the engine now reports.
Inputs: value (required), property (required), node, object_id, +1 more.
runtime_statusARead-only
List the games GodotLens is running. Returns: each session with pid, scene, whether it is headless, running and connected, plus this server's pid.
Inputs: no named parameters.
runtime_stepA
Advance a paused game by one frame. Windowed sessions only: a headless game never draws a frame, and Godot re-pauses after the next drawn frame.
Inputs: session_id.
runtime_stopADestructive
Stop a game started with runtime_run. Returns: exit code.
Inputs: session_id.
runtime_time_scaleB
Speed up or slow down a running game. Returns: the new scale.
Inputs: scale (required), session_id.
runtime_treeARead-only
The live scene tree of a running game, including nodes created at runtime. Returns: nested nodes with name, type (script class_name or path when scripted), path, object_id and visibility. Use the path or object_id with runtime_inspect.
Inputs: path, max_depth, session_id.
scene_stateARead-only
Get Godot's own resolved view of a scene: node tree with types, script attachments, unique_name_in_owner flags, exported property values, and the signal connections declared in the scene. Godot's LSP reads .gd files only, so NONE of this is visible to gdscript_references or gdscript_rename. Runs the engine to resolve the scene, so inherited scenes and instanced children are resolved the way Godot actually instantiates them. Requires a Godot binary (GODOT_BIN or ./godot/).
Inputs: files (required).
scene_validateARead-only
Check a scene for what Godot gets silently wrong when it loads or runs it. Errors: connections to handlers or nodes that do not exist, signals the source does not have, handlers taking the wrong number of arguments, unknown node types, scripts whose base type does not fit the node, missing parents, duplicate names and duplicate unique names, and changes to nodes that do not exist in an instanced scene. Warnings: unknown properties, values of the wrong type, and NodePaths to nodes not in the scene. Returns: per-scene problems with kind, severity and detail; valid means no errors. WHEN TO CALL: after editing a .tscn, or after renaming or removing a signal handler in GDScript. Godot accepts all of these with no error or only a console warning. Facts come from the engine; handler existence from the LSP's parse of the attached script.
Inputs: files (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 49 tools
Two large families overlap heavily: debug_run/debug_output/debug_pause/debug_step_over/debug_inspect/debug_evaluate/debug_terminate mirror runtime_run/runtime_output/runtime_pause/runtime_step/runtime_inspect/runtime_eval/runtime_stop, and gdscript_references vs gdscript_references_in_file vs gdscript_references_batch, or gdscript_sync_file(s) vs gdscript_diagnostics, blur together. The descriptions do carefully explain the distinction (editor run slot vs separate process, breakpoint vs live, single vs batch), so an attentive agent can choose correctly, but the boundaries are not self-evident from names alone.
Names use a predictable snake_case namespace_verb/noun pattern with clean subsystem prefixes (gdscript_, debug_, runtime_, project_, scene_), and plural suffixes cleanly mark batch variants. Minor deviation: within families the second token mixes verbs and nouns (gdscript_complete vs gdscript_status vs gdscript_find), but this stays readable and consistent overall.
At 49 tools this is far past the comfortable range, and much of the bulk comes from parallel variants rather than distinct capabilities (three _batch wrappers, _sync_file vs _sync_files, references vs references_in_file, two near-identical run/inspect/output stacks). The breadth of the domain (LSP, debug adapter, standalone runtime, scene, project) explains some of it, but the surface is heavy enough that tool selection becomes a real burden.
Coverage is unusually strong end to end: navigation, hover, signature help, rename, validation-without-write, diagnostics, engine API lookup, project/scene validation, and both breakpoint debugging and live runtime introspection. Minor gaps remain, such as no workspace-wide symbol search and no hot-reload path for edited .tscn files or new assets (runtime_reload is GDScript-only), but these are workaround-able.
Maintenance
Related MCP Connectors
The official Svelte MCP server providing docs and autofixing tools for Svelte development
MCP Server for Slima - AI Writing IDE for Novel Authors with AI Beta Reader.
Lean 4 MCP server: compile, prove theorems, and formalize math with Mathlib.
A MCP server built for developers enabling Git based project management with project and personal…
Related MCP Servers
- AlicenseAqualityBmaintenanceProvides instant GDScript syntax validation and diagnostics by bridging Godot's native Language Server Protocol to MCP clients. Enables real-time syntax checking in AI assistants without requiring custom plugins or context switching to the Godot editor.4164 npm46MIT
- FlicenseAqualityDmaintenanceAn MCP server that provides tools for Godot Engine development, enabling users to run unit tests, check for syntax errors, and manage project scenes or exports.52-
- AlicenseBqualityDmaintenanceAn MCP server for Godot game development that provides 45 tools for reading, analyzing, and editing projects. It enables users to manage scene trees, navigate GDScript symbols, and interact with the Godot runtime for debugging and state capture.52MIT
- AlicenseAqualityFmaintenanceA Godot 4 MCP server for AI-assisted project inspection, editing, validation, and runtime automation via stdio and optional WebSocket bridge.389MIT