Skip to main content
Glama

rfp-agent: find federal contracts worth bidding on

An agent that helps a small company decide which US federal contract notices to bid on. It loads every open notice from SAM.gov, removes duplicate postings, scores each one 0-100 for the company with plain reasons, and looks up the Federal Acquisition Regulation (FAR), refusing when the FAR does not cover the question. The tools run as an MCP server, so Claude Desktop, Claude Code or any MCP client can use them; a small agent loop can also drive them with a free local model to write a go/no-go brief.

ci Python 3.12 MCP Ollama Ruff release license: MIT

Project page →

$ rfp-agent search --profile examples/atlanta_it_profile.toml --min-days-left 10 --limit 5
4,360 open notices with 10+ days left, ranked by fit

  77  Region 9 Help Desk IT Support Services Bridge          EPA    Special Notice   closes 2026-12-09
  77  DA10--Utilization Management Software                  VA     Sources Sought   closes 2026-12-11
  76  Acquisition SI                                         DoD    Sources Sought   closes 2026-12-18
  75  NILE ISS 6 Engineering Services (N0003927RM002)        Navy   Solicitation     closes 2026-12-17
  75  Fountainhead                                           DOJ    Sources Sought   closes 2026-12-24

Three results

15,171 → 10,773 notices. 4,398 open notices were repeat postings of the same solicitation (every amendment gets a new notice id). The largest group, GSA's Multiple Award Schedule, was posted 60 times.

The FAR tool refuses what the FAR does not cover. "Per diem rate for lodging in Atlanta?" scores 0.620, below the 0.711 floor calibrated on nonsense probes, so it returns no answer instead of an invented rate.

Small local models fail the full task in ways a simple eval hides. Both pass 7/7 tool-choice cases, yet on the real brief llama3.1:8b invented three notice ids. They never reached the brief's tables, which are built only from tool results.

Related MCP server: samgov-mcp

How it fits together

flowchart LR
  CSV[SAM.gov public CSV<br/>no key] --> S[store.py<br/>normalize, keep open,<br/>remove duplicates]
  API[SAM.gov API<br/>key from Keychain] --> S
  S --> J[(opportunities.jsonl<br/>10,773 notices)]
  P[company profile<br/>.toml] --> SC[scoring.py<br/>rule-based 0-100]
  J --> T[tools.py<br/>4 tools, input checks]
  SC --> T
  F[abstain-rag FAR index<br/>bge-small + FAISS] --> FT[far_tool.py<br/>floor + margin gates]
  FT --> T
  T --> M[mcp_server.py<br/>Claude Desktop / Code]
  T --> A[agent.py<br/>local LLM loop] --> B[go/no-go brief]

What the LLM decides and what it does not. The model only chooses which tool to call and writes the summary. Fit scores come from rules, refusals from retrieval gates, and the brief's tables from tool results, so a weaker model cannot change a score, talk the FAR tool into answering, or put a made-up notice in a table.

Results

What

Result

Notices after removing duplicates

10,773 of 15,171 (4,398 repeats, 2,057 groups)

FAR answered: "When must a contracting officer set aside for small business?"

allowed, top section 19.502-1 (score 0.840)

FAR refused: "Per diem rate for lodging in Atlanta in 2026?"

refused, 0.620 < floor 0.711

Evals, tool choice (7 cases)

7/7 llama3.1:8b, 7/7 qwen2.5:7b, 7/7 rules baseline

Evals, FAR refusal (7) and fit bands (5)

all pass; decided by gates and rules, same for every model

Full brief, qwen2.5:7b

0 results at first (stacked every filter), retried after the empty-result hint, 1 GO; summary named the wrong NAICS code

Full brief, llama3.1:8b

one 11-keyword query, 0 results, stopped; before the hint it invented 3 notice ids

Tests

78, no network and no model needed

Read the eval rows with care: only tool choice uses the model, the 7 cases are easy, and only the tool name is graded (both models made up argument values that still passed). 4 judgment-call cases were reviewed by a person, who agreed with all 4.

Quick start

Needs Python 3.12 and uv. The FAR tool also needs the sibling abstain-rag checkout at ../abstain-rag.

git clone https://github.com/gss-18/rfp-agent && cd rfp-agent
uv sync                                   # add --no-group far to skip the FAR tool
uv run rfp-agent extract                  # public CSV of all open notices, no key, ~230 MB
uv run rfp-agent build                    # -> data/opportunities.jsonl
uv run rfp-agent search --profile examples/atlanta_it_profile.toml --min-days-left 10

Command reference

Every command prints JSON (except brief, which prints Markdown). Run uv run rfp-agent <command> --help for the same list.

extract: download all open notices (no key)

uv run rfp-agent extract

Downloads SAM.gov's public daily CSV extract (~230 MB) into data/raw/. No options. This is the easiest way to get data.

fetch: recent notices from the SAM.gov API (needs a key)

uv run rfp-agent fetch --days 7 --pages 1 --budget 3

Option

Default

Meaning

--days N

7

notices posted in the last N days

--pages N

1

how many result pages to request (1,000 notices each)

--budget N

3

most live API calls allowed per day; personal keys have low limits

--cache-only

off

use only responses already cached in data/raw/, make no live call

The key is read from SAM_API_KEY or the macOS Keychain (security add-generic-password -s sam-gov-api -a <you> -w). It is never written to disk. Note: the API's offset parameter is a page index, not a record count.

build: create the local store

uv run rfp-agent build

Merges the CSV extract and any cached API pages, keeps only open notices, removes duplicates, and writes data/opportunities.jsonl. Prints the counts, including duplicates_removed.

Option

Meaning

--api-only

ignore the CSV extract; build from cached API pages only

uv run rfp-agent search "data analytics" --naics 5415 --set-aside small_business --min-days-left 10
uv run rfp-agent search --profile examples/atlanta_it_profile.toml --limit 20

Argument / option

Default

Meaning

query

none

words to find in the title, agency or description. Whole words only ("bi" does not match "bi-lateral"). Several words match as a phrase first ("power bi"); if no notice has the phrase, notices with all the words anywhere count. The output's match says which rule was used

--naics CODES

none

NAICS codes or prefixes, comma-separated: 5415 (all computer services) or 541511,541512

--set-aside TYPE

none

small_business, 8a, wosb, edwosb, sdvosb, vosb, hubzone, indian, local_area, a raw SAM code such as SBA, or none for full and open competition

--days N

0 (any)

only notices posted in the last N days

--min-days-left N

0

only notices with at least N days before the response deadline

--limit N

10

how many results to print (1-50); count in the output is the full number

--profile FILE

none

rank by fit score for this company (best first, earlier deadline breaks ties) and add fit_score to each result. Without it, notices with more query words in the title come first

If nothing matches, the output includes a hint explaining why, so an agent can widen its search.

score: why a notice scored what it did

uv run rfp-agent score db8203e048e448d4b21fd62e7ec32337 --profile examples/atlanta_it_profile.toml

Argument / option

Default

Meaning

notice_id

required

the id from search output

--profile FILE

the example profile

the company to score for

Prints the total, the band (strong 70+, possible 40-69, weak), eligibility, and each part with its reason:

naics       35   NAICS 541512 is one of the firm's codes
set_aside   25   set aside for small_business, which the firm holds
keywords     0   no profile keywords in title or description
deadline    10   20 days to respond (need 10)
place        5   no place of performance listed

far: look up the FAR, or refuse

uv run rfp-agent far "Can a contractor withdraw its offer before the award?"

Argument

Meaning

question

a plain-English question, in quotes

Returns answer_allowed, the reason, and the top FAR sections with scores and passages. It never writes an answer itself; it returns evidence to read.

brief: run the agent and write a go/no-go brief

uv run rfp-agent brief --llm ollama --model qwen2.5:7b --out runs/brief.md

Option

Default

Meaning

--profile FILE

the example profile

the company the brief is for

--llm fake|ollama

fake

fake follows a fixed plan with no model (offline, for tests); ollama uses a real local model

--model NAME

qwen2.5:7b

the Ollama model, e.g. llama3.1:8b (run ollama pull <name> first)

--max-steps N

12

most tool calls the agent may make before it must stop

--out FILE

print

write the Markdown brief to this file instead of the screen

The brief marks each notice GO (70+), REVIEW (40-69) or NO-GO, and never says GO for an ineligible set-aside, an impossible deadline, or a sole-source/special notice. Tables come from tool results; the summary is written by the model and labeled as such.

eval: run the evaluation cases

uv run rfp-agent eval                                  # offline rules baseline
uv run rfp-agent eval --llm ollama --model llama3.1:8b

Option

Default

Meaning

--llm fake|ollama

fake

which model picks tools for the tool-choice cases

--model NAME

qwen2.5:7b

the Ollama model

--no-far

off

skip cases that need the FAR index (what CI does)

Cases live in evals/cases.jsonl (tool choice, FAR refusal, fit bands). The output shows each case, the tool arguments the model chose, and PASS/FAIL.

rfp-agent-mcp: the MCP server

uv run rfp-agent-mcp

Starts the server over stdio. Add it to Claude Desktop (claude_desktop_config.json) or Claude Code:

{"mcpServers": {"rfp-agent": {"command": "uv",
  "args": ["--directory", "/path/to/rfp-agent", "run", "rfp-agent-mcp"]}}}

Tool

Inputs

search_opportunities

query, naics, set_aside, days, limit, min_days_left, profile_path (same as search)

get_opportunity

notice_id

score_opportunity

notice_id, profile_path

far_lookup

question

Your company profile

A profile is a small TOML file. Copy examples/atlanta_it_profile.toml and edit it:

[company]
name = "Peachtree Data Systems (example)"
naics = ["541511", "541512", "541519"]          # work types from your SAM.gov registration
eligibilities = ["small_business"]              # set-asides you qualify for
keywords = ["data", "analytics", "cloud", "software", "cybersecurity"]
states = ["GA", "AL", "FL", "SC", "TN", "NC"]   # where you can perform the work
min_days_to_deadline = 10                       # how fast you can write a proposal

For safety, tools only read profiles inside the project or a folder you allow. To keep a real company's profile out of the repo, put it elsewhere and point to that folder:

export RFP_PROFILE_DIR=~/rfp-profiles
uv run rfp-agent search --profile ~/rfp-profiles/mycompany.toml --min-days-left 10

How the fit score works

Part

Points

Rule

NAICS

35

exact code 35; same 4-digit group 20; notice lists none 10

Set-aside

25

firm holds it 25; open competition 15; firm lacks it 0 and the total is capped at 10

Keywords

20

2+ in the title 20; 1 in the title 12; only in the description 6

Deadline

10

enough days 10; at least half the days needed 5

Place

10

target state 10; none listed 5; other state 2

If neither the NAICS code nor any keyword matches, the total is capped at 30. The reasoning behind each weight is in src/rfp_agent/scoring.py. Rules, not a model, so the same notice always gets the same score and every point has a reason a person can check or disagree with.

How the FAR refusal works

far_lookup retrieves 50 FAR passages with bge-small, collapses them to sections, and applies two gates from abstain-rag:

  • floor: the best section must score at least 0.711, the 95th percentile of scores for "word salad" probes built from real FAR words (questions that look like the FAR but ask nothing);

  • margin: the best section must beat the mean of the next nine by at least 0.0086.

If either fails, answer_allowed is false.

Repository map

Path

What it does

src/rfp_agent/sam_client.py

SAM.gov API client: key from Keychain or env, response cache, daily call budget

src/rfp_agent/store.py

CSV extract, merge with API data, keep open notices, remove duplicates, save

src/rfp_agent/models.py

Opportunity and set-aside code mapping

src/rfp_agent/profile.py

CompanyProfile loading and checks

src/rfp_agent/scoring.py

score_fit(): five weighted parts, each with a reason

src/rfp_agent/far_tool.py

far_lookup(): dense retrieval over the FAR with refusal gates, no LLM

src/rfp_agent/tools.py

the four tools with input checks, shared by MCP and the agent

src/rfp_agent/mcp_server.py

MCP server over stdio (official Python SDK)

src/rfp_agent/llm.py, agent.py

Ollama interface, offline fakes, tool-calling loop, brief writer

src/rfp_agent/evals.py, evals/cases.jsonl

evaluation runner and cases

docs/site/

project page

docs/LEARN.md

step-by-step guide with check-yourself questions

tests/

78 tests; no network, no model

Settings

Variable

Default

Meaning

SAM_API_KEY

Keychain

SAM.gov API key, if not in the Keychain

RFP_DATA_DIR

./data

where downloads and the store live

RFP_PROFILE_DIR

none

an extra folder the tools may read profiles from

ABSTAIN_RAG_DIR

../abstain-rag

the abstain-rag checkout with the FAR index

Tests and CI

uv run pytest -q        # 78 tests; FAR tests skip if abstain-rag is missing
uv run ruff check .

GitHub Actions runs ruff, pytest and the offline evals on every push, without the FAR index.

Limitations

  • Duplicate removal can over-merge. In 273 of 2,057 groups the titles differ. Most are amendments, but an agency that reuses one solicitation number for different work keeps only the newest notice.

  • Search is keyword-based. Boilerplate clauses in descriptions (e.g. cybersecurity requirements on a parts order) can match; ranking by fit score pushes those down but does not remove them.

  • Fit weights are judgment calls, documented in scoring.py, not learned from bid outcomes.

  • The evals are small (19 cases) and grade tool names, not arguments.

  • The model-written summary can be wrong. Check it against the tables.

  • Not legal or bidding advice: the FAR tool returns sections to read, not interpretations.

Contributing and security

See CONTRIBUTING.md and SECURITY.md. Changes are listed in CHANGELOG.md.

License

MIT © 2026 Trivikram Sridevi

Data

SAM.gov contract opportunities (public, U.S. General Services Administration): https://sam.gov · FAR: https://www.acquisition.gov/browse/index/far

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • 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.
      1
      -
    • A
      license
      A
      quality
      D
      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
      MIT
    • A
      license
      B
      quality
      A
      maintenance
      Enables searching and filtering federal contract opportunities by keyword, agency, set-aside, NAICS, and more from any MCP client. Analyzes solicitations for small-business fit and risk, and provides reference lookups for NAICS codes, set-asides, and federal thresholds.
      9
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients to search and retrieve contract intelligence over public contract data, with agent skills for precedent lookup, negotiation checks, and risk flagging, all with verification and citations.
      -