Search bills, legislators, committees, and events across all 50 US states, DC, and 5 US territories.
Search bills, legislators, committees, and events across all 50 US states, DC, and 5 US territories via MCP. STDIO or Streamable HTTP.
US state legislative data from the Open States v3 API — all 50 states, DC, and 5 US territories. Search and fetch bills, legislators, committees, events, and jurisdiction coverage metadata from any MCP client. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
| Tool | Description |
|---|---|
openstates_search_bills | Search state legislative bills across all covered US jurisdictions with full-text search, jurisdiction/session filtering, subject tags, and sponsor lookups |
openstates_get_bill | Fetch full detail for a specific bill by OCD ID or three-part path (jurisdiction + session + bill_id) |
openstates_search_people | Search state legislators and officials within a jurisdiction by name, chamber, or district, or fetch specific people by OCD person ID |
openstates_get_legislators_by_location | Find every legislator representing a geographic coordinate (latitude/longitude) — state legislators and the federal delegation |
openstates_search_committees | List committees for a jurisdiction (experimental — not all states have coverage) |
openstates_get_committee | Fetch committee detail by OCD organization ID, with optional membership roster |
openstates_search_events | Search hearings, floor sessions, and committee meetings (experimental) |
openstates_get_event | Fetch full event detail including agenda, participants, and media links |
openstates_list_jurisdictions | List all 56 jurisdictions (50 states, DC, and 5 US territories) covered by Open States with session identifiers and coverage metadata |
openstates_get_jurisdiction | Fetch full metadata for a specific jurisdiction including all legislative sessions and their identifiers |
| Resource | Description |
|---|---|
openstates://jurisdiction/{jurisdiction_id} | Jurisdiction metadata including current sessions, coverage dates, and bill/people update timestamps |
All resource data is also reachable via tools. Use openstates_get_jurisdiction for programmatic jurisdiction lookups; the resource is useful for injecting jurisdiction context as stable reference material.
| Prompt | Description |
|---|---|
openstates_bill_research | Structured framework for analyzing a state bill: summary, sponsors, committee referrals, action timeline, vote record, and related legislation |
openstates_legislator_profile | Research framework for profiling a legislator: sponsored bills, committee assignments, voting record, and contact details |
openstates_search_bills tooljurisdiction or q is required by the schema — a q-only search spans all 56 jurisdictions and exceeds the upstream timeout for a common term, so pairing them is the reliable formsession, chamber (upper/lower), classification, subject tags, sponsor, sponsor_classification, and action_since/updated_since/created_since ISO 8601 date filtersinclude inlines sponsorships, actions, votes, abstracts, versions, documents, and related bills — avoids follow-up openstates_get_bill callssort defaults to updated_desc; sort=latest_action_desc surfaces bills currently moving; pagination up to 20 per page (default 10)openstates_get_bill toolopenstates_id (preferred, from search results) or the three-part path jurisdiction + session + bill_id; a call missing both fails with missing_lookup_paramsHB 1000, SB 42)include inlines sponsorships, actions, votes, versions, documents, abstracts, other titles/identifiers, and related billsnot_found when the ID or path resolves to nothingopenstates_search_people tooljurisdiction or id (OCD person IDs) is required — an unscoped search exceeds the upstream timeout even for a name-only queryid resolves any number of specific OCD person IDs in one call — the IDs that bill sponsorships and committee memberships hand back — and needs no jurisdiction alongside itorg_classification: upper/lower/executive/legislature (both chambers merged, executive officials excluded); omitting it returns every officeholder including executivesname match, plus district; include adds offices, links, other_names, other_identifiers, sourcesopenstates_get_legislators_by_location toollatitude/longitude; does not geocode addressesjurisdiction.classification (state vs country) is the tier discriminator — current_role.org_classification is not, since it's upper/lower for a US Senator exactly as for a state senatorstateCount/federalCount enrichment fields report the tier splitinvalid_coordinate; a location with no coverage returns an empty-result noticeopenstates_search_committees tooljurisdiction is required — the schema rejects an all-states requestclassification (committee/subcommittee) and chamber; parent scopes to one committee's subcommitteesinclude=memberships returns the full roster with member rolescoverageNote field always documents thisopenstates_get_committee toolcommittee_id (from openstates_search_committees)include=memberships returns the roster; include=links/sources add reference URLsnot_found when the ID doesn't existopenstates_search_events tooljurisdiction is required — the events endpoint has no all-states searchafter/before scope to an ISO 8601 date range; require_bills=true filters to events with a bill on the agendainclude=agenda,participants returns full meeting contextopenstates_get_event toolevent_id (from openstates_search_events)include adds agenda, participants, links, media, and documentsnot_found when the ID doesn't existopenstates_list_jurisdictions toolper_page ceiling of 52 no longer covers the full setclassification filter defaults to stateinclude=legislative_sessions returns every historical and current session identifier — required before filtering bill searches by session, since formats vary by state (e.g., 2025, 2025-2026, 2025rs, 2025s1)include=organizations/latest_runs add chamber/executive-body and scraper-run metadataopenstates_get_jurisdiction toolinclude=legislative_sessions returns all session identifiers with date rangesnot_found when the identifier doesn't resolveopenstates://jurisdiction/{jurisdiction_id} resourcejurisdiction_id accepts an OCD-ID, state name, or two-letter abbreviationapplication/json: current legislative sessions, coverage dates, bill/people update timestampslegislative_sessions — use to prime session identifiers without a tool callnot_found when the identifier doesn't resolveopenstates_bill_research promptjurisdiction, session, bill_id — all requiredopenstates_legislator_profile promptname, jurisdiction — both requiredBuilt on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
Open States-specific:
include parameter strategy before any tool callOPENSTATES_DAILY_REQUEST_BUDGET) and a two-tier timeout ladder guard the shared upstream keyAgent-friendly output:
coverageNote) on committee and event tools — surfaces the limitation instead of a silent empty resultinclude parameter pattern across all search and get tools — avoids N+1 follow-up calls for common research workflowsA public instance is available at https://openstates.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"openstates-mcp-server": {
"type": "streamable-http",
"url": "https://openstates.caseyjhand.com/mcp"
}
}
}
Requires an Open States API key — register free at open.pluralpolicy.com.
Add the following to your MCP client configuration file:
{
"mcpServers": {
"openstates-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/openstates-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"OPENSTATES_API_KEY": "your-api-key"
}
}
}
}
Or with npx (no Bun required):
{
"mcpServers": {
"openstates-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/openstates-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"OPENSTATES_API_KEY": "your-api-key"
}
}
}
}
Or with Docker:
{
"mcpServers": {
"openstates-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"-e", "OPENSTATES_API_KEY=your-api-key",
"ghcr.io/cyanheads/openstates-mcp-server:latest"
]
}
}
}
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 OPENSTATES_API_KEY=your-key bun run start:http
# Server listens at http://localhost:3010/mcp
git clone https://github.com/cyanheads/openstates-mcp-server.git
cd openstates-mcp-server
bun install
cp .env.example .env
# edit .env and set OPENSTATES_API_KEY
All configuration is validated at startup via Zod schemas in src/config/server-config.ts. Key environment variables:
| Variable | Description | Default |
|---|---|---|
OPENSTATES_API_KEY | Required. Open States API key from open.pluralpolicy.com. | — |
OPENSTATES_API_BASE_URL | Open States API base URL. | https://v3.openstates.org |
OPENSTATES_DAILY_REQUEST_BUDGET | Maximum upstream requests per rolling 24 hours. Once spent, calls are rejected before the request is issued, so an over-budget call costs nothing upstream. The default matches the v3 free-tier daily cap — raise it if your key's tier allows more. | 250 |
OPENSTATES_REQUEST_TIMEOUT_MS | Per-attempt upstream deadline in milliseconds (minimum 1000). Expiry is non-retryable, so a request that cannot complete costs one wait rather than four. Open States answers a scoped query anywhere from under a second to ~57s and its own gateway gives up near 60s — lower this to fail sooner, raise it to wait out a slow query. | 45000 |
OPENSTATES_TOTAL_REQUEST_BUDGET_MS | Wall-clock ceiling in milliseconds for one call across every retry attempt and the backoff between them. The per-attempt deadline bounds a single request; this bounds the whole ladder, so a slow upstream that keeps failing retryably cannot hold a call open for the full retry sequence. Must be at least OPENSTATES_REQUEST_TIMEOUT_MS — startup rejects anything lower, which would abort every attempt before its own deadline applied. At the default of twice the deadline, an attempt that fails just short of its deadline still leaves a retry nearly a full deadline of its own. | 90000 |
MCP_TRANSPORT_TYPE | Transport: stdio or http. | stdio |
MCP_SESSION_MODE | HTTP session mode: auto, stateful, or stateless. src/index.ts declares stateless via createApp({ sessionMode }) — no tool suspends for caller input, so no session state is needed. Setting this overrides the declaration; the framework schema default is auto, which resolves to stateful. | stateless |
MCP_HTTP_PORT | HTTP server port. | 3010 |
MCP_HTTP_ENDPOINT_PATH | HTTP endpoint path. | /mcp |
MCP_PUBLIC_URL | Public origin override for TLS-terminating reverse-proxy deployments. | none |
MCP_AUTH_MODE | Auth mode: none, jwt, or oauth. | none |
MCP_LOG_LEVEL | Log level (debug, info, notice, warning, error). | info |
MCP_GC_PRESSURE_INTERVAL_MS | Opt-in Bun-only forced-GC interval (ms). Try 60000 if heap grows under sustained HTTP load. | 0 (disabled) |
LOGS_DIR | Directory for log files (Node.js only). | <project-root>/logs |
STORAGE_PROVIDER_TYPE | Storage backend: in-memory, filesystem, supabase, cloudflare-kv/r2/d1. | in-memory |
OTEL_ENABLED | Enable OpenTelemetry instrumentation. | false |
See .env.example for the full list of optional overrides.
Build and run the production version:
# One-time build
bun run rebuild
# Run the built server
bun run start:stdio
# or
bun run start:http
Run checks and tests:
bun run devcheck # Lint, format, typecheck, security
bun run test # Vitest test suite
bun run lint:mcp # Validate MCP definitions against spec
docker build -t openstates-mcp-server .
docker run --rm -e OPENSTATES_API_KEY=your-key -e MCP_TRANSPORT_TYPE=http -p 3010:3010 openstates-mcp-server
The Dockerfile defaults to HTTP transport, explicitly sets MCP_SESSION_MODE=stateless, and logs to /var/log/openstates-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
| Directory | Purpose |
|---|---|
src/index.ts | createApp() entry point — registers tools, resources, prompts, and inits the Open States service. |
src/config | Server-specific environment variable parsing and validation with Zod. |
src/mcp-server/tools | Tool definitions (*.tool.ts). Ten tools across bills, people, committees, events, and jurisdictions. |
src/mcp-server/resources | Resource definitions. Jurisdiction metadata resource. |
src/mcp-server/prompts | Prompt definitions. Bill research and legislator profile prompts. |
src/services/openstates | Open States API v3 service layer — HTTP client, request handling, domain types. |
tests/ | Unit and integration tests mirroring src/. |
See CLAUDE.md for development guidelines and architectural rules. The short version:
try/catch in tool logicctx.log for request-scoped logging, ctx.state for tenant-scoped storagesrc/index.tsIssues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run test
Apache-2.0 — see LICENSE for details.
Source-derived launch command. Check the maintainer’s required arguments and credentials before running:
npx -y @cyanheads/openstates-mcp-serverMerge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.
{
"mcpServers": {
"io-github-cyanheads-openstates-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/openstates-mcp-server"
]
}
}
}Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.
Claude Desktop setup referenceio.github.cyanheads/openstates-mcp-server works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.