GodotLens
io.github.pzalutski-pixel由 GitHub 帳號 pzalutski-pixel 發布v1.2.0更新於 Oct 25, 2026
Godot's own view of your GDScript project: code, scenes, and the running game
概覽
一個本機 MCP 伺服器,讓 AI 助理向 Godot 自身的語言伺服器、偵錯工具與引擎查詢 GDScript 專案,並執行與觀察遊戲。
- 可以做什麼
- 尋找、檢視與重新命名 GDScript 符號:定義、參照、懸停型別、符號樹、簽章、批次查詢,以及來自目前安裝版本的引擎 API 簽章,還可補全並在不寫入磁碟的情況下驗證擬寫程式碼。讓 Godot 保持同步:同步已編輯檔案、釋放檔案、讀取編譯診斷與連線狀態。透過 Godot 執行檔檢查專案與場景:自動載入、輸入動作、class_name 全域、主場景、失效參照、節點樹、訊號連線與場景驗證。透過編輯器的偵錯轉接器偵錯:執行專案、讀取輸出與結構化錯誤、設定中斷點、單步、檢視變數並在中斷點求值。啟動由 GodotLens 代管的遊戲:讀取輸出、檢視即時場景樹與屬性、修改屬性、求值運算式、模擬輸入、熱重載指令碼、截圖、檢視效能監視器、暫停、調整時間倍率與停止。
- 適用情境
- 適合助理編輯 GDScript 時需要引擎層級準確答案而非猜測的情況:真實呼叫點、目前 Godot 版本的真實簽章、編譯檢查、場景連線檢查,以及無需人工試玩即可啟動遊戲並觀察或操作它。
- 執行需求
- 透過 npx(Node.js 16+)或 pip/uvx(Python 3.10+)以 stdio 在本機執行。需要 Godot 4.6+;gdscript_* 與 debug_* 需要在專案上開啟編輯器(或帶 LSP 與 DAP 埠的無頭編輯器),scene_*、project_* 與 runtime_* 需要經 GODOT_BIN、./godot/ 目錄或 PATH 找到 Godot 執行檔。選用設定包括 GODOT_LSP_HOST/PORT、GODOT_DAP_HOST/PORT、GODOT_PROJECT_ROOT 及各逾時變數。無需驗證。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 GodotLens,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
GodotLens: Godot's own view of your GDScript project
[GitHub Release] [npm] [PyPI] [License: Apache 2.0]
An MCP server that lets an AI agent ask Godot itself about your project — where a symbol is used, what a method's real signature is, whether an edit compiles, how a scene is wired — and run the game, look at it and drive it, so the agent can check that the game does what it meant without a person playing it.
Why
An agent editing GDScript from text alone is guessing. It cannot tell a call from a comment,
cannot know which methods exist on a CharacterBody2D in your Godot version, cannot see that
a signal handler is wired by name inside a .tscn, and cannot see what happened at runtime.
GodotLens never answers those questions itself. It asks the engine and returns the engine's
answer. Measured on Godot 4.7.1, in a project where take_damage is defined in player.gd,
called twice from enemy.gd, once from player.gd, and named in a comment:
That principle — delegate every judgement to Godot — is what makes the answers trustworthy,
and it is why the tool names tell you where an answer came from. gdscript_* is the language
server. scene_* and project_* run the engine on the project. debug_* is your editor's
debugger. runtime_* is a game GodotLens launched and is connected to.
Requirements
Godot 4.6 is the floor because the language server changed materially at 4.5 (URI encoding) and 4.6 (document ownership). Older versions are refused with a clear message rather than silently misread.
Install
npx (recommended). The package bundles the server; there are no runtime dependencies.
pip
How to run
Import Resources When Unfocused. The editor notices new and changed files only when its
window gains focus. An agent-driven editor never gains focus, so a new class_name script stays
unknown — every script using it reports the name as undeclared and the game fails to parse —
and new assets stay unimported. With this setting on, the editor rescans every half second.
It is interface/editor/behavior/import_resources_when_unfocused in 4.7 and
interface/editor/import_resources_when_unfocused in 4.6; to set it for one project only, put
the 4.6 name under [editor_overrides] in project.godot (4.7 migrates it on load). When a
synced file names a class the editor has not registered, gdscript_sync_file waits briefly,
then says which class and points here.
Games GodotLens launches. runtime_run starts the game with --remote-debug pointing at
GodotLens, so the game connects to GodotLens the way it would to the editor's debugger. Games
are headless by default — no window, no sound, nothing takes focus. Pass windowed: true
only for runtime_screenshot: the window opens at a far-off position with audio muted, and is
then moved fully off-screen, so at most a small corner may show for a moment.
Script errors are reported and never stop the game. A game started this way ends when it is
stopped, when GodotLens exits, and on Windows even if GodotLens is killed outright. Its log,
like that of every engine run GodotLens starts, goes to a temporary file of its own: Godot keeps
only the newest five logs per project, and your own play and test logs stay among them.
The helper. runtime_eval and runtime_input need code inside the game. GodotLens passes
its own helper.gd to the game with --script for that run only; nothing is written to your
project. Godot still loads your project's settings, input map and autoloads, and the helper
opens the scene. A project that sets its own main loop type runs without it, and
runtime_run with helper: false runs the game exactly as it is.
Several agents. Subagents in one Claude Code session share one GodotLens process
(gdscript_status and runtime_status report its server_pid). Calls run concurrently, so a
long runtime_run or scene check does not hold up anyone else's query, and each agent can run
its own game with runtime_run (GODOT_RUNTIME_MAX_SESSIONS, default 4). Two things are not
coordinated: debug_run uses your editor's single run slot, so a second run stops the first;
and two agents writing the same file overwrite each other — have one agent write at a time.
The loop
The tools are designed around one cycle. Read it once and the rest of this document is a reference.
- Understand.
gdscript_findlocates a symbol by name;gdscript_referencesandgdscript_hoverexplain how it is used and what type it is. - Write.
gdscript_engine_apigives real signatures instead of recalled ones,gdscript_completeoffers scene-aware candidates, andgdscript_validatechecks proposed content before it reaches disk. - Sync. Godot's language server does not watch the filesystem. After editing a
.gdfile, callgdscript_sync_fileor it keeps answering from the old text. - Verify.
gdscript_diagnosticsfor compile errors,scene_validatefor what the compiler cannot see in a scene,project_validateafter moving files. - Run.
runtime_runstarts the game and returns its first output and errors. - Observe and act. See the live tree and values, press inputs, evaluate expressions,
take a screenshot; fix the code and
runtime_reloadit into the running game.
Two conventions apply throughout:
- All line and character parameters are 0-indexed, matching the LSP. Editor line 1 is
line 0.
gdscript_findexists partly so you rarely have to compute one by hand. - Results carry a
verifiedflag where it matters.verified: falsewith an empty diagnostics list means Godot never reported back — that is not a clean bill of health.
Tools
Understanding code
Writing code
Keeping Godot in step
Project and scenes
These run the Godot binary, so scenes resolve exactly as the engine builds them, inherited and
instanced scenes included. They do not parse .tscn as text, and need no editor.
Debugger in your editor
Godot serves a Debug Adapter Protocol server from the editor, no addon required. These use the editor's own run slot — one game at a time — and are the way to set breakpoints.
Games GodotLens launches
runtime_run starts the game as its own process, connected straight back to GodotLens, so
several agents can each run one at once and no editor is needed.
Limitations
Worth knowing before you trust a result.
What the language server cannot see
- It reads
.gdfiles only. A signal handler wired in a.tscn[connection]block is invisible to it, so renaming that handler leaves the scene pointing at a method that no longer exists. This is whyscene_validateexists and whygdscript_renamewarns. - Autoload and input action names are bare strings.
GameState.add_score(1)andInput.is_action_pressed("jump")are validated by nothing at all. Check them againstproject_configbefore writing them. - New files reach it only through the editor's filesystem scan (see How to run). The
scan notices a folder only when its modification time changes, and Godot keeps those times
in whole seconds, so a file created in the same second as a scan can be missed. When a new
class is still unknown a second later, GodotLens creates and removes an empty hidden file
(
.godotlens-rescan) in that folder — the editor ignores dot-names — so the next scan re-reads it. Nothing else is written to your project. gdscript_referencesis expensive on 4.6+, reparsing every script in the project. Prefergdscript_references_in_filewhen one file is enough.
Running games
- No pixels in a headless game.
runtime_screenshotneedswindowed: true, andruntime_stepdoes too: Godot pauses again only after the next drawn frame. - Hot reload covers scripts only. Edited
.tscnfiles and new or changed assets need a restart. A script that fails to compile is disabled in the running game, soruntime_reloadrefuses one with errors — which needs the editor's language server to check; without an editor it reloads unchecked and says so. runtime_evalis Godot'sExpression, not full GDScript: calls, operators and member access, no statements or assignment. Calls run for real.- Breakpoints are only in your editor (
debug_*).debug_evaluateworks only while paused in a frame with a script instance; in a static function or at a parse-error break it is refused, because Godot would resume the game instead of answering. - Godot rate-limits what a game reports (
network/limits/debugger/*project settings): a game printing heavily has its output truncated by the engine. - On Linux and macOS a game is stopped when GodotLens exits normally, but keeps running if GodotLens is killed outright. On Windows it is stopped either way (a job object).
Scene and project checks
scene_*andproject_configstart your autoloads, as the game would, so a script that uses an autoload compiles.project_validateandruntime_monitorsstart nothing.- Some scene mistakes are not visible to any engine API. An unknown property on a
[sub_resource]is dropped by Godot while loading, before anything can ask about it. project_validatecovers scenes and resources. A brokenpreload()orextendspath in a script is a compile error, whichgdscript_diagnosticsreports.
One project, one editor. A second editor on the same project — a headless one beside your
GUI editor, say — rewrites .godot/'s class cache from its own view and can drop classes the
other registered. Attach GodotLens to the editor you have open.
Architecture
Four channels, one process. Each tool group maps to exactly one of them, which is how you know where an answer came from.
The MCP, LSP and DAP protocols and Godot's binary value format are implemented directly against
the standard library, so the package has zero runtime dependencies and the npm bundle is a
handful of .py and .gd files.
Configuration
Contributing
Integration tests launch a real headless Godot and skip cleanly without one. The one test that opens a game window runs only when asked, or under a virtual display on Linux:
CI runs the suite on Linux, Windows and macOS across Python 3.10–3.13, runs the integration tests against a real Godot on all three, and installs the built npm tarball and executes it.
License
來源:README.md,提交 c26c7e8
工具
0版本歷史
2- v1.2.0最新Oct 17, 2026
- v1.1.1Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分