@pipeworx/mcp-mast-nasa 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 +59 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +139 -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,59 @@
|
|
|
1
|
+
# mcp-mast-nasa
|
|
2
|
+
|
|
3
|
+
MAST (Mikulski Archive for Space Telescopes) — Hubble/JWST/Kepler/TESS
|
|
4
|
+
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 250+ live data sources.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
| `cone_search` | Search MAST around (RA, Dec). |
|
|
12
|
+
| `mission_search` | Mission-scoped search with arbitrary criteria. |
|
|
13
|
+
| `caom` | Generic CAOM (Common Archive Observation Model) query. |
|
|
14
|
+
| `lookup_name` | Resolve target name → coords. |
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"mast-nasa": {
|
|
24
|
+
"url": "https://gateway.pipeworx.io/mast-nasa/mcp"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or connect to the full Pipeworx gateway for access to all 250+ data sources:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"pipeworx": {
|
|
36
|
+
"url": "https://gateway.pipeworx.io/mcp"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Using with ask_pipeworx
|
|
43
|
+
|
|
44
|
+
Instead of calling tools directly, you can ask questions in plain English:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
ask_pipeworx({ question: "your question about Mast Nasa data" })
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The gateway picks the right tool and fills the arguments automatically.
|
|
51
|
+
|
|
52
|
+
## More
|
|
53
|
+
|
|
54
|
+
- [All tools and guides](https://github.com/pipeworx-io/examples)
|
|
55
|
+
- [pipeworx.io](https://pipeworx.io)
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-mast-nasa",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MAST (Mikulski Archive for Space Telescopes) — Hubble/JWST/Kepler/TESS",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "mast-nasa"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-mast-nasa"
|
|
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/mast-nasa",
|
|
4
|
+
"title": "Mast Nasa",
|
|
5
|
+
"description": "MAST (Mikulski Archive for Space Telescopes) — Hubble/JWST/Kepler/TESS",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/mast-nasa",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-mast-nasa",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/mast-nasa/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
* MAST MCP — Space Telescopes archive.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const BASE = 'https://mast.stsci.edu/api/v0';
|
|
25
|
+
const UA = 'pipeworx-mcp-mast-nasa/1.0 (+https://pipeworx.io)';
|
|
26
|
+
|
|
27
|
+
const tools: McpToolExport['tools'] = [
|
|
28
|
+
{
|
|
29
|
+
name: 'cone_search',
|
|
30
|
+
description: 'Search MAST around (RA, Dec).',
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
ra: { type: 'number' },
|
|
35
|
+
dec: { type: 'number' },
|
|
36
|
+
radius_arcmin: { type: 'number', description: 'Default 1.0' },
|
|
37
|
+
mission: { type: 'string', description: 'e.g. "HST", "JWST". Optional.' },
|
|
38
|
+
limit: { type: 'number' },
|
|
39
|
+
},
|
|
40
|
+
required: ['ra', 'dec'],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'mission_search',
|
|
45
|
+
description: 'Mission-scoped search with arbitrary criteria.',
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
mission: { type: 'string', description: 'e.g. "HST", "JWST", "Pan-STARRS", "K2", "Kepler", "GALEX", "TESS"' },
|
|
50
|
+
criteria: { type: 'object', description: 'Object of MAST filter columns → values.' },
|
|
51
|
+
limit: { type: 'number' },
|
|
52
|
+
},
|
|
53
|
+
required: ['mission', 'criteria'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'caom',
|
|
58
|
+
description: 'Generic CAOM (Common Archive Observation Model) query.',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
query: { type: 'object', description: 'Raw MAST request body (service + params).' },
|
|
63
|
+
},
|
|
64
|
+
required: ['query'],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'lookup_name',
|
|
69
|
+
description: 'Resolve target name → coords.',
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: { name: { type: 'string' } },
|
|
73
|
+
required: ['name'],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
79
|
+
switch (name) {
|
|
80
|
+
case 'cone_search': {
|
|
81
|
+
const body = {
|
|
82
|
+
service: 'Mast.Caom.Cone',
|
|
83
|
+
params: {
|
|
84
|
+
ra: args.ra,
|
|
85
|
+
dec: args.dec,
|
|
86
|
+
radius: ((args.radius_arcmin as number) ?? 1) / 60, // MAST expects degrees
|
|
87
|
+
},
|
|
88
|
+
format: 'json',
|
|
89
|
+
pagesize: Math.min(5000, Math.max(1, (args.limit as number) ?? 100)),
|
|
90
|
+
page: 1,
|
|
91
|
+
};
|
|
92
|
+
const result = await mastPost(body);
|
|
93
|
+
if (args.mission && (result as any)?.data) {
|
|
94
|
+
const filtered = (result as any).data.filter((r: any) => (r.obs_collection ?? '').toLowerCase() === String(args.mission).toLowerCase());
|
|
95
|
+
return { ...(result as object), data: filtered };
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
case 'mission_search': {
|
|
100
|
+
const body = {
|
|
101
|
+
service: 'Mast.Caom.Filtered',
|
|
102
|
+
format: 'json',
|
|
103
|
+
params: {
|
|
104
|
+
columns: '*',
|
|
105
|
+
filters: Object.entries((args.criteria ?? {}) as Record<string, unknown>).map(([k, v]) => ({ paramName: k, values: Array.isArray(v) ? v : [v] })),
|
|
106
|
+
},
|
|
107
|
+
pagesize: Math.min(5000, Math.max(1, (args.limit as number) ?? 100)),
|
|
108
|
+
page: 1,
|
|
109
|
+
};
|
|
110
|
+
return mastPost(body);
|
|
111
|
+
}
|
|
112
|
+
case 'caom':
|
|
113
|
+
return mastPost(args.query);
|
|
114
|
+
case 'lookup_name': {
|
|
115
|
+
const body = { service: 'Mast.Name.Lookup', params: { input: reqStr(args, 'name', '"M31"'), format: 'json' }, format: 'json' };
|
|
116
|
+
return mastPost(body);
|
|
117
|
+
}
|
|
118
|
+
default:
|
|
119
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async function mastPost(body: unknown): Promise<unknown> {
|
|
124
|
+
const res = await fetch(`${BASE}/invoke`, {
|
|
125
|
+
method: 'POST',
|
|
126
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json', 'User-Agent': UA },
|
|
127
|
+
body: new URLSearchParams({ request: JSON.stringify(body) }),
|
|
128
|
+
});
|
|
129
|
+
if (!res.ok) throw new Error(`MAST: ${res.status} ${await res.text().then((t) => t.slice(0, 200))}`);
|
|
130
|
+
return res.json();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function reqStr(args: Record<string, unknown>, key: string, example: string): string {
|
|
134
|
+
const v = args[key];
|
|
135
|
+
if (typeof v !== 'string' || !v.trim()) throw new Error(`Required argument "${key}" is missing. Pass a string like ${example}.`);
|
|
136
|
+
return v;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export default { tools, callTool, meter: { credits: 1 } } 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
|
+
}
|