# Connect n8n to SAM.gov data

To connect n8n to SAM.gov data, attach an MCP Client Tool to your AI Agent node with Server Transport set to HTTP Streamable, Endpoint https://samgovapi.io/api/mcp and a Bearer Auth credential holding your key. For fixed jobs without an agent, call the REST API from an HTTP Request node with a Header Auth credential.

n8n covers both kinds of job: an AI Agent that decides which lookups to make, and plain scheduled workflows such as a morning bid digest. Both use credentials, so the key never sits in a node's visible fields.

- Connects with: MCP or REST
- 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. Keep the key in an n8n credential; exported workflows reference credentials by name and do not include their values.

## Set up n8n

1. Create the credential: Bearer Auth needs one field, the token. For the HTTP Request node, Header Auth with name Authorization and value Bearer followed by the key works the same way.

2. Agent route: MCP Client Tool: Add an AI Agent node, then attach the MCP Client Tool. Set Server Transport to HTTP Streamable, Endpoint to the server URL, Authentication to Bearer Auth, and Tools to Include to Selected to pick a few tools.

3. Workflow route: HTTP Request: For a fixed query, call the REST API directly.

HTTP Request node:

```
Method: GET
URL: https://samgovapi.io/api/v1/opportunities
Authentication: Generic Credential Type > Header Auth
Query Parameters:
  naics  541512
  open   true
  limit  25
```

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

- If your MCP Client Tool node only offers an SSE Endpoint field, update n8n and add a fresh node: older node versions predate HTTP Streamable.

## Troubleshooting

- Only SSE is offered: Update n8n; HTTP Streamable arrived in newer node versions.
- HTTP Request returns 401: Check the Header Auth value starts with Bearer and a space.
- ONBOARDING_REQUIRED from the agent: Answer the onboarding questions once for the account; REST calls are not gated by it.

## Questions

### Agent or plain workflow?

Use the plain HTTP Request node when the query never changes; it is cheaper and predictable. Use the agent when the question varies.

## Official documentation

- n8n: MCP Client Tool node: https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolmcp/
- n8n: HTTP Request credentials: https://docs.n8n.io/integrations/builtin/credentials/httprequest/

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.
