UnityIndexMCP
Provides ranked code search, C# symbol/reference queries, file outlines, related Unity assets, and bounded snippets for Unity projects through a local read-only MCP server.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@UnityIndexMCPfind all references to the PlayerHealth class"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
UnityIndexMCP
UnityIndexMCP is a local, read-only Model Context Protocol (MCP) server for Unity projects. It gives AI coding clients ranked code search, C# symbols, references, outlines, related Unity assets, and bounded snippets without sending project files to a hosted indexing service.
The lexical index supports C#, UXML, USS, shaders, assembly definitions, JSON, YAML, project settings, and package manifests. An optional .NET/Roslyn worker adds accurate C# symbol, reference, and implementation queries when Unity has generated a solution.
Features
Local SQLite/FTS5 index with live file watching
Unity-aware discovery for
Assets,Packages, andProjectSettingsRoslyn semantic analysis with graceful lexical fallback
Bounded, ranked results designed to reduce agent context usage
Multiple configurable Unity project roots
Stdio transport with no network listener, telemetry, or write tools
Windows, macOS, and Linux support wherever Node.js and .NET are available
Related MCP server: Repo Interrogator
Requirements
Node.js 22 or newer
npm 9 or newer
.NET 8 SDK for full semantic mode (optional, recommended)
A Unity project with
Assets/andProjectSettings/A Unity-generated
.slnor.slnxfor full semantic mode
Unity 6 is the primary target. The lexical index can also work with older Unity projects that use the same project layout; Roslyn compatibility depends on the generated solution and installed SDKs.
Install
Clone and build the server in a tools directory outside the Unity project:
git clone https://github.com/zloybest/UnityIndexMCP.git
cd UnityIndexMCP
npm ci
npm run build
npm run build:workernpm run build:worker is optional. Without it, UnityIndexMCP continues in degraded semantic mode and all lexical tools remain available.
On Windows, stop connected MCP clients before rebuilding an existing worker; a running dotnet process locks dist/worker/UnityCodeIndex.Worker.dll.
Configure a Unity project
Copy unity-index-mcp.config.example.json to the root of the Unity project as unity-index-mcp.config.json. The portable minimum is:
{
"projectRoots": ["."]
}Relative paths are resolved from the configuration file. If solutionPath is omitted, the server looks for a .sln or .slnx in the first project root. Each Unity project should normally use its own config and index database.
You may instead omit the config and set UNITY_PROJECT_ROOT to the Unity project directory. Use UNITY_INDEX_CONFIG when the MCP client starts outside the project directory:
UNITY_INDEX_CONFIG=/absolute/path/to/MyGame/unity-index-mcp.config.jsonConfiguration reference
Setting | Default | Meaning |
| required | Allowed Unity project directories |
| auto-detected | Unity-generated |
|
| SQLite index, relative to the first project root |
|
| Enable the optional Roslyn worker |
|
| Worker path, relative to the UnityIndexMCP install |
|
| Index embedded/local package source |
|
| Index Unity's generated package cache |
|
| Incrementally index file changes |
See the example config for search, exclusions, logging, and other settings.
Connect an MCP client
Use absolute paths in client configuration. Keep the server installation path and Unity project config path separate.
Codex / ChatGPT desktop app
The quickest Codex CLI setup is:
codex mcp add unity-index \
--env UNITY_INDEX_CONFIG=/absolute/path/to/MyGame/unity-index-mcp.config.json \
-- node /absolute/path/to/UnityIndexMCP/dist/mcp/server.jsOr add the contents of codex-mcp-config.example.toml to ~/.codex/config.toml (or .codex/config.toml in a trusted project), then restart the client. The ChatGPT desktop app, Codex CLI, and Codex IDE extension share that configuration; see the official OpenAI MCP setup documentation for current client details.
Claude Desktop and other JSON-configured clients
{
"mcpServers": {
"unity-index": {
"command": "node",
"args": ["/absolute/path/to/UnityIndexMCP/dist/mcp/server.js"],
"env": {
"UNITY_INDEX_CONFIG": "/absolute/path/to/MyGame/unity-index-mcp.config.json"
}
}
}
}Restart the MCP client after changing its configuration. Call index_status first; initial indexing runs in the background.
Tools
Tool | Purpose |
| Index health, freshness, and semantic mode |
| Project statistics, assemblies, and notable files |
| Full or incremental reindex |
| Ranked full-text search across supported files |
| C# declarations by name |
| Compact type/member structure |
| Bounded source range within configured roots |
| C# references with Roslyn or lexical fallback |
| Implementations and derived types |
| Related code, UXML, USS, and configuration files |
| Similar patterns and implementations |
| Likely minimal file set for a described change |
AGENT_INSTRUCTIONS.md contains a reusable workflow prompt for clients that do not consume the server's MCP instructions.
Semantic modes
Mode | Behavior |
| Roslyn loaded the Unity solution; semantic references and implementations are available |
| The worker or solution is unavailable; lexical search, outlines, and heuristics remain available |
| Semantic indexing is disabled in configuration |
If the mode remains degraded, open the Unity project once, confirm its solution exists, build the worker, and verify solutionPath if auto-detection is not sufficient.
Updating without breaking existing projects
The public product and solution are named UnityIndexMCP, but compatibility identifiers remain unchanged:
npm package and executable:
unity-index-mcpMCP server/config key:
unity-indexconfig files:
unity-index-mcp.config.jsonand.unity-index-mcp.jsonenvironment variables:
UNITY_INDEX_CONFIGandUNITY_PROJECT_ROOTworker assembly:
UnityCodeIndex.Worker.dll
Existing client configurations that point at a checkout directory named KebabIndex continue to work because the local directory is not moved automatically. To update safely, stop MCP clients, pull changes, run npm ci, npm run build, and optionally npm run build:worker, then restart the clients. Existing per-project configs and SQLite indexes do not need migration.
Development
npm ci
npm test -- --runInBand
npm run build
dotnet build UnityIndexMCP.sln -c ReleaseIntegration tests use the repository's sample Unity project and do not require a Unity installation. See CONTRIBUTING.md before submitting a change.
Security and privacy
UnityIndexMCP exposes only local stdio, has no write tools, makes no cloud calls, and restricts file reads to configured roots. The index stores source-derived text locally in the configured SQLite database, so exclude that database from source control and protect it like source code. See SECURITY.md for reporting vulnerabilities.
Limitations
Full semantic analysis requires a Unity-generated solution and the .NET worker.
Scene and prefab YAML are lexically searchable but serialized object references are not semantically linked.
UTF-8 is expected; UTF-16 and unusual encodings may not index correctly.
Large projects may take several minutes to build their first index.
Multiple roots share one database; identical root-relative paths can be ambiguous in tool output.
License
MIT. Unity is a trademark of Unity Technologies. This project is independent and is not affiliated with or endorsed by Unity Technologies.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceEnables AI clients to perform local code search, indexing, and analysis across Java, JavaScript/TypeScript, .NET/C#, and Python projects through the MCP protocol.2Apache 2.0
- AlicenseAqualityAmaintenanceA local-first MCP server that enables AI tools to safely inspect and search code repositories, providing indexing, deterministic BM25 search, code outlining, and context bundles without code modification.91MIT
- Alicense-qualityBmaintenanceMCP server for local-first lexical code search, providing tools for searching code, finding symbols, and reading chunks from indexed repositories.MIT
- Alicense-qualityAmaintenanceRead-only MCP server that provides AI agents with context about Unity project relationships, including scenes, prefabs, scripts, GUIDs, and code impact analysis.2Apache 2.0
Related MCP Connectors
A MCP server built for developers enabling Git based project management with project and personal…
An MCP server that gives your AI access to the source code and docs of all public github repos
An MCP server for deep research or task groups
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/zloybest/UnityIndexMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server