# Sam Gov MCP

> Sam Gov MCP is an open-source MCP server for legal and government. Search SAM.gov federal contract opportunities, read-only, with your own free API key. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted
- **Repository:** https://github.com/itcustomsolution/sam-gov-mcp
- **MCP Registry name:** io.github.itcustomsolution/sam-gov-mcp
- **Categories:** [legal and government](https://ai-powered.com/categories/legal-and-government)
- **Listing updated:** 2026-11-18

## About

Every call is a single request to the SAM.gov Get Opportunities API, and the server is strict about what comes back. A reply that does not match the documented format, or a notice lookup that returns a different or ambiguous record, becomes a tool error instead of an empty or unrelated success. The API key is never logged and is redacted from errors and links.

Three tools are listed. search_opportunities filters by posted date range (up to one year, default 30 days), title keywords, NAICS code, set-aside, state and page size, returning one page per call with pagination details. get_opportunity fetches a notice by ID, and list_set_aside_codes explains set-aside codes. Results are summarised to fields such as title, agency, posted date, response deadline, set-aside, NAICS and a link.

A caveat from the README: an unrecognised key was observed to produce an empty 404, so a wrong key looks like zero results. Awards, entity lookup, attachment downloads and bid scoring are out of scope. It needs Node.js 22 and is MIT licensed.

## Features

- **Opportunity search:** Filter by dates, keywords, NAICS, set-aside and state.
- **Notice lookup:** Fetch one notice by ID, as the API returns it.
- **Set-aside codes:** List codes and their meanings.
- **Pagination info:** Each page reports whether more results exist and the next offset.
- **Loud failures:** Malformed or mismatched replies raise tool errors.
- **Key redaction:** The API key never appears in logs, errors or links.

## Good for

- Find small-business set-aside notices for a NAICS code
- Track new federal opportunities in one state
- Look up a notice by its ID
- Prepare a shortlist before manual bid review

## Install

### Claude Code (Terminal)

```sh
claude mcp add sam-gov-mcp --env SAM_API_KEY='<SAM_API_KEY>' -- npx -y @itcustomsolution/sam-gov-mcp
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "sam-gov-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@itcustomsolution/sam-gov-mcp"
      ],
      "env": {
        "SAM_API_KEY": "<SAM_API_KEY>"
      }
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "sam-gov-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@itcustomsolution/sam-gov-mcp"
      ],
      "env": {
        "SAM_API_KEY": "<SAM_API_KEY>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "sam-gov-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@itcustomsolution/sam-gov-mcp"
      ],
      "env": {
        "SAM_API_KEY": "<SAM_API_KEY>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "sam-gov-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@itcustomsolution/sam-gov-mcp"
      ],
      "env": {
        "SAM_API_KEY": "<SAM_API_KEY>"
      }
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "sam-gov-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@itcustomsolution/sam-gov-mcp"
      ],
      "env": {
        "SAM_API_KEY": "<SAM_API_KEY>"
      }
    }
  }
}
```

## Tools

- `search_opportunities`: Searches notices, one page per call, with date, keyword, NAICS, set-aside and state filters.
- `get_opportunity`: Returns the notice record for one notice ID.
- `list_set_aside_codes`: Lists set-aside codes and their meanings.

## FAQ

### Do I need an API key?

Yes, a free SAM.gov key set as SAM_API_KEY.

### Does it rank opportunities?

No. It returns what SAM.gov returns, summarised.

### What is the date limit?

Searches need a posted-date range of one year or less.

### Why do I get no results?

Check the key first; an unrecognised key was observed to return an empty reply.

### Is Sam Gov MCP free?

Yes. Sam Gov MCP is open source, so you can use and self-host it for free.

### How do I add Sam Gov MCP to Claude Code?

Run this command in your terminal: claude mcp add sam-gov-mcp --env SAM_API_KEY='<SAM_API_KEY>' -- npx -y @itcustomsolution/sam-gov-mcp

### What are the best alternatives to Sam Gov MCP?

The closest alternatives to Sam Gov MCP are Cipo, Data Ny, Datos Gob Es, Datos Cl and Data Govt Nz.

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [Cipo](https://ai-powered.com/mcp/cipo): Cipo is a freemium MCP server for legal and government.
- [Data Ny](https://ai-powered.com/mcp/data-ny): Data Ny is a freemium MCP server for legal and government.
- [Datos Gob Es](https://ai-powered.com/mcp/datos-gob-es): Datos Gob Es is a freemium MCP server for legal and government.
- [Datos Cl](https://ai-powered.com/mcp/datos-cl): Datos Cl is a freemium MCP server for legal and government.
- [Data Govt Nz](https://ai-powered.com/mcp/data-govt-nz): Data Govt Nz is a freemium MCP server for legal and government.
- [Data Cityofchicago](https://ai-powered.com/mcp/data-cityofchicago): Data Cityofchicago is a freemium MCP server for legal and government.
- [Data Europa](https://ai-powered.com/mcp/data-europa): Data Europa is a freemium MCP server for legal and government.
- [Licenses](https://ai-powered.com/mcp/licenses): Licenses is a freemium MCP server for legal and government.

---
Source: https://ai-powered.com/mcp/sam-gov-mcp
