# Connect Zed to SAM.gov data

To connect Zed to SAM.gov data, add a samgovapi entry under context_servers in Zed's settings.json with url https://samgovapi.io/api/mcp and headers {"Authorization": "Bearer <your key>"}. Zed treats an entry with a url as a remote server, and the agent panel can then call the samgovapi tools.

Zed recognises remote MCP servers by their url and sends the headers you give it. Without an Authorization header Zed falls back to MCP OAuth, which this server does not offer, so the header is required for data tools.

- Connects with: MCP
- MCP server: https://samgovapi.io/api/mcp
- REST base: https://samgovapi.io/api/v1
- Auth: Authorization: Bearer <key>, kept in SAMGOVAPI_API_KEY

## Get a key

Free key at https://samgovapi.io/sign-up, or have the agent call start_signup and approve the link it shows you. Zed does not document environment variable expansion for headers, so the key is stored in settings.json. Keep that file out of shared dotfile repositories.

## Set up Zed

1. Open settings.json: Use the command palette: zed: open settings.

2. Add the server: Zed's documentation shows a literal header value; paste your key in place of the placeholder.

settings.json:

```json
{
  "context_servers": {
    "samgovapi": {
      "url": "https://samgovapi.io/api/mcp",
      "headers": {
        "Authorization": "Bearer sg_..."
      }
    }
  }
}
```

3. Check the status dot: In the Agent Panel settings, the MCP server list shows a green dot with Server is active when the connection works.

## Finish account setup once

Data tools unlock after the account answers its onboarding questions: ask the agent to set up your samgovapi account (get_onboarding_questions, then answer_onboarding). Free.

## Check that it works

Ask: "Is UEI ZXBCU6K5KL99 registered in SAM.gov, and when does its registration expire?"

Expected tool call:

```json
{"name":"registration_status","arguments":{"id":"ZXBCU6K5KL99","user_request":"check a registration and its expiry"}}
```

## Things to know

- Without the header, Zed attempts an OAuth flow and fails, because this server uses API keys.

## Troubleshooting

- Zed opens a browser for sign-in: The Authorization header is missing; add it and Zed skips OAuth.
- Red status dot: Hover it for the error. INVALID_API_KEY means the pasted key is wrong or revoked.
- ONBOARDING_REQUIRED: Ask the agent to answer the samgovapi onboarding questions once.

## Questions

### Can I keep the key out of settings.json?

Not with documented Zed features today. Use a key you can revoke from the dashboard if the file is shared.

## Official documentation

- Zed: Model Context Protocol: https://zed.dev/docs/ai/mcp

Checked 2026-11-13. All guides: https://samgovapi.io/agents.md

Independent. Not affiliated with, endorsed by or sponsored by GSA, SAM.gov or any U.S. government agency. Registering in SAM.gov is free at sam.gov.
