Skip to main content
Glama

sam-gov-mcp

An MCP server that lets AI assistants (Claude Desktop, Cursor, and other MCP clients) search SAM.gov contract opportunities through the public SAM.gov Get Opportunities API.

  • Read-only. It only searches and reads public notices.

  • Bring your own key. You supply a free SAM.gov API key in SAM_API_KEY. The key is never logged and is redacted from errors and returned links.

  • No ranking or scoring. It returns what SAM.gov returns, summarized.

Quickstart

  1. Get a free API key: sign in at sam.gov → Account Details → API Key.

  2. Install. Claude Code:

    claude mcp add sam-gov -e SAM_API_KEY=your-key-here -- npx -y @itcustomsolution/sam-gov-mcp

    Or run it directly: SAM_API_KEY=your-key-here npx -y @itcustomsolution/sam-gov-mcp

  3. Add it to your MCP client. Claude Desktop (claude_desktop_config.json):

    {
      "mcpServers": {
        "sam-gov": {
          "command": "npx",
          "args": ["-y", "@itcustomsolution/sam-gov-mcp"],
          "env": { "SAM_API_KEY": "your-key-here" }
        }
      }
    }
  4. Ask: "Find small-business set-aside opportunities for NAICS 541512 posted in the last 30 days in Maryland."

Related MCP server: Government Contracts MCP

Tools

Tool

What it does

Inputs

search_opportunities

Search notices

posted_from, posted_to (optional, default last 30 days; YYYY-MM-DD or MM/DD/YYYY, max 1-year range), keywords (title), naics, set_aside, state, limit (1–100, default 10), offset

get_opportunity

Full JSON for one notice

notice_id (looks back 1 year)

list_set_aside_codes

Set-aside codes and meanings

none

Search results are summarized to: noticeId, title, solicitationNumber, agency, postedDate, responseDeadline, type, setAside, naics, state, uiLink.

Scope and limits

  • SAM.gov requires a posted-date range of 1 year or less on every search; the server validates this before calling the API.

  • Public API keys have daily rate limits set by GSA. Errors from SAM.gov are passed back as tool errors (with the key redacted).

  • Out of scope: entity/UEI lookup, award data, attachments download, bid/no-bid scoring.

Security notes

  • SAM.gov requires the key as an api_key query parameter, so it travels in the request URL to api.sam.gov over HTTPS. The server redacts it from errors, links, and returned JSON, but anything that logs full URLs (an HTTP proxy, for example) would see it.

  • Notice titles and descriptions are third-party text. Treat them as data, not instructions (prompt injection).

  • Responses over 5 MB are refused and requests time out after 30 s.

Development

npm install
npm test        # vitest, HTTP fully mocked, no key needed
npm run build

Never commit a real key. .env is git-ignored.

License

MIT © IT Custom Solution

Available Tools

3 tools
get_opportunityGet SAM.gov opportunityA

Get full details of one opportunity by noticeId (searches the last year of postings).

ParametersJSON Schema
NameRequiredDescriptionDefault
notice_idYesSAM.gov noticeId

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden, and it does disclose a real behavioral constraint: results are limited to the last year of postings. However, it says nothing about authentication requirements, not-found behavior, or rate limits, so the disclosure is partial.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One tight sentence that front-loads the action and the identifying parameter, with the scope caveat in parentheses. Nothing is wasted or buried.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-record fetch with no output schema, the description should convey what 'full details' entails, but it leaves the return shape entirely unspecified. Combined with zero annotation coverage, the definition is functional but leaves the agent guessing about the payload and error cases.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There is a single required parameter with 100% schema description coverage, so the schema already documents noticeId fully. The description adds no format or sourcing detail (e.g., where to obtain the ID) beyond the schema, making the baseline 3 appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource (get full details of one opportunity) and identifies the key input (noticeId), which is clearly distinct from the sibling search_opportunities. It does not explicitly name the sibling it contrasts with, but the singular-vs-search distinction is obvious.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied rather than stated: fetching a single record by ID naturally follows a search that yields that ID, and no alternative or exclusion is named. It adds a useful scoping hint (only the last year of postings) but gives no explicit when-to-use/when-not-to-use guidance relative to search_opportunities.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_set_aside_codesList set-aside codesA

List SAM.gov set-aside codes and their meanings.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden, but the operation is a trivial zero-parameter read of static reference data, so little disclosure is required. It states what is returned (codes and meanings) but says nothing about completeness, caching, or format.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with no filler; the resource and its payload are stated immediately and nothing is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple, zero-parameter reference lookup with no output schema and no annotations, the description is sufficient to call the tool correctly. Only the exact return shape is unspecified, which is a minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes zero parameters, so there is nothing to document; the baseline for a no-parameter tool is 4. The description adds no parameter guidance because none is possible.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('List SAM.gov set-aside codes') plus the returned content (their meanings). This clearly distinguishes it from the opportunity-centric siblings, though it never explicitly names them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: an agent infers this is a reference lookup to use when interpreting a set-aside code. There is no explicit when-to-use statement, no mention of alternatives, and no exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_opportunitiesSearch SAM.gov opportunitiesA

Search SAM.gov contract opportunities. Read-only. Posted date range is required (max 1 year).

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMax results (default 10)
naicsNoNAICS code, e.g. 541512
stateNoPlace of performance state, 2-letter code
offsetNo
keywordsNoWords to match in the opportunity title
posted_toYesEnd date, YYYY-MM-DD or MM/DD/YYYY
set_asideNoSet-aside code, e.g. SBA, 8A, SDVOSBC (see list_set_aside_codes)
posted_fromYesStart date, YYYY-MM-DD or MM/DD/YYYY

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden; it does disclose 'Read-only' and the required date-range constraint, which is real behavioral value. However, it says nothing about pagination behavior, result caps, or auth/rate limits, leaving meaningful gaps for a search tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences, zero waste, with the core purpose and the hard requirement front-loaded. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and no annotations, the description must carry more weight. It covers purpose, read-only status, and the required range, but omits pagination (offset/limit) behavior and any note on result shape, leaving an agent partially equipped.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is high (88%), so the schema already documents most parameters, and a baseline of 3 applies. The description adds the 'max 1 year' range constraint not present in the schema, but does not explain the undocumented offset parameter or clarify limit defaults beyond what the schema states.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ('Search') and resource ('SAM.gov contract opportunities'), which naturally contrasts with the singular sibling get_opportunity. It does not explicitly name alternatives, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives one concrete usage constraint — a posted date range is required and capped at 1 year — but offers no guidance on when to prefer this over get_opportunity or how list_set_aside_codes fits in. Usage is implied rather than spelled out.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.0
    • First observedget_opportunity
    • First observedlist_set_aside_codes
    • First observedsearch_opportunities

TDQS

A4/5.0

Scored across 3 tools

Disambiguation5/5

search_opportunities and get_opportunity are clearly distinguished by action and input (query vs noticeId), and list_set_aside_codes is a separate reference function. No overlapping purposes or ambiguous boundaries.

Naming Consistency5/5

All names follow a consistent snake_case verb_noun pattern: search_opportunities, get_opportunity, list_set_aside_codes. The convention is predictable and readable.

Tool Count5/5

Three tools are well-scoped for a focused read-only SAM.gov opportunity server; search, detail retrieval, and set-aside reference each earn their place. The count is minimal but not thin given the narrow domain.

Completeness4/5

The surface covers the core read-only workflow: find opportunities, retrieve one by ID, and decode set-aside codes. Minor gaps exist (e.g., other reference lists like NAICS or agency filters), but no critical dead ends for the stated purpose.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Search and analyze U.S. federal government contracts and opportunities from SAM.gov. Tools for keyword search, contract details, competitive analysis, and capability statement drafting — built for AI agents via x402 USDC micropayments.
    3
    2
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables AI agents to search and analyze federal government contract opportunities and awards from SAM.gov and USASpending.gov, with tools for contract search, detail, agency spending, and trending sectors.
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to search federal contracts, analyze agency spending, track competitor wins, and monitor small business set-aside opportunities using SAM.gov, USASpending.gov, and FPDS data.
    -
  • F
    license
    A
    quality
    C
    maintenance
    MCP server for querying SAM.gov federal contract opportunities, providing precise search, retrieval, and attachment tools with full source traceability and explicit abstention when data is absent.
    5
    -