# Connect Cursor to SAM.gov data

To connect Cursor to SAM.gov data, add a samgovapi entry to ~/.cursor/mcp.json (or .cursor/mcp.json in a project) with url https://samgovapi.io/api/mcp and headers {"Authorization": "Bearer ${env:SAMGOVAPI_API_KEY}"}. Cursor picks Streamable HTTP from the url, and its agent can then call registration_status, search_opportunities and the other tools.

Cursor reads environment variables into mcp.json with ${env:NAME}, so a project file can be committed while each developer keeps their own key. It suits teams building contracting software: the agent can check a real UEI while it writes the code that will check thousands.

- 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. Reference ${env:SAMGOVAPI_API_KEY} in the header. Cursor also expands it in url, command, args and env.

## Set up Cursor

1. Set the variable: Remote servers in Cursor do not read envFile, so the variable has to be in the environment Cursor starts from (log out and in, or launch Cursor from the shell).

Shell:

```bash
export SAMGOVAPI_API_KEY="sg_..."
```

2. Add the server: Use ~/.cursor/mcp.json for every project, or .cursor/mcp.json for one repository.

~/.cursor/mcp.json:

```json
{
  "mcpServers": {
    "samgovapi": {
      "url": "https://samgovapi.io/api/mcp",
      "headers": {
        "Authorization": "Bearer ${env:SAMGOVAPI_API_KEY}"
      }
    }
  }
}
```

3. Turn it on: Open Cursor's MCP settings and check the samgovapi toggle is on. Connection details are in the Output panel under MCP Logs.

## 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

- Agent mode is where Cursor calls MCP tools; plain chat may not.

## Troubleshooting

- The server shows no tools: Open Output, MCP Logs. A 401 or INVALID_API_KEY means the variable was empty when Cursor started.
- Cursor asks before every call: That is Cursor's tool approval. Approve per call or allow the samgovapi tools in its settings.
- ONBOARDING_REQUIRED: Ask the agent to answer the samgovapi onboarding questions once.

## Questions

### Does Cursor need a transport field?

No. A url means a remote server; Cursor negotiates Streamable HTTP.

## Official documentation

- Cursor: Model Context Protocol: https://cursor.com/docs/context/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.
