A stdio-to-TCP bridge for Godot's GDScript Language Server. Enables AI coding agents to use Godot's LSP for code intelligence.
npm: https://www.npmjs.com/package/godot-lsp-stdio-bridge
Most AI coding tools (Claude Code, Cursor, OpenCode, etc.) expect LSP servers to communicate via stdio, but Godot's LSP only supports TCP (port 6005). This bridge solves that.
| Feature | Description |
|---|---|
| stdio ↔ TCP Bridge | Converts between stdio (AI tools) and TCP (Godot LSP) |
| Binary-Safe Buffers | Uses Buffer.concat() instead of string concatenation - fixes data loss with large files |
| Auto Port Discovery | Automatically tries ports 6005, 6007, 6008 if connection fails |
| Auto Reconnection | Reconnects automatically when Godot Editor restarts |
| Windows URI Normalization | Converts C:\path to /C:/path for cross-platform compatibility |
| Notification Buffering | Buffers notifications until initialize response (fixes Godot's non-standard ordering) |
| Memory Protection | 10MB buffer limit and 1000 message queue limit to prevent memory exhaustion |
| Graceful Shutdown | Handles SIGINT, SIGTERM, SIGHUP signals properly |
| Zero Dependencies | Pure Node.js, no external dependencies |
- Node.js 18+
- Godot Editor running with your project open (LSP server runs on port 6005)
npm install -g godot-lsp-stdio-bridgeOr use directly with npx:
npx godot-lsp-stdio-bridgeAdd to ~/.config/opencode/opencode.json:
{
"lsp": {
"gdscript": {
"command": ["npx", "godot-lsp-stdio-bridge"],
"extensions": [".gd", ".gdshader"]
}
}
}Add to your MCP settings or Claude configuration:
{
"lsp": {
"gdscript": {
"command": ["npx", "godot-lsp-stdio-bridge"],
"extensions": [".gd"]
}
}
}In Cursor settings, add a custom language server:
{
"gdscript": {
"command": ["npx", "godot-lsp-stdio-bridge"],
"filetypes": ["gdscript"]
}
}{
"languageserver": {
"gdscript": {
"command": "npx",
"args": ["godot-lsp-stdio-bridge"],
"filetypes": ["gdscript"],
"rootPatterns": ["project.godot"]
}
}
}local lspconfig = require('lspconfig')
local configs = require('lspconfig.configs')
configs.gdscript_bridge = {
default_config = {
cmd = { 'npx', 'godot-lsp-stdio-bridge' },
filetypes = { 'gdscript' },
root_dir = lspconfig.util.root_pattern('project.godot'),
},
}
lspconfig.gdscript_bridge.setup{}On Windows, npm creates .cmd wrapper scripts for global packages:
{
"lsp": {
"gdscript": {
"command": ["godot-lsp-stdio-bridge.cmd"],
"extensions": [".gd"]
}
}
}| Variable | Default | Description |
|---|---|---|
GODOT_LSP_PORT |
Auto-discover | Fixed port (skips auto-discovery if set) |
GODOT_LSP_HOST |
127.0.0.1 |
Godot LSP server host |
GODOT_LSP_BRIDGE_DEBUG |
false |
Enable debug logging |
GODOT_LSP_BRIDGE_LOG |
/tmp/godot-lsp-stdio-bridge.log |
Log file path (Windows: %TEMP%\godot-lsp-stdio-bridge.log) |
- Open Godot Editor with your project
- Start your AI coding tool (it will automatically start the bridge)
- Edit
.gdfiles - you'll get diagnostics, symbols, go-to-definition, etc.
Once connected, you get full GDScript LSP features:
- Diagnostics (errors, warnings)
- Document symbols
- Go to definition
- Find references
- Hover information
- Completion suggestions
- Signature help
┌─────────────────┐ stdio ┌─────────────────┐ TCP ┌─────────────────┐
│ AI Coding │ ─────────────► │ godot-lsp- │ ─────────────► │ Godot LSP │
│ Agent │ ◄───────────── │ stdio-bridge │ ◄───────────── │ Server │
│ (Claude, etc.) │ │ │ │ (port 6005) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
If GODOT_LSP_PORT is not set, the bridge tries these ports in order:
- 6005 - Default Godot LSP port
- 6007 - Alternative port (some Godot versions)
- 6008 - Fallback port
- Connection lost → Wait 5 seconds
- Try to reconnect (with port discovery)
- On success → 1 second warmup delay → Flush buffered messages
- Notify client: "Godot LSP server restarted"
Make sure Godot Editor is running with your project open. The LSP server only runs when the editor is active.
GODOT_LSP_BRIDGE_DEBUG=true npx godot-lsp-stdio-bridgeCheck logs at /tmp/godot-lsp-stdio-bridge.log (Linux/macOS) or %TEMP%\godot-lsp-stdio-bridge.log (Windows)
If Godot uses a different port:
GODOT_LSP_PORT=6008 npx godot-lsp-stdio-bridgeThis bridge uses binary-safe Buffer.concat() instead of string concatenation, which prevents data loss with large GDScript files (80KB+). If you experience issues with other bridges, this one should work.
| Feature | godot-lsp-stdio-bridge (this) | opencode-godot-lsp | godot-lsp-bridge (can0pus) |
|---|---|---|---|
| Binary-safe buffers | ✅ Buffer.concat() |
❌ .toString() |
❌ .toString() |
| Auto port discovery | ✅ 6005, 6007, 6008 | ❌ | ✅ |
| Auto reconnection | ✅ | ❌ | ✅ |
| Windows URI normalization | ✅ | ❌ | ✅ |
| Memory protection | ✅ 10MB limit | ❌ | ✅ |
| Dependencies | None | None | None |
| Build required | ❌ | ❌ | ✅ TypeScript |
MIT
Issues and PRs welcome at GitHub.
- Godot Engine - The open-source game engine that provides the GDScript Language Server
- Disunday - Control OpenCode from Discord
Redimo - The Ultimate Redis GUI Client. Visualize, Manage, and Monitor.