New PolicyLayer is now the system of record for AI agent authority. Never answer your agent twice
Home / Integrations / Zed

Zed MCP setup: the complete config reference

Where Zed’s MCP config lives, the context_servers format, the extension and UI install paths, and how to fix the common failures — plus how to put a policy gate in front of every tool call.

QUICK ANSWERQuick answer: MCP servers go under the context_servers key in Zed’s settings.json — not mcpServers.

Where Zed keeps its MCP config.

ScopePathNotes
User (macOS/Linux) ~/.config/zed/settings.json Linux also honours $XDG_CONFIG_HOME/zed/settings.json.
User (Windows) %APPDATA%\Zed\settings.json
Project .zed/settings.json At the project root; overrides user settings for that project.

The config format, key by key.

A top-level context_servers object, one entry per server. Local servers declare a command; remote servers declare a url.

KeyWhat it does
command Executable for a local server. Zed launches without a full login shell — use an absolute path.
args Array of arguments passed to the command.
env Environment variables — set explicitly; GUI-launched Zed doesn’t inherit your shell env.
url Endpoint for a remote server.
headers HTTP headers for remote servers. Omit Authorization and Zed runs the standard MCP OAuth flow instead.
~/.config/zed/settings.json
{
  "context_servers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"],
      "env": {}
    }
  }
}

REMOTE SERVER (HTTP):

~/.config/zed/settings.json
{
  "context_servers": {
    "remote-mcp-server": {
      "url": "https://mcp.example.com/mcp",
      "headers": {
        "Authorization": "Bearer <token>"
      }
    }
  }
}

Leave out the Authorization header and Zed authenticates the remote server via the standard MCP OAuth flow.

What Zed speaks.

TransportStatusHow to declare it
stdio Supported Declare command + args.
Streamable HTTP Supported Declare url; header auth or OAuth.

Adding a server, three ways.

01 Edit settings.json

Open settings (zed: open settings) and add entries under context_servers — user-level or per-project in .zed/settings.json.

02 Agent Panel UI

Run agent: open settings (or the Agent Panel’s settings view) → Add Custom Server — a modal collects the command or URL for you.

03 MCP extensions

Install MCP servers as Zed extensions from the extension store — the extension ships the server config and appears under the same settings view.

Check it's actually connected.

  1. Open the Agent Panel settings view — each server shows an indicator dot, green with a “Server is active” tooltip when running.
  2. Ask the agent to call one of the server’s tools; approval behaviour follows your agent.tool_permissions settings.

When it doesn't work.

Server never goes green — command issues

Zed launches servers without a full login shell, so aliases and PATH additions from your dotfiles don’t apply. Use an absolute path to the binary.

Server starts but can’t find its API key

GUI-launched Zed (Dock/Finder) doesn’t inherit your shell environment — set required variables explicitly in the server’s env block.

Remote server stuck in an auth loop

No Authorization header means Zed expects to complete an OAuth flow. For token-auth servers that don’t do OAuth, supply the header explicitly.

Config seems ignored

Check the key name — it’s context_servers, not mcpServers — and remember a project’s .zed/settings.json overrides your user file.

Tool calls blocked or over-prompting

Tool approval is governed by agent.tool_permissions.default (Zed v0.224+), which replaced the old always_allow_tool_actions boolean — review it if calls behave unexpectedly.

Put a policy gate in front of it.

A standard Postgres MCP wired into Zed. Every query hits the database directly, with no audit trail and no statement-level controls.

~/.config/zed/settings.json
{
  "context_servers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"],
      "env": {}
    }
  }
}

Register the Postgres MCP in PolicyLayer, mint a grant, point Zed at the proxy URL. PolicyLayer evaluates every call against the grant’s policy before it reaches the database.

~/.config/zed/settings.json
{
  "context_servers": {
    "postgres": {
      "url": "https://proxy.policylayer.com/mcp/<server-uuid>/",
      "headers": {
        "Authorization": "Bearer <grant-token>"
      }
    }
  }
}

The <server-uuid> appears on each server's detail page. The <grant-token> shows once at mint time. See the Quick start for the full setup walk-through — and if you operate under SOC 2, HIPAA, GDPR or similar, the compliance hub maps how gateway-mediated MCP traffic evidences each framework.

What the gateway adds.

Rate limits
Cap tool calls per minute, hour, or day, per grant or shared across the team.
Access controls
Allow, deny, or conditionally gate any tool against the call's arguments.
Spend caps
Increment a counter by the call's amount; deny when the daily total exceeds your budget.
Audit logs
Every call records the grant, tool, argument keys, and the rule that decided.

A policy in practice.

Allow list_tables. Allow queries, but deny any statement containing DROP, TRUNCATE or DELETE.

policy.json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "query": {
      "deny_if": [
        {
          "conditions": [
            { "path": "args.sql", "op": "regex", "value": "(?i)(DROP|TRUNCATE|DELETE)\\s" }
          ]
        }
      ]
    },
    "list_tables": {}
  }
}

See Writing policies for the policy format, operators, and quota shapes.

Zed MCP questions.

Where do MCP servers go in Zed?+

Under the context_servers key in settings.json — ~/.config/zed/settings.json on macOS/Linux, %APPDATA%\Zed\settings.json on Windows, or per-project in .zed/settings.json. Zed kept its original key name rather than adopting mcpServers.

Does Zed support remote MCP servers?+

Yes — declare a url, with auth either as an Authorization header or, if the header is omitted, via the standard MCP OAuth flow that Zed runs automatically.

How do I know an MCP server is running in Zed?+

The Agent Panel settings view shows an indicator dot per server — green with a “Server is active” tooltip when it is healthy. A non-green dot usually means a bad command path or a startup crash.

Why does my MCP server work in the terminal but not in Zed?+

Zed launches servers without a login shell and, when started from the Dock, without your shell environment. Use absolute paths for the command and set env vars explicitly in the env block.

How does Zed decide whether to ask before running a tool?+

Via agent.tool_permissions.default in settings (Zed v0.224+). That is a client-side prompt, though — for deterministic rules on tool arguments, rate limits and audit logs, route the server through a policy gateway like PolicyLayer.

Take your agents live. Without losing control.

Route your MCP traffic through PolicyLayer. Every tool call is checked against your policy before it runs: allow, deny, or require approval. Per-identity grants. Full audit log. Live in minutes.

Instant setup, no code required.

46,500+ MCP servers and 515,000+ tools scanned and risk-classified.

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.