sangsik-gdscript-graph

sangsik-gdscript-graph

A function-level call-graph indexer for GDScript/Godot projects, exposed as an MCP server so AI coding assistants can answer questions like 'what calls this function?' or 'what would break if I change this signal?' without re-reading the whole codebase.

Category
Visit Server

README

sangsik-gdscript-graph

A function-level call-graph indexer for GDScript/Godot projects, exposed as an MCP server so AI coding assistants can answer questions like "what calls this function?" or "what would break if I change this signal?" without re-reading the whole codebase.

It parses every .gd file in a Godot project with gdtoolkit's GDScript grammar, resolves calls and signal connections across files (autoloads, class_name, inheritance, inner classes, lambdas, property accessors, chained signal receivers, etc.), and stores the result in a SQLite database that the MCP server queries on demand.

Features

  • Call resolution across bare calls, self. calls, super. calls, autoloads, class_name-typed receivers, and locally-typed variables — including inheritance chains.
  • Signal resolution for .connect(...) on both the signal side and the handler side: bare/self/inherited signals, and chained receivers (GameManager.card_drawn.connect(handler)).
  • Scoping: inner classes, property accessors (get:/set(value):), lambdas, static functions are all tracked with correct scope boundaries.
  • Robust by design: pathologically deep GDScript files are isolated (a parse/recursion failure in one file doesn't abort the whole build), builds are atomic (a failed rebuild never corrupts an existing database), and known ReDoS-prone .tscn parsing paths are hardened.
  • Transitive impact analysis: BFS over the call graph to answer "everything that calls (or is called by) this function, up to N hops."
  • Auto-sync while the server runs: an OS-level file watcher (FSEvents/inotify/ReadDirectoryChangesW) rebuilds the graph automatically a short debounce window after you edit a .gd/.tscn/project.godot file — no manual rebuild needed during a normal editing session.
  • Incremental rebuilds: each build caches every file's parsed tree (keyed by content hash); a rebuild reuses the cache for every unchanged file and only re-parses what actually changed, with output identical to a full rebuild either way. On a 433-file test project this cut rebuild time by ~3x overall (parsing itself, which dominates build time, got ~4.5x faster).
  • Reconciles offline edits on startup: a live file watcher only sees changes made after it starts, so every server start also runs one reconciliation rebuild in the background (cheap thanks to the incremental cache) to catch up on anything edited while no server was running — e.g. an MCP client spawning a fresh server each session after you edited the project in the Godot editor in between.

Installation

pip install -e .

Requires Python 3.10+.

Usage

1. Build the graph

gdscript-graph build /path/to/godot/project -o graph.db

This scans every .gd file (plus project.godot for autoloads and .tscn files for autoload scenes), resolves calls and signal connections, and writes a SQLite database to graph.db (defaults to <project>/.gdscript_graph.db if -o is omitted).

2. Run the MCP server

gdscript-graph mcp graph.db

This starts an MCP server over stdio and, by default, watches the project directory (recorded in the database at build time) for changes -- editing a .gd/.tscn/project.godot file triggers an automatic rebuild ~2 seconds after your last edit, with no restart needed. Pass --no-watch to disable this, or --debounce-ms <n> to change the delay.

Point your MCP client (Claude Code, Claude Desktop, etc.) at this command, e.g. in a Claude Code MCP config:

{
  "mcpServers": {
    "gdscript-graph": {
      "command": "gdscript-graph",
      "args": ["mcp", "/path/to/graph.db"]
    }
  }
}

Available MCP tools

Tool Description
search(query, limit=20) Substring search over functions, signals, vars, consts, and enums.
status() Index health/freshness: file/symbol/call/signal counts, last build time, and whether a watcher rebuild is currently pending or in flight.
node(name, file=None, scope=None, kind=None) A symbol's verbatim source (re-read fresh from disk) plus its callers/handlers, in one call.
explore(names, max_path_depth=6) node's detail for several symbols at once, plus the actual call path connecting each resolved pair, if one exists.
files(prefix=None) List indexed files with class_name/extends/parse_error and a symbol-count breakdown; prefix narrows to a subdirectory or file.
callers(function_name, file=None, scope=None) List call sites that call the given function.
callees(function_name, file=None, scope=None) List functions called from within the given function.
signal_handlers(signal_name, file=None, scope=None) List handlers connected to a signal via .connect(...).
impact(function_name, file=None, scope=None, direction="callers", max_depth=5) Transitively walk the call graph to find everything affected by changing a function.

file/scope disambiguate when multiple declarations share a name (same-named function in different files or inner classes).

Development

pip install -e . pytest
pytest -q

The MCP server re-reads the DB file fresh on every query, so any rebuild while the server is running (whether triggered by the file watcher or run manually) is picked up immediately without a restart.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured