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
npx -y @AshwinSundar/congress_gov_mcpOverview
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:
Environment variables (example):
# seconds
Run locally with Uvicorn (typical for FastAPI/ASGI apps):
Run with Docker:
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 name | Description | Key parameters |
|---|---|---|
| get_bill | Fetch bill details and current status | bill_id (e.g., “hr123”) |
| search_bills | Full-text or filtered bill search | query, chamber, congress, sort, page |
| get_member | Fetch member profile and current roles | member_id or name |
| get_votes | Retrieve roll-call votes | bill_id, chamber, date_range |
| get_committee | Committee details and memberships | committee_id |
| get_hearings | Upcoming/past hearings | committee_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):
Example JSON response (simplified):
Python example using requests:
=
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.