# US Federal RFP/SOW Compliance Parser (SAM.gov & MCP) (`ramosdeluis/us-govcon-rfp-compliance-parser`) Actor

Deterministically parse SAM.gov federal RFP/SOW PDFs, DOCX, and ZIPs into structured JSON: FAR/DFARS clauses, Section L/M criteria, CLIN tables, security clearances, and USAspending.gov incumbent history. Zero LLM hallucinations, MCP-ready, Pay-per-event.

- **URL**: https://apify.com/ramosdeluis/us-govcon-rfp-compliance-parser.md
- **Developed by:** [Luís Alberto Ramos](https://apify.com/ramosdeluis) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $45.00 / 1,000 federal rfp/sow compliance parse

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## US Federal Solicitation RFP/SOW Compliance Parser (`us-govcon-rfp-compliance-parser`)

**Deterministic US GovCon RFP/SOW compliance shredding for SAM.gov solicitations — built for GovCon capture teams, proposal managers, and autonomous AI agents via the Apify MCP Server.**

[![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3120/)
[![Apify Actor](https://img.shields.io/badge/Apify-Pay--Per--Event-00C48C.svg)](https://apify.com)
[![MCP Ready](https://img.shields.io/badge/Apify%20MCP-Native%20Tool-6E56CF.svg)](https://mcp.apify.com)
[![DevSecOps](https://img.shields.io/badge/DevSecOps-Zero%20Suppressions-111827.svg)](#security--devsecops-hardening)

***

### Why This Actor Exists (The Deterministic Code-Moat)

Federal solicitations on SAM.gov bundle critical compliance requirements inside multi-hundred-page PDFs, Word (`.docx`) Statements of Work, and nested `.zip` solicitation packages. Pure LLM scrapers hallucinate clause numbers, miss Section L page limits, and choke on malformed archives.

**US Federal Solicitation RFP/SOW Compliance Parser** executes a **deterministic, zero-hallucination Python parsing engine** backed by official federal data contracts (`api.sam.gov` / `sam.gov` and `api.usaspending.gov`):

1. **Normalized FAR & DFARS Clauses:** Extracts and enriches canonical citations (e.g., `FAR 52.212-4`, `FAR 52.217-8`, `FAR 52.219-14`, `DFARS 252.204-7012`, `DFARS 252.204-7021` CMMC, `DFARS 252.239-7010`) with compliance categories.
2. **Section L (Instructions) & Section M (Evaluation Factors):** Automatically skips Table of Contents dot-leaders, slices UCF Sections L and M, and extracts volume page limits, LPTA vs. Best Value Tradeoff methodologies, and evaluation weights.
3. **Security Clearances, NAICS & Set-Asides:** Identifies Facility Clearance (FCL / DD Form 254) and Personnel Clearance requirements (`Public Trust`, `Confidential`, `Secret`, `Top Secret`, `TS/SCI`, `Polygraph`), valid 6-digit US NAICS codes, and socioeconomic Set-Asides (`8(a)`, `SDVOSB`, `VOSB`, `HUBZone`, `WOSB`, `EDWOSB`, `Total Small Business`).
4. **CLIN Schedules & Period of Performance:** Parses structured PDF (`pdfplumber`) and DOCX (`python-docx`) CLIN tables (`0001`, `1001`, descriptions, quantities, units, contract types `FFP`/`T&M`/`LH`/`CPFF`, base & option periods) plus normalized ISO-8601 deadlines.
5. **USAspending.gov Incumbent Intelligence:** Cross-references `api.usaspending.gov` to surface historical award winners, contract values, and award dates for competitive capture positioning.

***

### Input Schema (Apify & Native MCP Safe)

Pass 1 to 25 SAM.gov notice IDs or allowlisted HTTPS SAM.gov solicitation URLs per run:

```json
{
  "queries": [
    "abc123def456",
    "https://sam.gov/opp/987654fedcba/view"
  ],
  "includeIncumbentHistory": true,
  "extractClauses": true,
  "forceRefresh": false
}
```

| Field | Type | Required | Default | Description |
| :--- | :--- | :---: | :---: | :--- |
| `queries` | `string[]` | Yes | — | 1–25 SAM.gov notice IDs or allowlisted `https://sam.gov` / `https://api.sam.gov` URLs (max 512 chars each). |
| `includeIncumbentHistory` | `boolean` | No | `true` | Cross-reference `api.usaspending.gov` for historical contract incumbents and award values. |
| `extractClauses` | `boolean` | No | `true` | Download and deterministically parse PDF, DOCX, and ZIP RFP/SOW attachments. |
| `forceRefresh` | `boolean` | No | `false` | Bypass optional Upstash Redis cache and fetch fresh upstream data. |

> **MCP Schema Guarantee:** Zero properties appear in both `required` and `default`, preventing Apify MCP Server schema collisions across Claude Desktop, Cursor, OpenAI Agents, and LangGraph toolchains.

***

### Sample Structured Output

```json
{
  "query": "abc123def456",
  "notice_id": "abc123def456",
  "solicitation_number": "FA8773-26-R-0099",
  "title": "Enterprise Zero Trust & Cyber Defense Operations",
  "agency": "DEPT OF DEFENSE.DEPT OF THE AIR FORCE",
  "office": "FA8773 38 CONS",
  "notice_type": "Solicitation",
  "naics_codes": ["541512", "541519"],
  "set_asides": ["SDVOSB"],
  "posted_date": "2026-09-25",
  "response_deadline": "2026-10-22",
  "period_of_performance": "Base Period 12 months plus four (4) 12-month Option Periods",
  "source_url": "https://sam.gov/opp/abc123def456/view",
  "far_dfars_clauses": [
    {
      "authority": "FAR",
      "clause_number": "52.212-4",
      "title": "Contract Terms and Conditions—Commercial Products and Commercial Services",
      "category": "Commercial Terms",
      "source_document": "rfp.pdf"
    },
    {
      "authority": "DFARS",
      "clause_number": "252.204-7021",
      "title": "Cybersecurity Maturity Model Certification Requirements",
      "category": "Cybersecurity / CMMC",
      "source_document": "rfp.pdf"
    }
  ],
  "section_l_criteria": [
    {
      "section": "L",
      "heading": "L.2 Volume I - Technical Approach",
      "summary": "The Technical Approach volume is subject to a page limit of 25 pages excluding resumes.",
      "page_limit": 25
    }
  ],
  "section_m_criteria": [
    {
      "section": "M",
      "heading": "M.1 Basis for Award",
      "summary": "Award will be made using a Best Value Tradeoff source selection process.",
      "evaluation_methodology": "Best Value Tradeoff"
    }
  ],
  "security_clearances": [
    {
      "level": "Top Secret",
      "scope": "Facility",
      "evidence": "The contractor must possess an active Top Secret Facility Clearance (FCL) per DD Form 254."
    },
    {
      "level": "TS/SCI",
      "scope": "Personnel",
      "evidence": "Key personnel supporting intelligence enclave tasks require TS/SCI with CI Polygraph."
    }
  ],
  "clin_items": [
    {
      "clin_number": "0001",
      "description": "Zero Trust Architecture Modernization",
      "quantity": "12",
      "unit": "MO",
      "contract_type": "FFP",
      "period_of_performance": "Base Year"
    }
  ],
  "deadlines": [
    { "label": "Questions Due", "date_raw": "October 5, 2026", "date_iso": "2026-10-05" },
    { "label": "Proposal Due", "date_raw": "10/22/2026", "date_iso": "2026-10-22" }
  ],
  "incumbent_history": [
    {
      "award_id": "W911NF22C0009",
      "recipient_name": "BOOZ ALLEN HAMILTON INC",
      "award_amount": 25000000.0,
      "award_date": "2022-09-15",
      "awarding_agency": "Department of Defense",
      "naics_code": "541512"
    }
  ],
  "attachments": [
    {
      "filename": "rfp.pdf",
      "content_type": "application/pdf",
      "bytes_processed": 482910,
      "pages_processed": 44,
      "status": "parsed",
      "reason": null
    }
  ],
  "cache_hit": false,
  "parsed_at": "2026-11-27T00:25:00Z",
  "warnings": []
}
```

***

### Native Apify MCP Server & x402 / Pay-Per-Event Monetization

#### Connect via Apify MCP Server

Expose this Actor directly as a structured tool to Claude, Cursor, Windsurf, or autonomous GovCon capture agents via the Apify MCP Server (`https://mcp.apify.com`):

```json
{
  "mcpServers": {
    "apify-govcon-rfp-parser": {
      "url": "https://mcp.apify.com/sse?actors=YOUR_USERNAME/us-govcon-rfp-compliance-parser",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_API_TOKEN"
      }
    }
  }
}
```

Because every untrusted solicitation text field passes **fixed-point anti-prompt-injection sanitization**, downstream LLM agents can safely ingest parsed compliance matrices without indirect prompt-injection hijacking.

#### Transparent Pay-Per-Event (PPE) & x402 Agentic Billing

This Actor uses Apify's granular **Pay-Per-Event (PPE)** billing model, making it natively compatible with pay-as-you-go API workflows and **x402 autonomous agentic micropayments**:

| PPE Event Name | Trigger | Behavior on Spend Limit (`event_charge_limit_reached`) |
| :--- | :--- | :--- |
| `rfp-compliance-parse` | Billed immediately per parsed solicitation (`1` event per notice). | Halts further solicitation processing cleanly without losing already-pushed dataset records. |
| `incumbent-enrichment` | Billed immediately when USAspending.gov incumbent history is attached (`includeIncumbentHistory: true`). | Strictly omits unbilled incumbent data, records an audit warning, and preserves already-paid compliance records. |

***

### Security & DevSecOps Hardening

Built for defense-grade enterprise workflows with zero linter/type/security suppressions (`# noqa`, `# type: ignore`, `# nosec`):

- **Strict Anti-SSRF Egress:** Outbound traffic is locked to HTTPS on port 443 to `api.sam.gov`, `sam.gov`, `api.usaspending.gov`, `*.upstash.io` (single-label instance hosts), and `iae-fbo-attachments.s3.amazonaws.com` (strictly as a single-hop `302`/`303` attachment redirect target from `sam.gov`, with sensitive headers stripped). Connect-time IP pinning with IPv4-first failover eliminates DNS rebinding TOCTOU; private, loopback, link-local, CGNAT, and IPv6 NAT64/6to4/Teredo/mapped ranges are blocked; `X-Api-Key` is scoped strictly to `api.sam.gov`.
- **Defensive Binary Ingestion:**
  - **ZIP archives:** Blocks Zip Slip (`../`, Windows `\`, drive letters, absolute paths), Unix symlinks/FIFOs/devices, duplicate canonical paths, overlapping offsets, spoofed compressed sizes, nested ZIPs, and streaming Zip Bombs.
  - **PDF & DOCX:** Enforces hard file byte, page, character, table row/col/cell, and cumulative solicitation caps; blocks UTF-8/UTF-16/UTF-32 XXE (`<!DOCTYPE`/`<!ENTITY`) across all DOCX members (including extension-masqueraded parts) and `w:gridSpan` table amplification bombs.
- **Fixed-Point Anti-Prompt-Injection Sanitization:** Neutralizes nested/split role tags, Unicode `Cf`/Variation Selectors/Tag characters, and Cyrillic/Greek homoglyphs deterministically to fixed point.
- **PII & Secret Hygiene:** Scrubs API keys, bearer tokens, Sentry DSNs, emails, and SSNs across logs, formatted exception tracebacks, dataset queries, and opt-out `sentry-sdk` v2 hooks.
- **Container Hardening:** Multi-stage `python:3.12-slim-bookworm` container running strictly as unprivileged `USER 10001:10001` (`512–2048 MB`).

***

### Local Development & Offline Verification

```bash
## Install Python 3.12 dependencies with uv
uv sync --frozen --group dev

## Run the full offline DevSecOps gate
uv run ruff check .
uv run ruff format --check .
uv run mypy --strict src tests scripts
uv run pytest -q
uv run bandit -c pyproject.toml -r src -ll
uv run pip-audit
uv run python scripts/audit_mcp_contract.py
gitleaks detect --no-git -v
```

See [ARCHITECTURE.md](ARCHITECTURE.md) for module internals and [research/PRE_LAUNCH_CHECKLIST.md](research/PRE_LAUNCH_CHECKLIST.md) for deployment sign-off steps.

# Actor input Schema

## `queries` (type: `array`):

List of 1 to 25 active SAM.gov notice IDs (32-char hex ID from sam.gov/opp/<noticeId>/view) or allowlisted HTTPS SAM.gov solicitation URLs.

## `includeIncumbentHistory` (type: `boolean`):

Cross-reference historical federal contract winners and award amounts via api.usaspending.gov (billed per enriched solicitation via 'incumbent-enrichment' PPE event).

## `extractClauses` (type: `boolean`):

Download and deterministically parse official SAM.gov attachments to extract FAR/DFARS clauses, Section L/M criteria, CLIN schedules, and security clearances.

## `forceRefresh` (type: `boolean`):

Bypass Upstash Redis cache and fetch fresh solicitation metadata and attachments.

## Actor input object example

```json
{
  "queries": [
    "5c233af3115a4bf38986f10d07f9e7d6"
  ],
  "includeIncumbentHistory": true,
  "extractClauses": true,
  "forceRefresh": false
}
```

# Actor output Schema

## `results` (type: `string`):

Structured SAM.gov solicitation metadata, FAR/DFARS clauses, Section L/M requirements, CLIN tables, and USAspending incumbent history.

# 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 = {
    "queries": [
        "5c233af3115a4bf38986f10d07f9e7d6"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ramosdeluis/us-govcon-rfp-compliance-parser").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 = { "queries": ["5c233af3115a4bf38986f10d07f9e7d6"] }

# Run the Actor and wait for it to finish
run = client.actor("ramosdeluis/us-govcon-rfp-compliance-parser").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 '{
  "queries": [
    "5c233af3115a4bf38986f10d07f9e7d6"
  ]
}' |
apify call ramosdeluis/us-govcon-rfp-compliance-parser --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ramosdeluis/us-govcon-rfp-compliance-parser"
        }
    }
}
```

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/Hg8uWzcKaV84KiWAB/builds/mu40ngtfexqKmkG4y/openapi.json
