Data source: Congress.gov API (api.congress.gov)
Overview
US Congress wraps Congress.gov API (api.congress.gov), handling authentication, pagination, and rate limits for you. This tutorial covers all 5 tools with working code examples you can copy and run.
Prerequisites
- Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
- Choose your integration method: MCP protocol or REST API.
Connect via MCP
Add to your MCP client config (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"gnist-congress": {
"url": "https://context.gnist.ai/mcp/congress/",
"headers": {
"Gnist-API-Key": "YOUR_API_KEY"
}
}
}
}
Tools (5)
search_bills
Search US congressional bills by keyword. Args: query: Search keywords for bill text or title. congress: Congress number (e.g. 118 for the 118th Congress). bill_type: Bill type filter: hr, s, hjres, sjres, hconres, sconres, hres, sres. limit: Maximum results to return (1-250, default 20). Returns: Dictionary with count and list of matching bills including title, sponsor, and latest action.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | required | |
congress | any | optional | |
bill_type | any | optional | |
limit | integer | optional | (default: 20) |
curl -X POST "https://context.gnist.ai/mcp/congress/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "search_bills", "arguments": {"query": "renewable energy"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/congress/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'query': 'renewable energy'}, 'name': 'search_bills'}},
)
print(resp.json())
get_bill
Get detailed information about a specific US congressional bill. Args: congress: Congress number (e.g. 118). bill_type: Bill type: hr, s, hjres, sjres, hconres, sconres, hres, sres. bill_number: Bill number (e.g. "1" for H.R. 1). Returns: Dictionary with full bill details including sponsor, subjects, policy area, and summaries.
| Parameter | Type | Required | Description |
|---|---|---|---|
congress | integer | required | |
bill_type | string | required | |
bill_number | string | required |
curl -X POST "https://context.gnist.ai/mcp/congress/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_bill", "arguments": {"congress": 5, "bill_type": "example", "bill_number": "12345"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/congress/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'bill_number': '12345',
'bill_type': 'example',
'congress': 5},
'name': 'get_bill'}},
)
print(resp.json())
get_recent_bills
Get recently updated bills from a specific congress. Args: congress: Congress number (default: 118 for the 118th Congress, 2023-2025). limit: Maximum results to return (1-250, default 20). Returns: Dictionary with count and list of recently updated bills.
| Parameter | Type | Required | Description |
|---|---|---|---|
congress | integer | optional | (default: 118) |
limit | integer | optional | (default: 20) |
curl -X POST "https://context.gnist.ai/mcp/congress/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_recent_bills", "arguments": {"congress": 118}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/congress/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'congress': 118}, 'name': 'get_recent_bills'}},
)
print(resp.json())
search_members
Search members of Congress with optional filters. Note: State, party, and chamber filters are applied client-side after fetching results. The returned count reflects filtered results only. For unfiltered queries, pagination works normally. When filters are active, increase limit for more complete results. Args: state: Filter by US state abbreviation (e.g. CA, NY, TX). party: Filter by party name (Democratic, Republican). chamber: Filter by chamber (House of Representatives, Senate). limit: Maximum results to fetch from API before filtering (1-250, default 20). Returns: Dictionary with count and list of matching members including party, state, and chamber.
| Parameter | Type | Required | Description |
|---|---|---|---|
state | any | optional | |
party | any | optional | |
chamber | any | optional | |
limit | integer | optional | (default: 20) |
curl -X POST "https://context.gnist.ai/mcp/congress/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "search_members", "arguments": {"state": "example"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/congress/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'state': 'example'}, 'name': 'search_members'}},
)
print(resp.json())
report_feedback
Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.
| Parameter | Type | Required | Description |
|---|---|---|---|
feedback | string | required | |
feedback_type | string | optional | (default: general) |
curl -X POST "https://context.gnist.ai/mcp/congress/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/congress/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())
Common Patterns
Use
search_bills to find items, then get_bill to get full details. This two-step pattern is common for exploring data before drilling down.Several tools support
limit, offset, or page parameters. Start with small limits during development, then increase for production queries.FAQ
What data does US Congress provide?
US congressional bill search, bill details (sponsors, subjects, summaries), member lookup, and recent legislation from Congress.gov — covers all bill types (HR, S, joint/concurrent resolutions) across all congresses. It exposes 5 tools: search_bills, get_bill, get_recent_bills, search_members, report_feedback.
What do I need to get started?
A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.
What format does the US Congress API return?
JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.