Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Search bills, legislators, committees, and events across all 50 US states, DC, and Puerto Rico.

README.md

<div align="center"> <h1>@cyanheads/openstates-mcp-server</h1> <p><b>Search bills, legislators, committees, and events across all 50 US states, DC, and 5 US territories via MCP. STDIO or Streamable HTTP.</b> <div>10 Tools • 1 Resource • 2 Prompts</div> </p> </div>

<div align="center">

![Version](./CHANGELOG.md) ![License](./LICENSE) ![Docker](https://github.com/users/cyanheads/packages/container/package/openstates-mcp-server) ![MCP SDK](https://modelcontextprotocol.io/) ![npm](https://www.npmjs.com/package/@cyanheads/openstates-mcp-server) ![TypeScript](https://www.typescriptlang.org/) ![Bun](https://bun.sh/)

</div>

<div align="center">

![Install in Claude Desktop](https://github.com/cyanheads/openstates-mcp-server/releases/latest/download/openstates-mcp-server.mcpb) ![Install in Cursor](https://cursor.com/en/install-mcp?name=openstates-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvb3BlbnN0YXRlcy1tY3Atc2VydmVyIl0sImVudiI6eyJPUEVOU1RBVEVTX0FQSV9LRVkiOiJ5b3VyLWFwaS1rZXkifX0=) ![Install in VS Code](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22openstates-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fopenstates-mcp-server%22%5D%2C%22env%22%3A%7B%22OPENSTATES_API_KEY%22%3A%22your-api-key%22%7D%7D)

![Framework](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)

Public Hosted Server: https://openstates.caseyjhand.com/mcp

</div>

---

Tools

10 tools covering the full Open States v3 API surface — bills, legislators, committees, events, and jurisdictions:

| 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 |

openstates_search_bills

Search state legislative bills with rich filtering and inline related data.

  • Full-text search across bill titles, abstracts, and text (q)
  • Either jurisdiction or q is required by the input schema — a call carrying neither fails schema validation, and pairing them is the reliable form, since a q-only search spans all 56 jurisdictions and times out upstream for a common term
  • Filter by jurisdiction (state name, two-letter abbreviation, or OCD-ID), session, chamber, classification, subject tags, and sponsor
  • Sort by latest action, first action, or update time — use sort=latest_action_desc for bills currently moving through the legislature
  • include parameter requests sponsorships, actions, votes, abstracts, versions, and related bills inline — eliminates follow-up openstates_get_bill calls for most research workflows
  • Sponsors carry linked person records (OCD person ID + name) when available, so a sponsor chains onward by ID rather than by name match
  • Every result carries openstates_url (citable page) and updated_at (the field the default sort=updated_desc orders by)
  • action_since, updated_since, and created_since date filters for change-tracking
  • Pagination up to 20 results per page
  • Empty-result recovery: appliedFilters echoes every filter the query was issued with and the notice names each one that narrowed it, so a zero-result answer identifies its own cause. A jurisdiction that matches no covered jurisdiction is called out by name — Open States answers an unrecognized one with zero bills rather than an error

---

openstates_get_bill

Fetch complete bill detail by OCD ID or path lookup.

  • Two lookup modes: openstates_id (OCD bill ID from search results, preferred) or the three-part path jurisdiction + session + bill_id
  • Accepts bill identifiers in legislature format (e.g., HB 1000, SB 42)
  • include=votes returns full vote tallies and per-legislator positions
  • include=versions,documents provides links to bill text and fiscal notes
  • Sponsors carry linked person records (OCD person ID + name) when available

---

openstates_search_people

Search legislators and officials within one jurisdiction by name, chamber, or district, or fetch specific people by OCD person ID.

  • Either jurisdiction or id is required by the input schema — a search spanning all 56 jurisdictions exceeds the upstream timeout, name-only searches included, so a call carrying neither fails schema validation. Use openstates_list_jurisdictions to pick a jurisdiction, or openstates_get_legislators_by_location when you have coordinates but no state
  • id takes OCD person IDs and returns exactly those people, so it needs no jurisdiction alongside it. It resolves the IDs that search results, openstates_get_bill sponsorships, and openstates_get_committee memberships hand back — several in one call, since upstream /people accepts id repeatedly and offers no per-person detail route
  • Case-insensitive substring matching on name
  • org_classification targets a role type: upper (Senate), lower (House/Assembly), executive (governors and executive officials), legislature (every legislator — both chambers merged into one paginated set, all upper members then all lower)
  • Omitting org_classification is not equivalent to legislature — it returns every officeholder, executive officials included
  • include=offices returns phone, fax, and mailing address
  • include=links returns website and social media links
  • Every result carries the member's official headshot URL (image) when published, and the OCD division their district maps to (current_role.division_id)

---

openstates_get_legislators_by_location

Find every legislator representing a geographic coordinate, across both tiers of government.

  • Pass decimal-degree latitude/longitude to get the state senators and representatives for that location, plus its two US Senators and its US Representative
  • jurisdiction.classification separates the tiers: "state" is a state legislature, "country" is the US Congress. current_role.org_classification does not — it is upper/lower for a US Senator exactly as for a state senator
  • stateCount and federalCount report the split, and the rendered text labels each legislator's tier
  • Useful for constituent-to-representative matching, address-based policy research, and electoral boundary analysis
  • Does not geocode addresses — the caller must provide coordinates
  • Returns a coverage note when no legislators are found (e.g., coordinates outside US boundaries)

---

openstates_list_jurisdictions and openstates_get_jurisdiction

Discover and look up jurisdiction coverage metadata.

  • openstates_list_jurisdictions returns all 56 jurisdictions (50 states, DC, and 5 US territories) in a single default call — the pages are merged server-side, since the upstream per_page ceiling of 52 no longer covers the full set
  • include=legislative_sessions returns all historical and current session identifiers — required before filtering bill searches by session, since formats vary widely by state (e.g., 2025, 2025-2026, 2025rs, 2025s1)
  • openstates_get_jurisdiction fetches one jurisdiction by OCD-ID, state name, or two-letter abbreviation

---

Committee and event tools (experimental)

openstates_search_committees, openstates_get_committee, openstates_search_events, and openstates_get_event are experimental — Open States is actively working to restore committee support and most states do not publish event data. Empty results may indicate the state lacks data, not that no committees or events exist. The two search tools (openstates_search_committees and openstates_search_events) include a coverageNote field in their output documenting this limitation, and both require a jurisdiction in their input schema — a request spanning all 56 exceeds the upstream timeout, so a call that omits it fails schema validation.

Resources and prompts

| Type | Name | Description | |:---|:---|:---| | Resource | openstates://jurisdiction/{jurisdiction_id} | Jurisdiction metadata including current sessions, coverage dates, and bill/people update timestamps | | Prompt | openstates_bill_research | Structured framework for analyzing a state bill: summary, sponsors, committee referrals, action timeline, vote record, and related legislation | | Prompt | openstates_legislator_profile | Research framework for profiling a legislator: sponsored bills, committee assignments, voting record, and contact details |

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.

Features

Built on @cyanheads/mcp-ts-core:

  • Declarative tool, resource, and prompt definitions — single file per primitive, framework handles registration and validation
  • Unified error handling — handlers throw, framework catches, classifies, and formats
  • Pluggable auth: none, jwt, oauth
  • Swappable storage backends: in-memory, filesystem, Supabase, Cloudflare KV/R2/D1
  • Structured logging with optional OpenTelemetry tracing
  • STDIO and Streamable HTTP transports

Open States-specific:

  • Full Open States v3 API coverage: bills, people, committees, events, and jurisdictions
  • Dual lookup modes on bill and committee fetchers (OCD ID or structured path)
  • Geo-based legislator lookup via the Open States people-by-geo endpoint
  • Server-level instructions prime the agent with session discovery workflow and include parameter strategy before any tool calls

Agent-friendly output:

  • Empty-result recovery: tools echo the applied filters and suggest how to broaden when no results are returned
  • Experimental coverage notes on committee and event tools — agents can surface these to users rather than returning silent empty results
  • include parameter pattern across all search and get tools — avoids N+1 follow-up calls for common research workflows (e.g., include=sponsorships,actions on openstates_search_bills)

Getting started

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

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/cyanheads/openstates-mcp-server.git
  1. Navigate into the directory:
cd openstates-mcp-server
  1. Install dependencies:
bun install
  1. Configure environment:
cp .env.example .env
# edit .env and set OPENSTATES_API_KEY

Configuration

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_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.

Running the server

Local development

  • 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

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, stateless session mode, 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.

Project structure

| 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/. |

Development guide

See CLAUDE.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic
  • Use ctx.log for request-scoped logging, ctx.state for tenant-scoped storage
  • Register new tools and resources via the arrays in src/index.ts
  • Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields

Contributing

Issues and pull requests are welcome. Run checks and tests before submitting:

bun run devcheck
bun run test

License

Apache-2.0 — see LICENSE for details.

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Search servers.