Skip to content

Set Up Forge with Zed

import { Aside, Tabs, TabItem } from ‘@astrojs/starlight/components’;

Zed supports MCP servers through its language model configuration. Forge connects as a local MCP server, adding code intelligence tools to Zed’s AI assistant. Configuration lives in Zed’s global settings file.

  • Forge installed and on your PATH (forge --version returns a version string)
  • At least one repo indexed (forge index /path/to/repo)
  • Zed installed (version 0.141 or later — MCP support was added in 0.141)

If you haven’t installed Forge yet, see Install Forge.

Open your Zed settings file:

  • macOS: ~/.config/zed/settings.json
  • Linux: ~/.config/zed/settings.json

Add the context_servers key (Zed’s term for MCP servers):

{
"context_servers": {
"forge": {
"command": {
"path": "forge",
"args": ["serve", "/absolute/path/to/your/repo", "--watch"],
"env": {}
}
}
}
}

Replace /absolute/path/to/your/repo with the absolute path to the repo you indexed.

{
"context_servers": {
"forge-frontend": {
"command": {
"path": "forge",
"args": ["serve", "/home/you/repos/frontend", "--watch"],
"env": {}
}
},
"forge-backend": {
"command": {
"path": "forge",
"args": ["serve", "/home/you/repos/backend", "--watch"],
"env": {}
}
}
}
}

Each context server runs as an independent forge serve process. Tools from all servers are available in Zed’s assistant.

After editing settings.json, Zed picks up changes automatically — no restart required. Open the assistant panel (Ctrl+? or the assistant icon in the toolbar) to see the updated tool list.

Open the Zed assistant panel and ask:

What context server tools do you have available?

Expected response includes Forge’s 21 tools listed by category. If you see them, Forge is connected.

Test with a real query:

Use forge_search to find all usages of the word “checkout” in this repo.

Zed’s assistant calls forge_search and returns matching file paths and line numbers.

While Zed doesn’t support per-project MCP configs in settings.json, you can scope the repo path by editing settings.json when switching projects. A faster approach: use a monorepo root as the Forge path and use Forge’s ignored_paths config to filter irrelevant packages.

See Configure Monorepo for details.

context_servers key not recognized Some older Zed builds used a different key name (mcp_servers or language_models.mcp_servers). The canonical key as of Zed 0.141+ is context_servers. Update Zed if the key isn’t working.

Forge tools don’t appear in the assistant Verify the forge binary is accessible from the PATH that Zed uses. On macOS with Zed launched from the dock:

{
"context_servers": {
"forge": {
"command": {
"path": "/usr/local/bin/forge",
"args": ["serve", "/absolute/path/to/repo", "--watch"],
"env": {}
}
}
}
}

Run which forge in a terminal to confirm the absolute path.

“Index not found” errors The path in args must match where forge index was run. If you indexed /home/you/repos/myapp, pass that exact path to forge serve.