Minimal Godot MCP

Minimal Godot MCP

Provides 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.

Category
访问服务器

README

minimal-godot-mcp

Lightweight MCP server bridging Godot LSP to MCP clients for GDScript validation

npm version License: MIT Node.js

Built with one mission: surface Godot diagnostics with minimal overhead.

Get instant GDScript syntax feedback in Claude, Cursor, and other MCP clients—no context switching to Godot, no custom plugins. Just a lightweight bridge to Godot's native LSP.

Table of Contents

Quick Start

Prerequisites

  • Node.js 24+
  • Godot 3.2+ or 4.x with LSP enabled

Setup

Note: Package not yet published to npm. For now, clone and build locally.

# Clone and build
git clone https://github.com/ryanmazzolini/minimal-godot-mcp.git
cd minimal-godot-mcp
npm install
npm run build

# Start Godot editor with your project

Configure your MCP client (eg. Claude Code) to use the local build:

{
  "mcpServers": {
    "godot": {
      "command": "node",
      "args": ["/path/to/minimal-godot-mcp/dist/index.js"]
    }
  }
}

Tip: See Configuration for environment variables and client-specific examples.

Restart your MCP client and start editing .gd files ✨

Features

  • 🔌 Zero-config LSP integration - Uses Godot's native Language Server (no plugins, no extra dependencies)
  • ⚡ Fast diagnostics - Single-file checks return in <1s
  • 📦 Minimal footprint - <10MB memory, <200 LOC core implementation
  • 💬 Low context overhead - Lightweight responses to minimize AI token usage
  • 🔄 Resilient connections - Handles Godot restarts and reconnections automatically
  • 🤝 Plays nice - Compatible with godot-vscode-plugin and other LSP clients
  • 🌐 Workspace scanning - Optional bulk checking of all .gd files

See the context usage in Claude Code:

context-use

Configuration

Environment Variables

Set these environment variables in your MCP client configuration to customize behavior:

  • GODOT_LSP_PORT: Override default port selection Default: tries ports 6007, 6005, 6008 in order Example: "GODOT_LSP_PORT": "6005"

  • GODOT_WORKSPACE_PATH: Set Godot project path for LSP initialization Default: uses workspace from Godot's notification Example: "GODOT_WORKSPACE_PATH": "/absolute/path/to/your/godot/project"

MCP Client Examples

Claude Code (~/.claude/config.json):

{
  "mcpServers": {
    "godot": {
      "command": "node",
      "args": ["/path/to/minimal-godot-mcp/dist/index.js"],
      "env": {
        "GODOT_LSP_PORT": "6007",
        "GODOT_WORKSPACE_PATH": "/absolute/path/to/your/godot/project"
      }
    }
  }
}

Usage

  1. Start Godot editor with your project
  2. Verify LSP is running: nc -zv localhost 6007
  3. Edit GDScript files with your MCP client enabled
  4. Receive instant syntax error feedback

MCP Tools

get_diagnostics

Fast single-file diagnostic check (<1s).

Input:

{
  "file_path": "/absolute/path/to/script.gd"
}

Output:

{
  "diagnostics": {
    "/path/to/file1.gd": [
      {
        "line": 42,
        "column": 10,
        "severity": "error",
        "message": "Expected identifier after '.'",
        "code": "GD0001"
      }
    ]
  }
}

scan_workspace_diagnostics

⚠️ EXPENSIVE operation - scans ALL .gd files in workspace (5-30s for 100+ files).

Use sparingly for workspace-wide error checking. Requires GODOT_WORKSPACE_PATH environment variable.

Input:

{}

Output:

{
  "files_scanned": 150,
  "files_with_issues": 3,
  "scan_time_seconds": 12.45,
  "diagnostics": {
    "/path/to/file1.gd": [...],
    "/path/to/file2.gd": [...]
  }
}

Example in practice:

When you edit a GDScript file with a syntax error:

# player.gd
extends CharacterBody2D

func _ready():
    velocity. = Vector2(100, 0)  # Missing identifier after '.'

The MCP client receives:

{
  "diagnostics": {
    "/path/to/player.gd": [
      {
        "line": 5,
        "column": 14,
        "severity": "error",
        "message": "Expected identifier after '.'",
        "code": "parse-error"
      }
    ]
  }
}

Comparison

How minimal-godot-mcp differs from other Godot MCP servers:

Feature minimal-godot-mcp ee0pdt/Godot-MCP Coding-Solo/godot-mcp
Custom plugin required
Project manipulation
LSP integration ✅ Native ❌ Custom ❌ GDScript ops
Scope Diagnostics only Full control CLI + scripts

Use minimal-godot-mcp when: You want lightweight syntax checking during AI-assisted GDScript editing

Use alternatives when: You need scene management, node creation, or full project control

Development

Architecture

┌─────────────┐         ┌────────────────────┐         ┌────────────┐
│ MCP Client  │ ◄─MCP─► │ minimal-godot-mcp  │ ◄─LSP─► │   Godot    │
│             │         │   (TypeScript)     │         │   Editor   │
└─────────────┘         └────────────────────┘         └────────────┘

LSP Communication:

  1. Connect to Godot LSP via TCP (tries localhost ports 6007, 6005, 6008)
  2. Send LSP initialize request
  3. Sync documents with textDocument/didOpen
  4. Receive textDocument/publishDiagnostics notifications
  5. Cache and serve via MCP get_diagnostics tool

Testing

npm test          # Unit tests
npm run lint      # ESLint + Prettier

Manual testing:

  1. Start Godot with test project
  2. Run npm run dev
  3. Configure MCP client
  4. Introduce syntax error in .gd file
  5. Verify diagnostic appears

Contributing

Contributions welcome! See Development for setup.

Before submitting:

  • Run npm run format and npm test
  • Verify changes work with a real Godot project
  • Keep scope focused on diagnostics (no project manipulation)

Troubleshooting

"Connection refused on port 6007"

  • Godot editor not running
  • LSP disabled in project settings
  • Firewall blocking localhost

"No diagnostics returned"

  • File not part of Godot project
  • File not opened in editor (LSP needs context)
  • Syntax is actually valid

"Stale diagnostics"

  • Cache not invalidating on file changes
  • LSP not sending update notifications

Enable LSP Debug Logs

In Godot: Project → Project Settings → Network → Language Server → Log

Related Projects

Alternative Godot MCP servers:

License

MIT License - see LICENSE

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选