{
  "markdown": "<div align=\"center\">\n  <h1>@cyanheads/openfec-mcp-server</h1>\n  <p><b>Access FEC campaign finance data through MCP. Query data about candidates, money trails, and election filings. STDIO & Streamable HTTP.</b>\n  <div>12 Tools • 5 Resources • 2 Prompts</div>\n  </p>\n</div>\n\n<div align=\"center\">\n\n[![npm](https://img.shields.io/npm/v/@cyanheads/openfec-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/openfec-mcp-server) [![Version](https://img.shields.io/badge/Version-0.8.0-blue.svg?style=flat-square)](./CHANGELOG.md) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/openfec-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-^1.3.0-f9f1e1.svg?style=flat-square)](https://bun.sh/)\n\n</div>\n\n<div align=\"center\">\n\n[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/openfec-mcp-server/releases/latest/download/openfec-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=openfec-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvb3BlbmZlYy1tY3Atc2VydmVyIl0sImVudiI6eyJGRUNfQVBJX0tFWSI6InlvdXItYXBpLWtleSJ9fQ==) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22openfec-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads/openfec-mcp-server%22%5D%2C%22env%22%3A%7B%22FEC_API_KEY%22%3A%22your-api-key%22%7D%7D)\n\n[![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)\n\n</div>\n\n<div align=\"center\">\n\n**Public Hosted Server:** [https://openfec.caseyjhand.com/mcp](https://openfec.caseyjhand.com/mcp)\n\n</div>\n\n---\n\n## Tools\n\nTwelve tools for querying federal election campaign finance data:\n\n| Tool Name | Description |\n|:----------|:------------|\n| `openfec_search_candidates` | Find federal candidates by name, state, office, party, or cycle. |\n| `openfec_search_committees` | Find political committees by name, type, candidate affiliation, or state. |\n| `openfec_get_committee_totals` | Get pre-aggregated committee financial totals for one committee, or rank committees of one entity type. |\n| `openfec_search_contributions` | Search itemized individual contributions or aggregate breakdowns by size, state, employer, or occupation. |\n| `openfec_search_disbursements` | Search itemized committee spending or aggregate breakdowns by purpose or recipient. |\n| `openfec_search_expenditures` | Search independent expenditures supporting or opposing federal candidates. |\n| `openfec_search_coordinated_expenditures` | Search coordinated party expenditures (Schedule F) made on behalf of a candidate. |\n| `openfec_search_filings` | Search FEC filings and reports by committee, candidate, form type, or date range. |\n| `openfec_lookup_elections` | Look up election races and candidate financial summaries. |\n| `openfec_search_legal` | Search FEC legal documents: advisory opinions, enforcement cases, and administrative fines. |\n| `openfec_get_legal_document` | Fetch one legal document in full, including the arrays legal search trims away. |\n| `openfec_lookup_calendar` | Look up FEC calendar events, filing deadlines, and election dates. |\n\n### `openfec_search_candidates`\n\nFind federal candidates with optional financial totals.\n\n- Full-text name search plus filters for state, district, office, party, cycle, incumbent status\n- Fetch a specific candidate by FEC ID (H/S/P prefix) with full detail\n- Optional financial totals: receipts, disbursements, cash on hand\n- Pagination up to 100 results per page\n\n---\n\n### `openfec_search_committees`\n\nFind political committees (campaign, PAC, Super PAC, party).\n\n- Full-text name search plus filters for type, designation, party, state, candidate affiliation\n- Fetch a specific committee by FEC ID (C prefix)\n- Committee types: House, Senate, Presidential, Super PAC, PAC, Party\n- Treasurer name search\n\n---\n\n### `openfec_get_committee_totals`\n\nPre-aggregated committee finances, without paginating Schedule A.\n\n- **single**: One committee's totals, one row per two-year cycle it filed\n- **by_entity_type**: Every committee of one type — presidential, pac, party, pac-party, house-senate, ie-only\n- Receipts, disbursements, cash on hand, debts, and the itemized/unitemized contribution split\n- Grouped mode filters by state, committee type, designation, organization type, and receipts/disbursements thresholds\n\n---\n\n### `openfec_search_contributions`\n\nSearch Schedule A contribution data with five query modes.\n\n- **itemized**: Individual contribution records with keyset cursor pagination\n- **by_size**: Aggregate breakdowns by contribution size range\n- **by_state**: Geographic breakdown of contributions\n- **by_employer**: Top employer aggregates\n- **by_occupation**: Top occupation aggregates\n- Filters: donor name, employer, occupation, city, state, ZIP, date range, amount range\n\n---\n\n### `openfec_search_disbursements`\n\nSearch Schedule B spending data with four query modes.\n\n- **itemized**: Individual disbursement records with keyset cursor pagination\n- **by_purpose**: Aggregate by spending purpose category\n- **by_recipient**: Aggregate by payee name\n- **by_recipient_id**: Aggregate by recipient committee ID\n- Filters: recipient name, description, date range, amount range\n\n---\n\n### `openfec_search_expenditures`\n\nSearch Schedule E independent expenditure data.\n\n- **itemized**: Individual expenditure records with support/oppose indicator; scoped to the current cycle unless another is given\n- **by_candidate**: Aggregated totals per targeted candidate, scoped by candidate ID or by a whole race (office alone for President, plus state for Senate, plus district as well for House)\n- Filters: committee, candidate, office, party, 24/48-hour notices, date and amount range\n\n---\n\n### `openfec_search_coordinated_expenditures`\n\nSearch Schedule F coordinated party expenditures.\n\n- Party committee spending made on behalf of a candidate, in coordination with that campaign — a separate legal category from independent expenditures and from direct contributions\n- Filters: spending committee, benefiting candidate, cycle, payee name, date range, amount range\n- Page-based pagination; the shared spending committee is hoisted out of the rows when the query names one\n\n---\n\n### `openfec_search_filings`\n\nSearch FEC filings and reports.\n\n- Form types: F3 (House/Senate quarterly), F3P (Presidential), F3X (PAC/party), F24 (24-hour IE notice), F1/F2 (organizational/candidacy), F5 (IE by persons)\n- Report type codes: Q1/Q2/Q3, YE, monthly, pre/post election\n- Amendment filtering with most-recent-only option\n- Date range filtering by FEC receipt date\n\n---\n\n### `openfec_search_legal`\n\nSearch across FEC legal document types.\n\n- Advisory opinions, MURs (enforcement cases), ADRs, administrative fines, statutes\n- Look up specific cases by AO number or case number\n- Filter by respondent, regulatory/statutory citation, penalty amount range\n- Date filtering is type-scoped: pick a `date_kind` the document type records (advisory opinions issue/request/document, cases open/close/document, admin fines RTB/final determination)\n- Offset-based pagination (up to 200 results per page)\n\n---\n\n### `openfec_get_legal_document`\n\nFetch one legal document in full by type and number.\n\n- Returns the full `documents` array that `openfec_search_legal` replaces with a count and category summary, and the complete `commission_votes` it cuts down to a date and a truncated action\n- `doc_type` is the plural of a search result's `document_type` (`mur` → `murs`); `no` is that result's `no` field, which every document type carries\n- Reports how many related filings the record carries, so it can be checked against the search result's `document_count`\n\n---\n\n### `openfec_lookup_elections`\n\nLook up federal election races.\n\n- **search**: Candidates in a race with financial totals\n- **summary**: Aggregate race financial summary\n- Office types: H (House), S (Senate), P (President)\n- ZIP code lookup to find races covering a location\n- Full election period expansion (4yr president, 6yr senate, 2yr house)\n\n---\n\n### `openfec_lookup_calendar`\n\nLook up FEC dates and deadlines.\n\n- **events**: FEC calendar events\n- **filing_deadlines**: Report due dates by type and year\n- **election_dates**: Upcoming and past election dates by state and office\n- Date range filtering\n\n## Resources\n\n| URI Pattern | Description |\n|:------------|:------------|\n| `openfec://candidate/{candidate_id}` | Federal candidate profile with current financial totals. |\n| `openfec://committee/{committee_id}` | Political committee profile with type, designation, and financial summary. |\n| `openfec://election/{cycle}/{office}` | Presidential or at-large election race with candidate financial totals. |\n| `openfec://election/{cycle}/{office}/{state}` | Senate or state-level election race with candidate financial totals. |\n| `openfec://election/{cycle}/{office}/{state}/{district}` | House district election race with candidate financial totals. |\n\n## Prompts\n\n| Prompt | Description |\n|:-------|:------------|\n| `openfec_campaign_analysis` | Structured analysis of a candidate's financial position — fundraising trajectory, burn rate, cash reserves, donor composition, and opponent comparison. |\n| `openfec_money_trail` | Framework for tracing the flow of money around a candidate or race — direct fundraising, PAC support, independent expenditures, and party spending. |\n\n## Features\n\nBuilt on [`@cyanheads/mcp-ts-core`](https://github.com/cyanheads/mcp-ts-core):\n\n- Declarative tool definitions — single file per tool, framework handles registration and validation\n- Unified error handling across all tools\n- Pluggable auth (`none`, `jwt`, `oauth`)\n- Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`\n- Structured logging with optional OpenTelemetry tracing\n- Runs locally (stdio/HTTP) or via Docker from the same codebase\n\nOpenFEC-specific:\n\n- Type-safe client wrapping the [OpenFEC REST API](https://api.open.fec.gov/developers/)\n- Multi-mode tools supporting both itemized records and aggregate breakdowns\n- Keyset cursor pagination for high-volume Schedule A/B/E data\n- Automatic retry with configurable timeout and max retries\n- Error sanitization strips API keys from error messages; HTTP status errors enriched with actionable hints\n- Two guided investigation prompts for campaign finance analysis workflows\n\n## Getting Started\n\n### Public Hosted Instance\n\nA public instance is available at `https://openfec.caseyjhand.com/mcp` — no installation required. Point any MCP client at it via Streamable HTTP:\n\n```json\n{\n  \"mcpServers\": {\n    \"openfec-mcp-server\": {\n      \"type\": \"streamable-http\",\n      \"url\": \"https://openfec.caseyjhand.com/mcp\"\n    }\n  }\n}\n```\n\n### Self-Hosted / Local\n\nAdd the following to your MCP client configuration file.\n\n```json\n{\n  \"mcpServers\": {\n    \"openfec-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"bunx\",\n      \"args\": [\"@cyanheads/openfec-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"FEC_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nOr with Docker:\n\n```json\n{\n  \"mcpServers\": {\n    \"openfec-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"docker\",\n      \"args\": [\"run\", \"-i\", \"--rm\", \"-e\", \"MCP_TRANSPORT_TYPE=stdio\", \"-e\", \"FEC_API_KEY=your-api-key\", \"ghcr.io/cyanheads/openfec-mcp-server:latest\"]\n    }\n  }\n}\n```\n\nFor Streamable HTTP, set the transport and start the server:\n\n```sh\nMCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 FEC_API_KEY=your-key bun run start:http\n# Server listens at http://localhost:3010/mcp\n```\n\n### Prerequisites\n\n- [Bun v1.3.0](https://bun.sh/) or higher (or Node ≥24)\n- (Optional) A free [OpenFEC API key](https://api.data.gov/signup/) for higher rate limits (1,000 req/hr vs 30 req/hr with the default `DEMO_KEY`)\n\n### Installation\n\n1. **Clone the repository:**\n\n```sh\ngit clone https://github.com/cyanheads/openfec-mcp-server.git\n```\n\n2. **Navigate into the directory:**\n\n```sh\ncd openfec-mcp-server\n```\n\n3. **Install dependencies:**\n\n```sh\nbun install\n```\n\n## Configuration\n\n| Variable | Description | Default |\n|:---------|:------------|:--------|\n| `FEC_API_KEY` | OpenFEC API key. Optional — defaults to `DEMO_KEY` (30 req/hr). Provide your own key (free at [api.data.gov/signup](https://api.data.gov/signup/)) for 1,000 req/hr. | `DEMO_KEY` |\n| `FEC_BASE_URL` | OpenFEC API base URL. | `https://api.open.fec.gov/v1` |\n| `FEC_MAX_RETRIES` | Max retry attempts for failed API requests. | `3` |\n| `FEC_REQUEST_TIMEOUT` | Request timeout in milliseconds. | `30000` |\n| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |\n| `MCP_HTTP_PORT` | Port for HTTP server. | `3010` |\n| `MCP_HTTP_HOST` | Hostname for HTTP server. | `localhost` |\n| `MCP_SESSION_MODE` | HTTP session mode: `auto`, `stateful`, or `stateless`. The published container pins `stateless`. | `auto` (resolves to `stateful`) |\n| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |\n| `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |\n| `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |\n| `STORAGE_PROVIDER_TYPE` | Storage backend. | `in-memory` |\n| `OTEL_ENABLED` | Enable [OpenTelemetry instrumentation](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry) (spans, metrics, completion logs). | `false` |\n\n## Running the Server\n\n### Local Development\n\n- **Build and run:**\n  ```sh\n  bun run rebuild\n  bun run start:stdio   # or start:http\n  ```\n\n- **Run checks and tests:**\n  ```sh\n  bun run devcheck      # Lint, format, typecheck, security audit\n  bun run test          # Runs test suite\n  ```\n\n## Project Structure\n\n| Directory | Purpose |\n|:----------|:--------|\n| `src/mcp-server/tools/definitions/` | Tool definitions (`*.tool.ts`). |\n| `src/mcp-server/resources/definitions/` | Resource definitions (`*.resource.ts`). |\n| `src/mcp-server/prompts/definitions/` | Prompt definitions (`*.prompt.ts`). |\n| `src/services/openfec/` | OpenFEC API client and domain types. |\n| `src/config/` | Environment variable parsing and validation with Zod. |\n| `tests/` | Unit and integration tests. |\n| `scripts/` | Build, clean, devcheck, tree, and lint scripts. |\n| `docs/` | Design docs and OpenAPI spec. |\n\n## Development Guide\n\nSee [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:\n\n- Handlers throw, framework catches — no `try/catch` in tool logic\n- Use `ctx.log` for domain-specific logging, `ctx.state` for storage\n- Register new tools and resources in the `index.ts` barrel files\n\n## Contributing\n\nIssues and pull requests are welcome. Run checks before submitting:\n\n```sh\nbun run devcheck\nbun run test\n```\n\n## License\n\nApache-2.0 — see [LICENSE](LICENSE) for details.\n",
  "bytes": 15576,
  "sha": "57fcb3e06a81578b8f730023fa72206ef446baff5da4a6ad157c20c7270146bf",
  "repo_slug": "cyanheads/openfec-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cyanheads_openfec_mcp_server_fd185ebc/readme"
}