# Government Contracts & Procurement MCP Server (`martc03/gov-contracts-mcp`) Actor

MCP server for federal procurement data. Gives AI assistants access to SAM.gov contract opportunities, USASpending.gov award data, and entity registration lookups.

- **URL**: https://apify.com/martc03/gov-contracts-mcp.md
- **Developed by:** [CoDee](https://apify.com/martc03) (community)
- **Categories:** AI, Integrations
- **Stats:** 11 total users, 0 monthly users, 0.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Government Contracts & Procurement MCP Server

Search federal contract opportunities on SAM.gov, explore USASpending.gov award data, and look up registered government entities through a single MCP interface. This server gives AI assistants direct access to the federal procurement ecosystem, enabling businesses, researchers, and analysts to discover contract opportunities, track government spending, and verify entity registrations.

Small businesses pursuing government contracts, grant writers researching agency spending patterns, and journalists investigating federal procurement can all query these authoritative databases through natural language prompts.

### Available Tools

#### `contracts_search_opportunities`

Search SAM.gov for active and recent federal contract opportunities, including solicitations, pre-solicitations, and award notices.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyword` | string | No | Keyword search across opportunity titles and descriptions |
| `naicsCode` | string | No | NAICS industry code (e.g., "541512" for computer systems design) |
| `postedFrom` | string | No | Start date in MM/DD/YYYY format |
| `postedTo` | string | No | End date in MM/DD/YYYY format |
| `limit` | number | No | Maximum results to return (default: 10) |
| `offset` | number | No | Results offset for pagination |

**Returns**: Notice ID, title, solicitation number, department, office, posted date, notice type, response deadline, NAICS code, set-aside type, description, and direct SAM.gov link.

> **Note**: This tool requires a SAM.gov API key. You can obtain one for free at [sam.gov](https://sam.gov).

#### `contracts_search_spending`

Search USASpending.gov for federal award and spending data across contracts, grants, loans, and other financial assistance.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyword` | string | No | Keyword search across award descriptions and recipients |
| `awardType` | string | No | Award type: `contracts`, `grants`, `loans`, `direct_payments`, `other` |
| `dateFrom` | string | No | Start date in YYYY-MM-DD format |
| `dateTo` | string | No | End date in YYYY-MM-DD format |
| `agency` | string | No | Awarding agency name |
| `limit` | number | No | Maximum results to return (default: 10) |
| `page` | number | No | Page number for pagination |

**Returns**: Award ID, recipient name, award amount, awarding agency, sub-agency, award type, start and end dates, and award description.

> **Note**: This tool works without any API key.

#### `contracts_lookup_entity`

Look up entities registered in SAM.gov, including their registration status, CAGE codes, and NAICS codes.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `legalBusinessName` | string | No | Legal business name to search |
| `ueiSAM` | string | No | Unique Entity Identifier (UEI) |
| `cageCode` | string | No | CAGE / NCAGE code |
| `state` | string | No | Two-letter state code (e.g., "VA", "CA") |
| `limit` | number | No | Maximum results to return (default: 10) |

**Returns**: Legal business name, UEI, CAGE code, registration status, registration expiration date, physical address, and NAICS codes.

> **Note**: This tool requires a SAM.gov API key. You can obtain one for free at [sam.gov](https://sam.gov).

### How to Connect

Add this server to your MCP client configuration:

```json
{
  "mcpServers": {
    "gov-contracts": {
      "type": "url",
      "url": "https://gov-contracts-mcp.apify.actor/mcp"
    }
  }
}
```

Compatible with Claude Desktop, Cursor, Windsurf, and any MCP-compatible client.

### Example Prompts

- "Find open contract opportunities for cybersecurity services on SAM.gov."
- "How much has the Department of Defense spent on AI contracts this year?"
- "Look up the SAM.gov registration for Lockheed Martin."
- "Search for small business set-aside contracts in NAICS code 541512."
- "Show me the largest grants awarded by the Department of Energy in 2024."
- "Is there a company with CAGE code 1XYZ3 registered in SAM.gov?"

### Pricing

This actor charges **$0.01 per tool call**. Each search query counts as one tool call regardless of the number of results returned.

### Data Sources

All data is sourced from official US government APIs:

- **SAM.gov Opportunities API** -- [api.sam.gov](https://api.sam.gov) -- Federal contract opportunities, solicitations, and award notices. Requires a free API key from [sam.gov](https://sam.gov).
- **USASpending.gov API** -- [api.usaspending.gov](https://api.usaspending.gov) -- Federal spending data including contracts, grants, loans, and other financial assistance. No API key required.
- **SAM.gov Entity Management API** -- [api.sam.gov](https://api.sam.gov) -- Registered entity data including UEI, CAGE codes, and registration status. Requires a free API key from [sam.gov](https://sam.gov).

# Actor input Schema

## `samApiKey` (type: `string`):

API key from SAM.gov (register free at https://sam.gov/content/entity-registration). Required for SAM.gov tools. USASpending tools work without a key.

## Actor input object example

```json
{}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("martc03/gov-contracts-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("martc03/gov-contracts-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call martc03/gov-contracts-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,martc03/gov-contracts-mcp"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/12KQ6Z6RgGF9PYox4/builds/PMyNDpuHLN1E45Brb/openapi.json
