@pipeworx/mcp-congress 0.1.0
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/LICENSE +21 -0
- package/README.md +34 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +300 -0
- package/tsconfig.json +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pipeworx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# mcp-congress
|
|
2
|
+
|
|
3
|
+
Congress MCP — US Congress data via GovTrack API (free, no auth required)
|
|
4
|
+
|
|
5
|
+
Part of the [Pipeworx](https://pipeworx.io) open MCP gateway.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
Add to your MCP client config:
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"mcpServers": {
|
|
19
|
+
"congress": {
|
|
20
|
+
"url": "https://gateway.pipeworx.io/congress/mcp"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or use the CLI:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx pipeworx use congress
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-congress",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Congress MCP — US Congress data via GovTrack API (free, no auth required)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "congress"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-congress"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.7.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.pipeworx-io/congress",
|
|
4
|
+
"title": "congress",
|
|
5
|
+
"description": "Congress MCP — US Congress data via GovTrack API (free, no auth required)",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/congress",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-congress",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/congress/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
interface McpToolDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, unknown>;
|
|
7
|
+
required?: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface McpToolExport {
|
|
12
|
+
tools: McpToolDefinition[];
|
|
13
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Congress MCP — US Congress data via GovTrack API (free, no auth required)
|
|
18
|
+
*
|
|
19
|
+
* Tools:
|
|
20
|
+
* - search_bills: Search congressional bills by keyword
|
|
21
|
+
* - get_bill: Get a single bill by GovTrack bill ID
|
|
22
|
+
* - get_members: Get current members of Congress
|
|
23
|
+
* - get_votes: Get recent congressional votes
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const BASE_URL = 'https://www.govtrack.us/api/v2';
|
|
28
|
+
|
|
29
|
+
// --- Raw API types ---
|
|
30
|
+
|
|
31
|
+
type RawBill = {
|
|
32
|
+
id: number;
|
|
33
|
+
bill_type?: string | null;
|
|
34
|
+
bill_type_label?: string | null;
|
|
35
|
+
number?: number | null;
|
|
36
|
+
congress?: number | null;
|
|
37
|
+
title?: string | null;
|
|
38
|
+
title_without_number?: string | null;
|
|
39
|
+
current_status?: string | null;
|
|
40
|
+
current_status_label?: string | null;
|
|
41
|
+
current_status_date?: string | null;
|
|
42
|
+
introduced_date?: string | null;
|
|
43
|
+
link?: string | null;
|
|
44
|
+
sponsor?: {
|
|
45
|
+
id?: number | null;
|
|
46
|
+
name?: string | null;
|
|
47
|
+
sortname?: string | null;
|
|
48
|
+
} | null;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
type RawMemberRole = {
|
|
52
|
+
id?: number | null;
|
|
53
|
+
person?: {
|
|
54
|
+
id?: number | null;
|
|
55
|
+
name?: string | null;
|
|
56
|
+
sortname?: string | null;
|
|
57
|
+
gender?: string | null;
|
|
58
|
+
gender_label?: string | null;
|
|
59
|
+
birthday?: string | null;
|
|
60
|
+
link?: string | null;
|
|
61
|
+
} | null;
|
|
62
|
+
role_type?: string | null;
|
|
63
|
+
role_type_label?: string | null;
|
|
64
|
+
state?: string | null;
|
|
65
|
+
state_name?: string | null;
|
|
66
|
+
district?: number | null;
|
|
67
|
+
party?: string | null;
|
|
68
|
+
title?: string | null;
|
|
69
|
+
title_long?: string | null;
|
|
70
|
+
startdate?: string | null;
|
|
71
|
+
enddate?: string | null;
|
|
72
|
+
congress_numbers?: number[] | null;
|
|
73
|
+
current?: boolean | null;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
type RawVote = {
|
|
77
|
+
id?: number | null;
|
|
78
|
+
congress?: number | null;
|
|
79
|
+
session?: number | null;
|
|
80
|
+
chamber?: string | null;
|
|
81
|
+
chamber_label?: string | null;
|
|
82
|
+
number?: number | null;
|
|
83
|
+
question?: string | null;
|
|
84
|
+
question_details?: string | null;
|
|
85
|
+
result?: string | null;
|
|
86
|
+
category?: string | null;
|
|
87
|
+
category_label?: string | null;
|
|
88
|
+
created?: string | null;
|
|
89
|
+
total_plus?: number | null;
|
|
90
|
+
total_minus?: number | null;
|
|
91
|
+
total_other?: number | null;
|
|
92
|
+
link?: string | null;
|
|
93
|
+
related_bill?: {
|
|
94
|
+
id?: number | null;
|
|
95
|
+
title?: string | null;
|
|
96
|
+
} | null;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
type GovTrackListResponse<T> = {
|
|
100
|
+
meta?: { total_count?: number; offset?: number; limit?: number } | null;
|
|
101
|
+
objects: T[];
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// --- Formatters ---
|
|
105
|
+
|
|
106
|
+
function formatBill(b: RawBill) {
|
|
107
|
+
return {
|
|
108
|
+
id: b.id,
|
|
109
|
+
bill_type: b.bill_type ?? null,
|
|
110
|
+
bill_type_label: b.bill_type_label ?? null,
|
|
111
|
+
number: b.number ?? null,
|
|
112
|
+
congress: b.congress ?? null,
|
|
113
|
+
title: b.title ?? null,
|
|
114
|
+
title_without_number: b.title_without_number ?? null,
|
|
115
|
+
status: b.current_status ?? null,
|
|
116
|
+
status_label: b.current_status_label ?? null,
|
|
117
|
+
status_date: b.current_status_date ?? null,
|
|
118
|
+
introduced_date: b.introduced_date ?? null,
|
|
119
|
+
sponsor_name: b.sponsor?.name ?? null,
|
|
120
|
+
link: b.link ?? null,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function formatMember(r: RawMemberRole) {
|
|
125
|
+
return {
|
|
126
|
+
role_id: r.id ?? null,
|
|
127
|
+
person_id: r.person?.id ?? null,
|
|
128
|
+
name: r.person?.name ?? null,
|
|
129
|
+
sortname: r.person?.sortname ?? null,
|
|
130
|
+
gender: r.person?.gender_label ?? null,
|
|
131
|
+
birthday: r.person?.birthday ?? null,
|
|
132
|
+
role_type: r.role_type ?? null,
|
|
133
|
+
title: r.title_long ?? r.title ?? null,
|
|
134
|
+
party: r.party ?? null,
|
|
135
|
+
state: r.state ?? null,
|
|
136
|
+
state_name: r.state_name ?? null,
|
|
137
|
+
district: r.district ?? null,
|
|
138
|
+
startdate: r.startdate ?? null,
|
|
139
|
+
enddate: r.enddate ?? null,
|
|
140
|
+
link: r.person?.link ?? null,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function formatVote(v: RawVote) {
|
|
145
|
+
return {
|
|
146
|
+
id: v.id ?? null,
|
|
147
|
+
congress: v.congress ?? null,
|
|
148
|
+
session: v.session ?? null,
|
|
149
|
+
chamber: v.chamber_label ?? v.chamber ?? null,
|
|
150
|
+
number: v.number ?? null,
|
|
151
|
+
question: v.question ?? null,
|
|
152
|
+
question_details: v.question_details ?? null,
|
|
153
|
+
result: v.result ?? null,
|
|
154
|
+
category: v.category_label ?? v.category ?? null,
|
|
155
|
+
created: v.created ?? null,
|
|
156
|
+
yes_votes: v.total_plus ?? null,
|
|
157
|
+
no_votes: v.total_minus ?? null,
|
|
158
|
+
other_votes: v.total_other ?? null,
|
|
159
|
+
related_bill_title: v.related_bill?.title ?? null,
|
|
160
|
+
link: v.link ?? null,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// --- Tool definitions ---
|
|
165
|
+
|
|
166
|
+
const tools: McpToolExport['tools'] = [
|
|
167
|
+
{
|
|
168
|
+
name: 'search_bills',
|
|
169
|
+
description:
|
|
170
|
+
'Search US congressional bills by keyword. Returns bill type, number, title, status, sponsor, and introduction date.',
|
|
171
|
+
inputSchema: {
|
|
172
|
+
type: 'object',
|
|
173
|
+
properties: {
|
|
174
|
+
query: { type: 'string', description: 'Keywords to search for in bill titles' },
|
|
175
|
+
limit: { type: 'number', description: 'Number of results to return (default: 10, max: 100)' },
|
|
176
|
+
},
|
|
177
|
+
required: ['query'],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: 'get_bill',
|
|
182
|
+
description:
|
|
183
|
+
'Get full details for a single congressional bill by its GovTrack bill ID.',
|
|
184
|
+
inputSchema: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
id: { type: 'number', description: 'GovTrack bill ID (numeric)' },
|
|
188
|
+
},
|
|
189
|
+
required: ['id'],
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: 'get_members',
|
|
194
|
+
description:
|
|
195
|
+
'Get current members of Congress (senators and representatives). Returns name, party, state, district, and title.',
|
|
196
|
+
inputSchema: {
|
|
197
|
+
type: 'object',
|
|
198
|
+
properties: {
|
|
199
|
+
limit: { type: 'number', description: 'Number of results to return (default: 50, max: 600)' },
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: 'get_votes',
|
|
205
|
+
description:
|
|
206
|
+
'Get recent congressional votes. Returns question, result, chamber, vote counts, and related bill if any.',
|
|
207
|
+
inputSchema: {
|
|
208
|
+
type: 'object',
|
|
209
|
+
properties: {
|
|
210
|
+
limit: { type: 'number', description: 'Number of votes to return (default: 20, max: 100)' },
|
|
211
|
+
congress: { type: 'number', description: 'Congress number to filter by (e.g., 119)' },
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
];
|
|
216
|
+
|
|
217
|
+
// --- callTool dispatcher ---
|
|
218
|
+
|
|
219
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
220
|
+
switch (name) {
|
|
221
|
+
case 'search_bills':
|
|
222
|
+
return searchBills(args.query as string, (args.limit as number) ?? 10);
|
|
223
|
+
case 'get_bill':
|
|
224
|
+
return getBill(args.id as number);
|
|
225
|
+
case 'get_members':
|
|
226
|
+
return getMembers((args.limit as number) ?? 50);
|
|
227
|
+
case 'get_votes':
|
|
228
|
+
return getVotes((args.limit as number) ?? 20, args.congress as number | undefined);
|
|
229
|
+
default:
|
|
230
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// --- Tool implementations ---
|
|
235
|
+
|
|
236
|
+
async function searchBills(query: string, limit: number) {
|
|
237
|
+
const count = Math.min(Math.max(1, limit), 100);
|
|
238
|
+
const params = new URLSearchParams({
|
|
239
|
+
q: query,
|
|
240
|
+
limit: String(count),
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
const res = await fetch(`${BASE_URL}/bill?${params}`);
|
|
244
|
+
if (!res.ok) throw new Error(`GovTrack API error: ${res.status}`);
|
|
245
|
+
|
|
246
|
+
const data = (await res.json()) as GovTrackListResponse<RawBill>;
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
query,
|
|
250
|
+
total: data.meta?.total_count ?? data.objects.length,
|
|
251
|
+
returned: data.objects.length,
|
|
252
|
+
bills: data.objects.map(formatBill),
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async function getBill(id: number) {
|
|
257
|
+
const res = await fetch(`${BASE_URL}/bill/${id}`);
|
|
258
|
+
if (!res.ok) throw new Error(`GovTrack API error: ${res.status}`);
|
|
259
|
+
|
|
260
|
+
const data = (await res.json()) as RawBill;
|
|
261
|
+
return formatBill(data);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
async function getMembers(limit: number) {
|
|
265
|
+
const count = Math.min(Math.max(1, limit), 600);
|
|
266
|
+
const params = new URLSearchParams({
|
|
267
|
+
current: 'true',
|
|
268
|
+
limit: String(count),
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
const res = await fetch(`${BASE_URL}/role?${params}`);
|
|
272
|
+
if (!res.ok) throw new Error(`GovTrack API error: ${res.status}`);
|
|
273
|
+
|
|
274
|
+
const data = (await res.json()) as GovTrackListResponse<RawMemberRole>;
|
|
275
|
+
|
|
276
|
+
return {
|
|
277
|
+
total: data.meta?.total_count ?? data.objects.length,
|
|
278
|
+
returned: data.objects.length,
|
|
279
|
+
members: data.objects.map(formatMember),
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
async function getVotes(limit: number, congress?: number) {
|
|
284
|
+
const count = Math.min(Math.max(1, limit), 100);
|
|
285
|
+
const params = new URLSearchParams({ limit: String(count) });
|
|
286
|
+
if (congress != null) params.set('congress', String(congress));
|
|
287
|
+
|
|
288
|
+
const res = await fetch(`${BASE_URL}/vote?${params}`);
|
|
289
|
+
if (!res.ok) throw new Error(`GovTrack API error: ${res.status}`);
|
|
290
|
+
|
|
291
|
+
const data = (await res.json()) as GovTrackListResponse<RawVote>;
|
|
292
|
+
|
|
293
|
+
return {
|
|
294
|
+
total: data.meta?.total_count ?? data.objects.length,
|
|
295
|
+
returned: data.objects.length,
|
|
296
|
+
votes: data.objects.map(formatVote),
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export default { tools, callTool } satisfies McpToolExport;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"rootDir": "src",
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|