@cyanheads/openfec-mcp-server 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +328 -0
- package/Dockerfile +99 -0
- package/LICENSE +191 -0
- package/README.md +297 -0
- package/dist/config/server-config.d.ts +17 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +31 -0
- package/dist/config/server-config.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/campaign-analysis.prompt.d.ts +13 -0
- package/dist/mcp-server/prompts/definitions/campaign-analysis.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/campaign-analysis.prompt.js +79 -0
- package/dist/mcp-server/prompts/definitions/campaign-analysis.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/index.d.ts +12 -0
- package/dist/mcp-server/prompts/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/index.js +10 -0
- package/dist/mcp-server/prompts/definitions/index.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/money-trail.prompt.d.ts +13 -0
- package/dist/mcp-server/prompts/definitions/money-trail.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/money-trail.prompt.js +78 -0
- package/dist/mcp-server/prompts/definitions/money-trail.prompt.js.map +1 -0
- package/dist/mcp-server/resources/definitions/candidate.resource.d.ts +10 -0
- package/dist/mcp-server/resources/definitions/candidate.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/candidate.resource.js +28 -0
- package/dist/mcp-server/resources/definitions/candidate.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/committee.resource.d.ts +10 -0
- package/dist/mcp-server/resources/definitions/committee.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/committee.resource.js +26 -0
- package/dist/mcp-server/resources/definitions/committee.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/election.resource.d.ts +25 -0
- package/dist/mcp-server/resources/definitions/election.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/election.resource.js +73 -0
- package/dist/mcp-server/resources/definitions/election.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/index.d.ts +16 -0
- package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/index.js +18 -0
- package/dist/mcp-server/resources/definitions/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/index.d.ts +285 -0
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/index.js +34 -0
- package/dist/mcp-server/tools/definitions/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/lookup-calendar.tool.d.ts +37 -0
- package/dist/mcp-server/tools/definitions/lookup-calendar.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/lookup-calendar.tool.js +172 -0
- package/dist/mcp-server/tools/definitions/lookup-calendar.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/lookup-elections.tool.d.ts +31 -0
- package/dist/mcp-server/tools/definitions/lookup-elections.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/lookup-elections.tool.js +134 -0
- package/dist/mcp-server/tools/definitions/lookup-elections.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-candidates.tool.d.ts +46 -0
- package/dist/mcp-server/tools/definitions/search-candidates.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-candidates.tool.js +170 -0
- package/dist/mcp-server/tools/definitions/search-candidates.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-committees.tool.d.ts +29 -0
- package/dist/mcp-server/tools/definitions/search-committees.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-committees.tool.js +120 -0
- package/dist/mcp-server/tools/definitions/search-committees.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-contributions.tool.d.ts +47 -0
- package/dist/mcp-server/tools/definitions/search-contributions.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-contributions.tool.js +252 -0
- package/dist/mcp-server/tools/definitions/search-contributions.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-disbursements.tool.d.ts +43 -0
- package/dist/mcp-server/tools/definitions/search-disbursements.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-disbursements.tool.js +212 -0
- package/dist/mcp-server/tools/definitions/search-disbursements.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-expenditures.tool.d.ts +52 -0
- package/dist/mcp-server/tools/definitions/search-expenditures.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-expenditures.tool.js +247 -0
- package/dist/mcp-server/tools/definitions/search-expenditures.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-filings.tool.d.ts +31 -0
- package/dist/mcp-server/tools/definitions/search-filings.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-filings.tool.js +123 -0
- package/dist/mcp-server/tools/definitions/search-filings.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-legal.tool.d.ts +32 -0
- package/dist/mcp-server/tools/definitions/search-legal.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-legal.tool.js +179 -0
- package/dist/mcp-server/tools/definitions/search-legal.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/utils/format-helpers.d.ts +19 -0
- package/dist/mcp-server/tools/definitions/utils/format-helpers.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/utils/format-helpers.js +19 -0
- package/dist/mcp-server/tools/definitions/utils/format-helpers.js.map +1 -0
- package/dist/mcp-server/tools/definitions/utils/id-validators.d.ts +11 -0
- package/dist/mcp-server/tools/definitions/utils/id-validators.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/utils/id-validators.js +22 -0
- package/dist/mcp-server/tools/definitions/utils/id-validators.js.map +1 -0
- package/dist/services/openfec/openfec-service.d.ts +54 -0
- package/dist/services/openfec/openfec-service.d.ts.map +1 -0
- package/dist/services/openfec/openfec-service.js +384 -0
- package/dist/services/openfec/openfec-service.js.map +1 -0
- package/dist/services/openfec/types.d.ts +86 -0
- package/dist/services/openfec/types.d.ts.map +1 -0
- package/dist/services/openfec/types.js +8 -0
- package/dist/services/openfec/types.js.map +1 -0
- package/package.json +91 -0
- package/server.json +97 -0
package/README.md
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>@cyanheads/openfec-mcp-server</h1>
|
|
3
|
+
<p><b>Access FEC campaign finance data through MCP. Query data about candidates, money trails, and election filings. STDIO & Streamable HTTP.</b></p>
|
|
4
|
+
<p><b>9 Tools · 5 Resources · 2 Prompts</b></p>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div align="center">
|
|
8
|
+
|
|
9
|
+
[](./CHANGELOG.md) [](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) [](https://modelcontextprotocol.io/)
|
|
10
|
+
|
|
11
|
+
[](./LICENSE) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Tools
|
|
18
|
+
|
|
19
|
+
Nine tools for querying federal election campaign finance data:
|
|
20
|
+
|
|
21
|
+
| Tool Name | Description |
|
|
22
|
+
|:----------|:------------|
|
|
23
|
+
| `openfec_search_candidates` | Find federal candidates by name, state, office, party, or cycle. |
|
|
24
|
+
| `openfec_search_committees` | Find political committees by name, type, candidate affiliation, or state. |
|
|
25
|
+
| `openfec_search_contributions` | Search itemized individual contributions or aggregate breakdowns by size, state, employer, or occupation. |
|
|
26
|
+
| `openfec_search_disbursements` | Search itemized committee spending or aggregate breakdowns by purpose or recipient. |
|
|
27
|
+
| `openfec_search_expenditures` | Search independent expenditures supporting or opposing federal candidates. |
|
|
28
|
+
| `openfec_search_filings` | Search FEC filings and reports by committee, candidate, form type, or date range. |
|
|
29
|
+
| `openfec_lookup_elections` | Look up election races and candidate financial summaries. |
|
|
30
|
+
| `openfec_search_legal` | Search FEC legal documents: advisory opinions, enforcement cases, and administrative fines. |
|
|
31
|
+
| `openfec_lookup_calendar` | Look up FEC calendar events, filing deadlines, and election dates. |
|
|
32
|
+
|
|
33
|
+
### `openfec_search_candidates`
|
|
34
|
+
|
|
35
|
+
Find federal candidates with optional financial totals.
|
|
36
|
+
|
|
37
|
+
- Full-text name search plus filters for state, district, office, party, cycle, incumbent status
|
|
38
|
+
- Fetch a specific candidate by FEC ID (H/S/P prefix) with full detail
|
|
39
|
+
- Optional financial totals: receipts, disbursements, cash on hand
|
|
40
|
+
- Pagination up to 100 results per page
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### `openfec_search_committees`
|
|
45
|
+
|
|
46
|
+
Find political committees (campaign, PAC, Super PAC, party).
|
|
47
|
+
|
|
48
|
+
- Full-text name search plus filters for type, designation, party, state, candidate affiliation
|
|
49
|
+
- Fetch a specific committee by FEC ID (C prefix)
|
|
50
|
+
- Committee types: House, Senate, Presidential, Super PAC, PAC, Party
|
|
51
|
+
- Treasurer name search
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### `openfec_search_contributions`
|
|
56
|
+
|
|
57
|
+
Search Schedule A contribution data with five query modes.
|
|
58
|
+
|
|
59
|
+
- **itemized**: Individual contribution records with keyset cursor pagination
|
|
60
|
+
- **by_size**: Aggregate breakdowns by contribution size range
|
|
61
|
+
- **by_state**: Geographic breakdown of contributions
|
|
62
|
+
- **by_employer**: Top employer aggregates
|
|
63
|
+
- **by_occupation**: Top occupation aggregates
|
|
64
|
+
- Filters: donor name, employer, occupation, city, state, ZIP, date range, amount range
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### `openfec_search_disbursements`
|
|
69
|
+
|
|
70
|
+
Search Schedule B spending data with four query modes.
|
|
71
|
+
|
|
72
|
+
- **itemized**: Individual disbursement records with keyset cursor pagination
|
|
73
|
+
- **by_purpose**: Aggregate by spending purpose category
|
|
74
|
+
- **by_recipient**: Aggregate by payee name
|
|
75
|
+
- **by_recipient_id**: Aggregate by recipient committee ID
|
|
76
|
+
- Filters: recipient name, description, date range, amount range
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### `openfec_search_expenditures`
|
|
81
|
+
|
|
82
|
+
Search Schedule E independent expenditure data.
|
|
83
|
+
|
|
84
|
+
- **itemized**: Individual expenditure records with support/oppose indicator
|
|
85
|
+
- **by_candidate**: Aggregated totals per targeted candidate
|
|
86
|
+
- Filters: committee, candidate, office, party, 24/48-hour notices, date and amount range
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### `openfec_search_filings`
|
|
91
|
+
|
|
92
|
+
Search FEC filings and reports.
|
|
93
|
+
|
|
94
|
+
- Form types: F3 (House/Senate quarterly), F3P (Presidential), F3X (PAC/party), F24 (24-hour IE notice), F1/F2 (organizational/candidacy), F5 (IE by persons)
|
|
95
|
+
- Report type codes: Q1/Q2/Q3, YE, monthly, pre/post election
|
|
96
|
+
- Amendment filtering with most-recent-only option
|
|
97
|
+
- Date range filtering by FEC receipt date
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### `openfec_search_legal`
|
|
102
|
+
|
|
103
|
+
Search across FEC legal document types.
|
|
104
|
+
|
|
105
|
+
- Advisory opinions, MURs (enforcement cases), ADRs, administrative fines, statutes
|
|
106
|
+
- Look up specific cases by AO number or case number
|
|
107
|
+
- Filter by respondent, regulatory/statutory citation, penalty amount range
|
|
108
|
+
- Offset-based pagination (up to 200 results per page)
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### `openfec_lookup_elections`
|
|
113
|
+
|
|
114
|
+
Look up federal election races.
|
|
115
|
+
|
|
116
|
+
- **search**: Candidates in a race with financial totals
|
|
117
|
+
- **summary**: Aggregate race financial summary
|
|
118
|
+
- Office types: president, senate, house
|
|
119
|
+
- ZIP code lookup to find races covering a location
|
|
120
|
+
- Full election period expansion (4yr president, 6yr senate, 2yr house)
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### `openfec_lookup_calendar`
|
|
125
|
+
|
|
126
|
+
Look up FEC dates and deadlines.
|
|
127
|
+
|
|
128
|
+
- **events**: FEC calendar events
|
|
129
|
+
- **filing_deadlines**: Report due dates by type and year
|
|
130
|
+
- **election_dates**: Upcoming and past election dates by state and office
|
|
131
|
+
- Date range filtering
|
|
132
|
+
|
|
133
|
+
## Resources
|
|
134
|
+
|
|
135
|
+
| URI Pattern | Description |
|
|
136
|
+
|:------------|:------------|
|
|
137
|
+
| `openfec://candidate/{candidate_id}` | Federal candidate profile with current financial totals. |
|
|
138
|
+
| `openfec://committee/{committee_id}` | Political committee profile with type, designation, and financial summary. |
|
|
139
|
+
| `openfec://election/{cycle}/{office}` | Presidential or at-large election race with candidate financial totals. |
|
|
140
|
+
| `openfec://election/{cycle}/{office}/{state}` | Senate or state-level election race with candidate financial totals. |
|
|
141
|
+
| `openfec://election/{cycle}/{office}/{state}/{district}` | House district election race with candidate financial totals. |
|
|
142
|
+
|
|
143
|
+
## Prompts
|
|
144
|
+
|
|
145
|
+
| Prompt | Description |
|
|
146
|
+
|:-------|:------------|
|
|
147
|
+
| `openfec_campaign_analysis` | Structured analysis of a candidate's financial position — fundraising trajectory, burn rate, cash reserves, donor composition, and opponent comparison. |
|
|
148
|
+
| `openfec_money_trail` | Framework for tracing the flow of money around a candidate or race — direct fundraising, PAC support, independent expenditures, and party spending. |
|
|
149
|
+
|
|
150
|
+
## Features
|
|
151
|
+
|
|
152
|
+
Built on [`@cyanheads/mcp-ts-core`](https://github.com/cyanheads/mcp-ts-core):
|
|
153
|
+
|
|
154
|
+
- Declarative tool definitions — single file per tool, framework handles registration and validation
|
|
155
|
+
- Unified error handling across all tools
|
|
156
|
+
- Pluggable auth (`none`, `jwt`, `oauth`)
|
|
157
|
+
- Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`
|
|
158
|
+
- Structured logging with optional OpenTelemetry tracing
|
|
159
|
+
- Runs locally (stdio/HTTP) or via Docker from the same codebase
|
|
160
|
+
|
|
161
|
+
OpenFEC-specific:
|
|
162
|
+
|
|
163
|
+
- Type-safe client wrapping the [OpenFEC REST API](https://api.open.fec.gov/developers/)
|
|
164
|
+
- Multi-mode tools supporting both itemized records and aggregate breakdowns
|
|
165
|
+
- Keyset cursor pagination for high-volume Schedule A/B/E data
|
|
166
|
+
- Automatic retry with configurable timeout and max retries
|
|
167
|
+
- Error sanitization strips API keys from error messages; HTTP status errors enriched with actionable hints
|
|
168
|
+
- Two guided investigation prompts for campaign finance analysis workflows
|
|
169
|
+
|
|
170
|
+
## Getting Started
|
|
171
|
+
|
|
172
|
+
### Prerequisites
|
|
173
|
+
|
|
174
|
+
- [Bun v1.2.0](https://bun.sh/) or higher
|
|
175
|
+
- A free [OpenFEC API key](https://api.data.gov/signup/)
|
|
176
|
+
|
|
177
|
+
### Installation
|
|
178
|
+
|
|
179
|
+
1. **Clone the repository:**
|
|
180
|
+
```sh
|
|
181
|
+
git clone https://github.com/cyanheads/openfec-mcp-server.git
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
2. **Navigate into the directory:**
|
|
185
|
+
```sh
|
|
186
|
+
cd openfec-mcp-server
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
3. **Install dependencies:**
|
|
190
|
+
```sh
|
|
191
|
+
bun install
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
4. **Set up environment:**
|
|
195
|
+
```sh
|
|
196
|
+
cp .env.example .env
|
|
197
|
+
# Edit .env and add your FEC_API_KEY
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### MCP Client Configuration
|
|
201
|
+
|
|
202
|
+
Add to your MCP client config (e.g., `claude_desktop_config.json`):
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"mcpServers": {
|
|
207
|
+
"openfec": {
|
|
208
|
+
"type": "stdio",
|
|
209
|
+
"command": "bun",
|
|
210
|
+
"args": ["run", "start:stdio"],
|
|
211
|
+
"cwd": "/path/to/openfec-mcp-server",
|
|
212
|
+
"env": {
|
|
213
|
+
"FEC_API_KEY": "your-api-key"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Configuration
|
|
221
|
+
|
|
222
|
+
| Variable | Description | Default |
|
|
223
|
+
|:---------|:------------|:--------|
|
|
224
|
+
| `FEC_API_KEY` | **Required.** OpenFEC API key. Get one free at [api.data.gov/signup](https://api.data.gov/signup/). | — |
|
|
225
|
+
| `FEC_BASE_URL` | OpenFEC API base URL. | `https://api.open.fec.gov/v1` |
|
|
226
|
+
| `FEC_MAX_RETRIES` | Max retry attempts for failed API requests. | `3` |
|
|
227
|
+
| `FEC_REQUEST_TIMEOUT` | Request timeout in milliseconds. | `30000` |
|
|
228
|
+
| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |
|
|
229
|
+
| `MCP_HTTP_PORT` | Port for HTTP server. | `3010` |
|
|
230
|
+
| `MCP_HTTP_HOST` | Hostname for HTTP server. | `localhost` |
|
|
231
|
+
| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |
|
|
232
|
+
| `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |
|
|
233
|
+
| `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |
|
|
234
|
+
| `STORAGE_PROVIDER_TYPE` | Storage backend. | `in-memory` |
|
|
235
|
+
| `OTEL_ENABLED` | Enable OpenTelemetry tracing. | `false` |
|
|
236
|
+
|
|
237
|
+
## Running the Server
|
|
238
|
+
|
|
239
|
+
### Local Development
|
|
240
|
+
|
|
241
|
+
- **Build and run the production version:**
|
|
242
|
+
```sh
|
|
243
|
+
bun run build
|
|
244
|
+
bun run start:http # or start:stdio
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
- **Run in dev mode (with watch):**
|
|
248
|
+
```sh
|
|
249
|
+
bun run dev:stdio # or dev:http
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
- **Run checks and tests:**
|
|
253
|
+
```sh
|
|
254
|
+
bun run devcheck # Lints, formats, type-checks
|
|
255
|
+
bun run test # Runs test suite
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Docker
|
|
259
|
+
|
|
260
|
+
```sh
|
|
261
|
+
docker build -t openfec-mcp-server .
|
|
262
|
+
docker run -e FEC_API_KEY=your-key -p 3010:3010 openfec-mcp-server
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Project Structure
|
|
266
|
+
|
|
267
|
+
| Directory | Purpose |
|
|
268
|
+
|:----------|:--------|
|
|
269
|
+
| `src/mcp-server/tools/definitions/` | Tool definitions (`*.tool.ts`). |
|
|
270
|
+
| `src/mcp-server/resources/definitions/` | Resource definitions (`*.resource.ts`). |
|
|
271
|
+
| `src/mcp-server/prompts/definitions/` | Prompt definitions (`*.prompt.ts`). |
|
|
272
|
+
| `src/services/openfec/` | OpenFEC API client and domain types. |
|
|
273
|
+
| `src/config/` | Environment variable parsing and validation with Zod. |
|
|
274
|
+
| `tests/` | Unit and integration tests. |
|
|
275
|
+
| `scripts/` | Build, clean, devcheck, tree, and lint scripts. |
|
|
276
|
+
| `docs/` | Design docs and OpenAPI spec. |
|
|
277
|
+
|
|
278
|
+
## Development Guide
|
|
279
|
+
|
|
280
|
+
See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:
|
|
281
|
+
|
|
282
|
+
- Handlers throw, framework catches — no `try/catch` in tool logic
|
|
283
|
+
- Use `ctx.log` for domain-specific logging, `ctx.state` for storage
|
|
284
|
+
- Register new tools and resources in the `index.ts` barrel files
|
|
285
|
+
|
|
286
|
+
## Contributing
|
|
287
|
+
|
|
288
|
+
Issues and pull requests are welcome. Run checks before submitting:
|
|
289
|
+
|
|
290
|
+
```sh
|
|
291
|
+
bun run devcheck
|
|
292
|
+
bun run test
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## License
|
|
296
|
+
|
|
297
|
+
Apache-2.0 — see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific configuration for OpenFEC API access.
|
|
3
|
+
* Lazy-parsed from environment variables — safe for Workers runtime.
|
|
4
|
+
* @module src/config/server-config
|
|
5
|
+
*/
|
|
6
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
declare const ServerConfigSchema: z.ZodObject<{
|
|
8
|
+
fecApiKey: z.ZodString;
|
|
9
|
+
fecBaseUrl: z.ZodDefault<z.ZodString>;
|
|
10
|
+
fecMaxRetries: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
11
|
+
fecRequestTimeout: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type ServerConfig = z.infer<typeof ServerConfigSchema>;
|
|
14
|
+
/** Returns validated server config, lazily parsed from env vars. */
|
|
15
|
+
export declare function getServerConfig(): ServerConfig;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=server-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE3C,QAAA,MAAM,kBAAkB;;;;;iBAYtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D,oEAAoE;AACpE,wBAAgB,eAAe,IAAI,YAAY,CAQ9C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific configuration for OpenFEC API access.
|
|
3
|
+
* Lazy-parsed from environment variables — safe for Workers runtime.
|
|
4
|
+
* @module src/config/server-config
|
|
5
|
+
*/
|
|
6
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
const ServerConfigSchema = z.object({
|
|
8
|
+
fecApiKey: z
|
|
9
|
+
.string()
|
|
10
|
+
.min(1, 'FEC_API_KEY is required. Get a free key at https://api.data.gov/signup/'),
|
|
11
|
+
fecBaseUrl: z.string().default('https://api.open.fec.gov/v1').describe('OpenFEC API base URL'),
|
|
12
|
+
fecMaxRetries: z.coerce.number().int().min(0).default(3).describe('Max retry attempts'),
|
|
13
|
+
fecRequestTimeout: z.coerce
|
|
14
|
+
.number()
|
|
15
|
+
.int()
|
|
16
|
+
.min(1000)
|
|
17
|
+
.default(30_000)
|
|
18
|
+
.describe('Request timeout in ms'),
|
|
19
|
+
});
|
|
20
|
+
let _config;
|
|
21
|
+
/** Returns validated server config, lazily parsed from env vars. */
|
|
22
|
+
export function getServerConfig() {
|
|
23
|
+
_config ??= ServerConfigSchema.parse({
|
|
24
|
+
fecApiKey: process.env.FEC_API_KEY,
|
|
25
|
+
fecBaseUrl: process.env.FEC_BASE_URL,
|
|
26
|
+
fecMaxRetries: process.env.FEC_MAX_RETRIES,
|
|
27
|
+
fecRequestTimeout: process.env.FEC_REQUEST_TIMEOUT,
|
|
28
|
+
});
|
|
29
|
+
return _config;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=server-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE3C,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,yEAAyE,CAAC;IACpF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IAC9F,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IACvF,iBAAiB,EAAE,CAAC,CAAC,MAAM;SACxB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,IAAI,CAAC;SACT,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CAAC,uBAAuB,CAAC;CACrC,CAAC,CAAC;AAIH,IAAI,OAAiC,CAAC;AAEtC,oEAAoE;AACpE,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,kBAAkB,CAAC,KAAK,CAAC;QACnC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;QAClC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;QACpC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;QAC1C,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB;KACnD,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;GAIG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview openfec-mcp-server entry point.
|
|
4
|
+
* Registers all tools, resources, and prompts, then starts the server.
|
|
5
|
+
* @module index
|
|
6
|
+
*/
|
|
7
|
+
import { createApp } from '@cyanheads/mcp-ts-core';
|
|
8
|
+
import { allPromptDefinitions } from './mcp-server/prompts/definitions/index.js';
|
|
9
|
+
import { allResourceDefinitions } from './mcp-server/resources/definitions/index.js';
|
|
10
|
+
import { allToolDefinitions } from './mcp-server/tools/definitions/index.js';
|
|
11
|
+
import { initOpenFecService } from './services/openfec/openfec-service.js';
|
|
12
|
+
await createApp({
|
|
13
|
+
tools: allToolDefinitions,
|
|
14
|
+
resources: allResourceDefinitions,
|
|
15
|
+
prompts: allPromptDefinitions,
|
|
16
|
+
setup() {
|
|
17
|
+
initOpenFecService();
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAE3E,MAAM,SAAS,CAAC;IACd,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,sBAAsB;IACjC,OAAO,EAAE,oBAAoB;IAC7B,KAAK;QACH,kBAAkB,EAAE,CAAC;IACvB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Prompt template for structured analysis of a candidate's financial position.
|
|
3
|
+
* Covers fundraising trajectory, burn rate, cash reserves, donor composition,
|
|
4
|
+
* and opponent comparison.
|
|
5
|
+
* @module src/mcp-server/prompts/definitions/campaign-analysis.prompt
|
|
6
|
+
*/
|
|
7
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
8
|
+
export declare const campaignAnalysisPrompt: import("@cyanheads/mcp-ts-core").PromptDefinition<z.ZodObject<{
|
|
9
|
+
candidate_name: z.ZodOptional<z.ZodString>;
|
|
10
|
+
candidate_id: z.ZodOptional<z.ZodString>;
|
|
11
|
+
cycle: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
//# sourceMappingURL=campaign-analysis.prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaign-analysis.prompt.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/campaign-analysis.prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAU,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,eAAO,MAAM,sBAAsB;;;;kBAwEjC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Prompt template for structured analysis of a candidate's financial position.
|
|
3
|
+
* Covers fundraising trajectory, burn rate, cash reserves, donor composition,
|
|
4
|
+
* and opponent comparison.
|
|
5
|
+
* @module src/mcp-server/prompts/definitions/campaign-analysis.prompt
|
|
6
|
+
*/
|
|
7
|
+
import { prompt, z } from '@cyanheads/mcp-ts-core';
|
|
8
|
+
export const campaignAnalysisPrompt = prompt('openfec_campaign_analysis', {
|
|
9
|
+
description: "Structured analysis of a candidate's financial position — fundraising trajectory, " +
|
|
10
|
+
'burn rate, cash reserves, donor composition, and opponent comparison.',
|
|
11
|
+
args: z.object({
|
|
12
|
+
candidate_name: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Candidate name to analyze. Provide this or candidate_id.'),
|
|
16
|
+
candidate_id: z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('FEC candidate ID (e.g., P00003392). Provide this or candidate_name.'),
|
|
20
|
+
cycle: z
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('Election cycle year (e.g., 2024). Defaults to current cycle.'),
|
|
24
|
+
}),
|
|
25
|
+
generate: (args) => {
|
|
26
|
+
const target = args.candidate_id
|
|
27
|
+
? `candidate ID ${args.candidate_id}`
|
|
28
|
+
: args.candidate_name
|
|
29
|
+
? `"${args.candidate_name}"`
|
|
30
|
+
: 'the specified candidate';
|
|
31
|
+
const cycleNote = args.cycle ? ` for the ${args.cycle} cycle` : '';
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
role: 'user',
|
|
35
|
+
content: {
|
|
36
|
+
type: 'text',
|
|
37
|
+
text: `Perform a structured campaign finance analysis of ${target}${cycleNote}. Use OpenFEC tools to build a complete financial picture.
|
|
38
|
+
|
|
39
|
+
## 1. Candidate Overview
|
|
40
|
+
Use openfec_search_candidates with include_totals=true to get:
|
|
41
|
+
- Total receipts, disbursements, cash on hand, debt
|
|
42
|
+
- Coverage period dates
|
|
43
|
+
|
|
44
|
+
## 2. Fundraising Analysis
|
|
45
|
+
Use openfec_search_contributions with the candidate's principal committee:
|
|
46
|
+
- **Size breakdown** (mode: by_size): What share comes from small vs. large donors?
|
|
47
|
+
- **Geographic reach** (mode: by_state): Where is financial support concentrated?
|
|
48
|
+
- **Industry patterns** (mode: by_employer): Which employers/industries are top sources?
|
|
49
|
+
|
|
50
|
+
## 3. Burn Rate & Spending
|
|
51
|
+
Use openfec_search_disbursements with the principal committee:
|
|
52
|
+
- **Purpose breakdown** (mode: by_purpose): Media buys, consulting, payroll, fundraising, travel
|
|
53
|
+
- **Top recipients** (mode: by_recipient): Where is the money going?
|
|
54
|
+
- Calculate burn rate: disbursements / receipts
|
|
55
|
+
|
|
56
|
+
## 4. Competitive Position
|
|
57
|
+
Use openfec_lookup_elections to find all candidates in the race:
|
|
58
|
+
- Compare total raised, cash on hand, and burn rates
|
|
59
|
+
- Identify financial advantages and gaps
|
|
60
|
+
|
|
61
|
+
## 5. Outside Money Context
|
|
62
|
+
Use openfec_search_expenditures with candidate_id:
|
|
63
|
+
- Total independent expenditure support vs. opposition
|
|
64
|
+
- Key outside groups involved
|
|
65
|
+
|
|
66
|
+
## 6. Assessment
|
|
67
|
+
Synthesize into a financial health assessment:
|
|
68
|
+
- **Fundraising trajectory**: Growing, flat, or declining?
|
|
69
|
+
- **Donor base health**: Broad grassroots vs. maxed-out large donors?
|
|
70
|
+
- **Cash position**: Sufficient for the remaining campaign period?
|
|
71
|
+
- **Spending efficiency**: Appropriate allocation across categories?
|
|
72
|
+
- **Competitive standing**: Financial position relative to opponents?
|
|
73
|
+
- **Key risks**: Debt levels, donor concentration, spending sustainability`,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=campaign-analysis.prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaign-analysis.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/campaign-analysis.prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,2BAA2B,EAAE;IACxE,WAAW,EACT,oFAAoF;QACpF,uEAAuE;IACzE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,cAAc,EAAE,CAAC;aACd,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,0DAA0D,CAAC;QACvE,YAAY,EAAE,CAAC;aACZ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,qEAAqE,CAAC;QAClF,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,8DAA8D,CAAC;KAC5E,CAAC;IACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY;YAC9B,CAAC,CAAC,gBAAgB,IAAI,CAAC,YAAY,EAAE;YACrC,CAAC,CAAC,IAAI,CAAC,cAAc;gBACnB,CAAC,CAAC,IAAI,IAAI,CAAC,cAAc,GAAG;gBAC5B,CAAC,CAAC,yBAAyB,CAAC;QAChC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAEnE,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,qDAAqD,MAAM,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EAoCZ;iBAClE;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Barrel export for all prompt definitions.
|
|
3
|
+
* @module src/mcp-server/prompts/definitions/index
|
|
4
|
+
*/
|
|
5
|
+
export { campaignAnalysisPrompt } from './campaign-analysis.prompt.js';
|
|
6
|
+
export { moneyTrailPrompt } from './money-trail.prompt.js';
|
|
7
|
+
export declare const allPromptDefinitions: import("@cyanheads/mcp-ts-core").PromptDefinition<import("zod").ZodObject<{
|
|
8
|
+
candidate_name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
9
|
+
candidate_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
10
|
+
cycle: import("zod").ZodOptional<import("zod").ZodString>;
|
|
11
|
+
}, import("zod/v4/core").$strip>>[];
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,eAAO,MAAM,oBAAoB;;;;mCAA6C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Barrel export for all prompt definitions.
|
|
3
|
+
* @module src/mcp-server/prompts/definitions/index
|
|
4
|
+
*/
|
|
5
|
+
export { campaignAnalysisPrompt } from './campaign-analysis.prompt.js';
|
|
6
|
+
export { moneyTrailPrompt } from './money-trail.prompt.js';
|
|
7
|
+
import { campaignAnalysisPrompt } from './campaign-analysis.prompt.js';
|
|
8
|
+
import { moneyTrailPrompt } from './money-trail.prompt.js';
|
|
9
|
+
export const allPromptDefinitions = [moneyTrailPrompt, campaignAnalysisPrompt];
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Prompt template for tracing the flow of money around a candidate or race.
|
|
3
|
+
* Guides the agent through a multi-tool investigation of direct fundraising,
|
|
4
|
+
* PAC support, independent expenditures, and party spending.
|
|
5
|
+
* @module src/mcp-server/prompts/definitions/money-trail.prompt
|
|
6
|
+
*/
|
|
7
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
8
|
+
export declare const moneyTrailPrompt: import("@cyanheads/mcp-ts-core").PromptDefinition<z.ZodObject<{
|
|
9
|
+
candidate_name: z.ZodOptional<z.ZodString>;
|
|
10
|
+
candidate_id: z.ZodOptional<z.ZodString>;
|
|
11
|
+
cycle: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
//# sourceMappingURL=money-trail.prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money-trail.prompt.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/money-trail.prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAU,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,eAAO,MAAM,gBAAgB;;;;kBAuE3B,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Prompt template for tracing the flow of money around a candidate or race.
|
|
3
|
+
* Guides the agent through a multi-tool investigation of direct fundraising,
|
|
4
|
+
* PAC support, independent expenditures, and party spending.
|
|
5
|
+
* @module src/mcp-server/prompts/definitions/money-trail.prompt
|
|
6
|
+
*/
|
|
7
|
+
import { prompt, z } from '@cyanheads/mcp-ts-core';
|
|
8
|
+
export const moneyTrailPrompt = prompt('openfec_money_trail', {
|
|
9
|
+
description: 'Framework for tracing the flow of money around a candidate or race — ' +
|
|
10
|
+
'direct fundraising, PAC support, independent expenditures, and party spending. ' +
|
|
11
|
+
'Guides the agent through a multi-tool investigation.',
|
|
12
|
+
args: z.object({
|
|
13
|
+
candidate_name: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Candidate name to investigate. Provide this or candidate_id.'),
|
|
17
|
+
candidate_id: z
|
|
18
|
+
.string()
|
|
19
|
+
.optional()
|
|
20
|
+
.describe('FEC candidate ID (e.g., P00003392). Provide this or candidate_name.'),
|
|
21
|
+
cycle: z
|
|
22
|
+
.string()
|
|
23
|
+
.optional()
|
|
24
|
+
.describe('Election cycle year (e.g., 2024). Defaults to current cycle.'),
|
|
25
|
+
}),
|
|
26
|
+
generate: (args) => {
|
|
27
|
+
const target = args.candidate_id
|
|
28
|
+
? `candidate ID ${args.candidate_id}`
|
|
29
|
+
: args.candidate_name
|
|
30
|
+
? `"${args.candidate_name}"`
|
|
31
|
+
: 'the specified candidate';
|
|
32
|
+
const cycleNote = args.cycle ? ` for the ${args.cycle} cycle` : '';
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
role: 'user',
|
|
36
|
+
content: {
|
|
37
|
+
type: 'text',
|
|
38
|
+
text: `Trace the full money trail for ${target}${cycleNote}. Use the OpenFEC tools to investigate each layer:
|
|
39
|
+
|
|
40
|
+
## Step 1: Identify the candidate
|
|
41
|
+
${args.candidate_id ? `Look up candidate ${args.candidate_id} using openfec_search_candidates with include_totals=true.` : `Search for "${args.candidate_name}" using openfec_search_candidates. Once found, note the candidate_id and look up their financial totals.`}
|
|
42
|
+
|
|
43
|
+
## Step 2: Map their committees
|
|
44
|
+
Use openfec_search_committees with the candidate_id to find:
|
|
45
|
+
- Principal campaign committee
|
|
46
|
+
- Leadership PACs
|
|
47
|
+
- Joint fundraising committees
|
|
48
|
+
|
|
49
|
+
## Step 3: Follow direct fundraising
|
|
50
|
+
For the principal campaign committee, use openfec_search_contributions to examine:
|
|
51
|
+
- Overall totals (include_totals from step 1)
|
|
52
|
+
- Contribution breakdown by size (mode: by_size)
|
|
53
|
+
- Top donor states (mode: by_state)
|
|
54
|
+
- Top employer/occupation patterns (mode: by_employer, by_occupation)
|
|
55
|
+
|
|
56
|
+
## Step 4: Track outside money
|
|
57
|
+
Use openfec_search_expenditures with the candidate_id to find:
|
|
58
|
+
- Independent expenditures supporting this candidate (support_oppose: S)
|
|
59
|
+
- Independent expenditures opposing this candidate (support_oppose: O)
|
|
60
|
+
- Which Super PACs and groups are involved (mode: by_candidate for summary)
|
|
61
|
+
|
|
62
|
+
## Step 5: Examine spending
|
|
63
|
+
For the principal campaign committee, use openfec_search_disbursements to see:
|
|
64
|
+
- Spending by purpose category (mode: by_purpose)
|
|
65
|
+
- Top recipients (mode: by_recipient)
|
|
66
|
+
|
|
67
|
+
## Step 6: Synthesize
|
|
68
|
+
Summarize the complete money picture:
|
|
69
|
+
- Total raised vs. spent vs. cash on hand
|
|
70
|
+
- Donor composition (small vs. large donors, top industries)
|
|
71
|
+
- Outside money landscape (supporting vs. opposing)
|
|
72
|
+
- Key financial strengths and vulnerabilities`,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=money-trail.prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money-trail.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/money-trail.prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,qBAAqB,EAAE;IAC5D,WAAW,EACT,uEAAuE;QACvE,iFAAiF;QACjF,sDAAsD;IACxD,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,cAAc,EAAE,CAAC;aACd,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,8DAA8D,CAAC;QAC3E,YAAY,EAAE,CAAC;aACZ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,qEAAqE,CAAC;QAClF,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,8DAA8D,CAAC;KAC5E,CAAC;IACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY;YAC9B,CAAC,CAAC,gBAAgB,IAAI,CAAC,YAAY,EAAE;YACrC,CAAC,CAAC,IAAI,CAAC,cAAc;gBACnB,CAAC,CAAC,IAAI,IAAI,CAAC,cAAc,GAAG;gBAC5B,CAAC,CAAC,yBAAyB,CAAC;QAChC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAEnE,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,kCAAkC,MAAM,GAAG,SAAS;;;EAGlE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,qBAAqB,IAAI,CAAC,YAAY,4DAA4D,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,cAAc,0GAA0G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CA+BzN;iBACrC;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Resource for fetching a candidate profile by FEC candidate ID.
|
|
3
|
+
* URI: openfec://candidate/{candidate_id}
|
|
4
|
+
* @module src/mcp-server/resources/definitions/candidate.resource
|
|
5
|
+
*/
|
|
6
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
export declare const candidateResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
|
|
8
|
+
candidate_id: z.ZodString;
|
|
9
|
+
}, z.core.$strip>, undefined>;
|
|
10
|
+
//# sourceMappingURL=candidate.resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candidate.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/candidate.resource.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAGrD,eAAO,MAAM,iBAAiB;;6BAsB5B,CAAC"}
|