@pipeworx/mcp-college-scorecard 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 +55 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +210 -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,55 @@
|
|
|
1
|
+
# mcp-college-scorecard
|
|
2
|
+
|
|
3
|
+
College Scorecard MCP — US Department of Education College Scorecard API
|
|
4
|
+
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 965+ live data sources.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"mcpServers": {
|
|
19
|
+
"college-scorecard": {
|
|
20
|
+
"url": "https://gateway.pipeworx.io/college-scorecard/mcp"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or connect to the full Pipeworx gateway for access to all 965+ data sources:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"pipeworx": {
|
|
32
|
+
"url": "https://gateway.pipeworx.io/mcp"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Using with ask_pipeworx
|
|
39
|
+
|
|
40
|
+
Instead of calling tools directly, you can ask questions in plain English:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
ask_pipeworx({ question: "your question about College Scorecard data" })
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The gateway picks the right tool and fills the arguments automatically.
|
|
47
|
+
|
|
48
|
+
## More
|
|
49
|
+
|
|
50
|
+
- [All tools and guides](https://github.com/pipeworx-io/examples)
|
|
51
|
+
- [pipeworx.io](https://pipeworx.io)
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-college-scorecard",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "College Scorecard MCP — US Department of Education College Scorecard API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "college-scorecard"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-college-scorecard"
|
|
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/college-scorecard",
|
|
4
|
+
"title": "College Scorecard",
|
|
5
|
+
"description": "College Scorecard MCP — US Department of Education College Scorecard API",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/college-scorecard",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-college-scorecard",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/college-scorecard/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
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
|
+
meter?: { credits: number };
|
|
15
|
+
cost?: Record<string, unknown>;
|
|
16
|
+
provider?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* College Scorecard MCP — US Department of Education College Scorecard API
|
|
21
|
+
*
|
|
22
|
+
* BYO key: requires a free api.data.gov API key from https://api.data.gov/signup/
|
|
23
|
+
* Passed via _apiKey parameter.
|
|
24
|
+
*
|
|
25
|
+
* Tools:
|
|
26
|
+
* - search_schools: search colleges/universities by name, state, or both
|
|
27
|
+
* - get_school: get detailed info for a school by its College Scorecard ID
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const BASE_URL = 'https://api.data.gov/ed/collegescorecard/v1';
|
|
32
|
+
|
|
33
|
+
// --- Helpers ---
|
|
34
|
+
|
|
35
|
+
function extractKey(args: Record<string, unknown>): string {
|
|
36
|
+
const key = args._apiKey as string;
|
|
37
|
+
delete args._apiKey;
|
|
38
|
+
if (!key) throw new Error('College Scorecard API key required. Get one free at https://api.data.gov/signup/ and pass via _apiKey.');
|
|
39
|
+
return key;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// --- Raw API types ---
|
|
43
|
+
|
|
44
|
+
type RawSchool = {
|
|
45
|
+
id?: number | null;
|
|
46
|
+
'school.name'?: string | null;
|
|
47
|
+
'school.city'?: string | null;
|
|
48
|
+
'school.state'?: string | null;
|
|
49
|
+
'school.zip'?: string | null;
|
|
50
|
+
'school.school_url'?: string | null;
|
|
51
|
+
'school.ownership'?: number | null;
|
|
52
|
+
'school.locale'?: number | null;
|
|
53
|
+
'school.carnegie_basic'?: number | null;
|
|
54
|
+
'latest.student.size'?: number | null;
|
|
55
|
+
'latest.admissions.admission_rate.overall'?: number | null;
|
|
56
|
+
'latest.cost.tuition.in_state'?: number | null;
|
|
57
|
+
'latest.cost.tuition.out_of_state'?: number | null;
|
|
58
|
+
'latest.earnings.10_yrs_after_entry.median'?: number | null;
|
|
59
|
+
'latest.completion.rate_suppressed.overall'?: number | null;
|
|
60
|
+
'latest.aid.median_debt.completers.overall'?: number | null;
|
|
61
|
+
'latest.programs.cip4_digit'?: { code?: string; title?: string }[] | null;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
type SearchResponse = {
|
|
65
|
+
metadata?: { total?: number; page?: number; per_page?: number } | null;
|
|
66
|
+
results?: RawSchool[];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const OWNERSHIP_MAP: Record<number, string> = {
|
|
70
|
+
1: 'Public',
|
|
71
|
+
2: 'Private nonprofit',
|
|
72
|
+
3: 'Private for-profit',
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// --- Formatters ---
|
|
76
|
+
|
|
77
|
+
function formatSchool(s: RawSchool) {
|
|
78
|
+
return {
|
|
79
|
+
id: s.id ?? null,
|
|
80
|
+
name: s['school.name'] ?? null,
|
|
81
|
+
city: s['school.city'] ?? null,
|
|
82
|
+
state: s['school.state'] ?? null,
|
|
83
|
+
zip: s['school.zip'] ?? null,
|
|
84
|
+
url: s['school.school_url'] ?? null,
|
|
85
|
+
ownership: s['school.ownership'] != null ? (OWNERSHIP_MAP[s['school.ownership']] ?? String(s['school.ownership'])) : null,
|
|
86
|
+
student_size: s['latest.student.size'] ?? null,
|
|
87
|
+
admission_rate: s['latest.admissions.admission_rate.overall'] ?? null,
|
|
88
|
+
tuition_in_state: s['latest.cost.tuition.in_state'] ?? null,
|
|
89
|
+
tuition_out_of_state: s['latest.cost.tuition.out_of_state'] ?? null,
|
|
90
|
+
median_earnings_10yr: s['latest.earnings.10_yrs_after_entry.median'] ?? null,
|
|
91
|
+
completion_rate: s['latest.completion.rate_suppressed.overall'] ?? null,
|
|
92
|
+
median_debt: s['latest.aid.median_debt.completers.overall'] ?? null,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// --- Tool definitions ---
|
|
97
|
+
|
|
98
|
+
const FIELDS = [
|
|
99
|
+
'id',
|
|
100
|
+
'school.name',
|
|
101
|
+
'school.city',
|
|
102
|
+
'school.state',
|
|
103
|
+
'school.zip',
|
|
104
|
+
'school.school_url',
|
|
105
|
+
'school.ownership',
|
|
106
|
+
'latest.student.size',
|
|
107
|
+
'latest.admissions.admission_rate.overall',
|
|
108
|
+
'latest.cost.tuition.in_state',
|
|
109
|
+
'latest.cost.tuition.out_of_state',
|
|
110
|
+
'latest.earnings.10_yrs_after_entry.median',
|
|
111
|
+
'latest.completion.rate_suppressed.overall',
|
|
112
|
+
'latest.aid.median_debt.completers.overall',
|
|
113
|
+
].join(',');
|
|
114
|
+
|
|
115
|
+
const tools: McpToolExport['tools'] = [
|
|
116
|
+
{
|
|
117
|
+
name: 'search_schools',
|
|
118
|
+
description:
|
|
119
|
+
'Search US colleges and universities by name. Returns school name, location, tuition, admission rate, student size, median earnings, and completion rate. Example: search_schools("MIT", "MA").',
|
|
120
|
+
inputSchema: {
|
|
121
|
+
type: 'object',
|
|
122
|
+
properties: {
|
|
123
|
+
_apiKey: { type: 'string', description: 'api.data.gov API key' },
|
|
124
|
+
query: { type: 'string', description: 'School name to search for (e.g., "Stanford", "community college")' },
|
|
125
|
+
state: { type: 'string', description: 'Two-letter state code to filter (e.g., "CA", "NY")' },
|
|
126
|
+
limit: { type: 'number', description: 'Number of results to return (default: 10, max: 100)' },
|
|
127
|
+
},
|
|
128
|
+
required: ['_apiKey', 'query'],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'get_school',
|
|
133
|
+
description:
|
|
134
|
+
'Get detailed info for a specific college by its College Scorecard ID. Returns tuition, admission rate, student size, median earnings after 10 years, completion rate, and median debt.',
|
|
135
|
+
inputSchema: {
|
|
136
|
+
type: 'object',
|
|
137
|
+
properties: {
|
|
138
|
+
_apiKey: { type: 'string', description: 'api.data.gov API key' },
|
|
139
|
+
id: { type: 'number', description: 'College Scorecard school ID (numeric, from search results)' },
|
|
140
|
+
},
|
|
141
|
+
required: ['_apiKey', 'id'],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
];
|
|
145
|
+
|
|
146
|
+
// --- callTool dispatcher ---
|
|
147
|
+
|
|
148
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
149
|
+
const key = extractKey(args);
|
|
150
|
+
|
|
151
|
+
switch (name) {
|
|
152
|
+
case 'search_schools':
|
|
153
|
+
return searchSchools(key, args.query as string, args.state as string | undefined, (args.limit as number) ?? 10);
|
|
154
|
+
case 'get_school':
|
|
155
|
+
return getSchool(key, args.id as number);
|
|
156
|
+
default:
|
|
157
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// --- Tool implementations ---
|
|
162
|
+
|
|
163
|
+
async function searchSchools(apiKey: string, query: string, state?: string, limit?: number) {
|
|
164
|
+
const count = Math.min(Math.max(1, limit ?? 10), 100);
|
|
165
|
+
const params = new URLSearchParams({
|
|
166
|
+
'school.name': query,
|
|
167
|
+
fields: FIELDS,
|
|
168
|
+
per_page: String(count),
|
|
169
|
+
api_key: apiKey,
|
|
170
|
+
});
|
|
171
|
+
if (state) params.set('school.state', state.toUpperCase());
|
|
172
|
+
|
|
173
|
+
const res = await fetch(`${BASE_URL}/schools?${params}`);
|
|
174
|
+
if (!res.ok) {
|
|
175
|
+
const text = await res.text();
|
|
176
|
+
throw new Error(`College Scorecard API error (${res.status}): ${text}`);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const data = (await res.json()) as SearchResponse;
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
query,
|
|
183
|
+
state: state?.toUpperCase() ?? null,
|
|
184
|
+
total: data.metadata?.total ?? 0,
|
|
185
|
+
returned: (data.results ?? []).length,
|
|
186
|
+
schools: (data.results ?? []).map(formatSchool),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async function getSchool(apiKey: string, id: number) {
|
|
191
|
+
const params = new URLSearchParams({
|
|
192
|
+
fields: FIELDS,
|
|
193
|
+
api_key: apiKey,
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const res = await fetch(`${BASE_URL}/schools/${id}?${params}`);
|
|
197
|
+
if (res.status === 404) throw new Error(`No school found with ID: ${id}`);
|
|
198
|
+
if (!res.ok) {
|
|
199
|
+
const text = await res.text();
|
|
200
|
+
throw new Error(`College Scorecard API error (${res.status}): ${text}`);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const data = (await res.json()) as SearchResponse;
|
|
204
|
+
const school = data.results?.[0];
|
|
205
|
+
if (!school) throw new Error(`No school found with ID: ${id}`);
|
|
206
|
+
|
|
207
|
+
return formatSchool(school);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export default { tools, callTool, meter: { credits: 5 } } 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
|
+
}
|