CO

Congress.gov API MCP Server for Real-Time Legislative Data

An MCP server to interact with real-time data from the Congress.gov API, which is the official API for the United States Congress

Quick Install
npx -y @AshwinSundar/congress_gov_mcp

Overview

This MCP (Model Context Protocol) server provides a standardized, LLM-friendly interface to real-time legislative data from the official Congress.gov API. It wraps common Congress.gov endpoints (bills, members, votes, committees, hearings, search) as MCP tools, enabling language models and agent frameworks to request structured, up-to-date congressional information in a predictable way.

The server is useful when you need programmatic, near-real-time legislative context inside an AI application — for example, to let an LLM cite the current status of a bill, summarize recent roll-call votes, or monitor committee activity. By exposing these actions as MCP tools, the server simplifies integration for developers building chatbots, monitoring systems, or research tools that rely on congressional data.

Features

  • Exposes Congress.gov resources (bills, members, votes, committees, hearings, full-text search) as MCP-compatible tools
  • Real-time calls to the official Congress.gov API with optional caching to reduce latency and rate-limit pressure
  • Built-in handling for API key configuration and basic rate-limit/backoff strategies
  • Dockerfile and local development scripts for easy deployment
  • Example client snippets for invoking MCP tools from LLM agents or scripts
  • Extensible tool definitions so you can add or customize endpoints for your application

Installation / Configuration

Prerequisites: Python 3.10+ or Docker, and an API key for the Congress.gov API.

Clone the repo and install dependencies:

git clone https://github.com/AshwinSundar/congress_gov_mcp.git
cd congress_gov_mcp
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Environment variables (example):

export CONGRESS_API_KEY="your_congress_api_key_here"
export MCP_HOST="0.0.0.0"
export MCP_PORT="8080"
export CACHE_TTL="300"        # seconds
export RATE_LIMIT_PER_MIN="60"

Run locally with Uvicorn (typical for FastAPI/ASGI apps):

uvicorn app:app --host $MCP_HOST --port $MCP_PORT --reload

Run with Docker:

docker build -t congress-mcp .
docker run -e CONGRESS_API_KEY="$CONGRESS_API_KEY" -p 8080:8080 congress-mcp

Configuration options are generally provided via environment variables or a .env file. Common options: API key, host/port, cache TTL, and rate limit thresholds.

Available Tools / Resources

The MCP server exposes tools that map to common Congress.gov actions. Typical tool names and parameter summaries:

Tool nameDescriptionKey parameters
get_billFetch bill details and current statusbill_id (e.g., “hr123”)
search_billsFull-text or filtered bill searchquery, chamber, congress, sort, page
get_memberFetch member profile and current rolesmember_id or name
get_votesRetrieve roll-call votesbill_id, chamber, date_range
get_committeeCommittee details and membershipscommittee_id
get_hearingsUpcoming/past hearingscommittee_id, date_range

Other resources included in the repository:

  • OpenAPI / docs endpoint (if enabled) for inspecting the MCP tool schema
  • Example Postman collection and example client scripts (Python)
  • README and simple test suite for local validation

GitHub repository: https://github.com/AshwinSundar/congress_gov_mcp

Example usage

Calling an MCP tool from the command line (example invokes a tool endpoint that follows MCP POST semantics):

curl -X POST "http://localhost:8080/mcp/tools/get_bill" \
  -H "Content-Type: application/json" \
  -d '{"bill_id":"hr123-118"}'

Example JSON response (simplified):

{
  "tool_name": "get_bill",
  "success": true,
  "result": {
    "bill_id": "hr123-118",
    "title": "An Act to ...",
    "status": "Introduced",
    "latest_action_date": "2026-03-12",
    "sponsors": ["Rep. Jane Doe (D-XX)"]
  }
}

Python example using requests:

import requests

resp = requests.post(
    "http://localhost:8080/mcp/tools/search_bills",
    json={"query": "clean energy", "congress": "118", "page": 1}
)
print(resp.json())

Use Cases

  • LLM-powered legislative assistant: Provide up-to-date bill status and summaries in conversational applications. The MCP server lets the model call get_bill or search_bills to ground responses with current data.
  • Alerts and monitoring: Subscribe or poll get_votes and get_hearings to detect changes (e.g., passage of key legislation, scheduled committee hearings) and trigger notifications.
  • Research and analytics: Pull structured data for downstream processing (e.g., compute sponsor networks, voting patterns) without manually scraping Congress.gov pages.
  • Fact-checking or citation generation: Use the MCP tools to fetch authoritative metadata (sponsor, actions, full text links) so your application can generate accurate citations alongside generated text.

Notes and Best Practices

  • Keep your Congress.gov API key secure. Configure it as an environment variable on servers and CI, not checked into source control.
  • Use caching for frequent queries (search results, bill metadata) to improve latency and reduce API usage.
  • Respect rate limits — the server includes basic backoff, but design clients to batch or cache where appropriate.
  • Extend tools to include application-specific filters or transforms as needed; the MCP pattern is intentionally modular.

For full source, examples, and issue tracking, see the project repository: https://github.com/AshwinSundar/congress_gov_mcp.