@pipeworx/mcp-noirlab-datalab 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 +155 -0
- package/bin/cli.js +17 -0
- package/package.json +32 -0
- package/server.json +18 -0
- package/src/index.ts +1051 -0
- package/src/server.ts +45 -0
- package/tsconfig.json +18 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mojibake Inc.
|
|
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,155 @@
|
|
|
1
|
+
# @pipeworx/noirlab-datalab
|
|
2
|
+
|
|
3
|
+
NSF NOIRLab's Astro Data Lab — the DECam, Mayall and Blanco survey catalogues (Legacy
|
|
4
|
+
Surveys/DECaLS, DES, DELVE, DECaPS, SMASH, NSC) alongside mirrored all-sky catalogues (Gaia DR3,
|
|
5
|
+
AllWISE, CatWISE, 2MASS, SDSS, DESI), queryable as database tables. Around 130 schemas and tens of
|
|
6
|
+
billions of rows.
|
|
7
|
+
|
|
8
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1679+ live data sources.
|
|
9
|
+
|
|
10
|
+
## Tools
|
|
11
|
+
|
|
12
|
+
- `datalab_tables(schema?, table?, limit?)` — list the survey data releases, one release's tables,
|
|
13
|
+
or one table's columns. Call it first: table names are survey-specific and a guessed name is a
|
|
14
|
+
query error, not an empty result.
|
|
15
|
+
- `datalab_query(sql, limit?)` — run a read-only ADQL `SELECT`. A `TOP n` is injected when you omit
|
|
16
|
+
one, so a bare query cannot scan a billion-row table unbounded.
|
|
17
|
+
- `datalab_cone_search(table, ra, dec, radius?, columns?, limit?)` — sources within a radius of a
|
|
18
|
+
sky position, nearest first, with exact angular separation in degrees.
|
|
19
|
+
|
|
20
|
+
## Auth
|
|
21
|
+
|
|
22
|
+
Keyless — **but only through the IVOA TAP endpoint.** See the first trap below.
|
|
23
|
+
|
|
24
|
+
## Data sources
|
|
25
|
+
|
|
26
|
+
- <https://datalab.noirlab.edu/tap/sync> — `REQUEST=doQuery&LANG=ADQL&FORMAT=csv&QUERY=…`.
|
|
27
|
+
Anonymous, and the only door this pack uses.
|
|
28
|
+
|
|
29
|
+
## Traps
|
|
30
|
+
|
|
31
|
+
- **`/query/query?sql=` is NOT anonymous, despite being the documented front door.** It is what the
|
|
32
|
+
`datalab` Python client uses and what the docs lead with, but without a login it answers
|
|
33
|
+
`401 The provided security token is invalid` — and the widely-quoted
|
|
34
|
+
`X-DL-AuthToken: anonymous.0.0.anon_access` answers **HTTP 200** with the body
|
|
35
|
+
`Error in query(). Try checking that you are logged in.` A 200 carrying a failure is the worst
|
|
36
|
+
shape a failure can take, and it is why this pack speaks TAP only. Measured 2026-09-17.
|
|
37
|
+
- **TAP reports every error as HTTP 200.** Syntax errors, unknown tables, timeouts: all come back
|
|
38
|
+
200 with a VOTable whose single `INFO` element carries `QUERY_STATUS="ERROR"`. Read as data
|
|
39
|
+
that is an empty result set. Every response is checked for that element before it is parsed.
|
|
40
|
+
- **ADQL geometry is not implemented, and neither is Q3C.**
|
|
41
|
+
`CONTAINS(POINT('ICRS',ra,dec), CIRCLE('ICRS',…))` parses and is handed to PostgreSQL verbatim,
|
|
42
|
+
which answers `function circle(numeric, numeric, numeric) does not exist`. The Q3C functions the
|
|
43
|
+
backend actually has (`q3c_radial_query`) are rejected by the ADQL parser one layer up. So both
|
|
44
|
+
obvious cone-search spellings fail. `datalab_cone_search` builds the search from trigonometry
|
|
45
|
+
both layers accept: an indexable RA/Dec box (RA widened by `1/cos(dec)`, wrapping at 0h) to
|
|
46
|
+
narrow the scan, then an exact great-circle distance to trim the box corners off and order by
|
|
47
|
+
true separation.
|
|
48
|
+
- **Row limits are `SELECT TOP n`, not `LIMIT n`.** ADQL, not PostgreSQL.
|
|
49
|
+
- **Zero rows is usually footprint, not absence.** The DECam surveys cover the southern sky and the
|
|
50
|
+
Galactic plane selectively, so a northern target legitimately returns nothing from `ls_dr10` or
|
|
51
|
+
`des_dr2`. The zero-result note says to re-check against `gaia_dr3.gaia_source`, which is all-sky.
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"mcpServers": {
|
|
60
|
+
"noirlab-datalab": {
|
|
61
|
+
"url": "https://gateway.pipeworx.io/noirlab-datalab/mcp"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### What this endpoint actually serves
|
|
68
|
+
|
|
69
|
+
`tools/list` at `https://gateway.pipeworx.io/noirlab-datalab/mcp` returns the tools in the table
|
|
70
|
+
above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
|
|
71
|
+
`discover_tools`, `search_within`, `remember`/`recall` and the rest of the
|
|
72
|
+
gateway-wide set. So the tool count you see is larger than this table: a
|
|
73
|
+
single-pack endpoint currently lists roughly 30 shared tools alongside the
|
|
74
|
+
pack's own. The connection's `initialize` response states its exact scope, and
|
|
75
|
+
is the authoritative answer for a given day.
|
|
76
|
+
|
|
77
|
+
This is deliberate, not multiplexing by accident. The meta-tools are what let a
|
|
78
|
+
scoped connection answer a question this pack does not cover — via
|
|
79
|
+
`ask_pipeworx`, which routes across the whole catalog — without you adding a
|
|
80
|
+
second MCP server. There is currently no way to mount a pack endpoint without
|
|
81
|
+
them; if the extra schemas cost you more context than the routing is worth,
|
|
82
|
+
connect to the full gateway once rather than to several pack endpoints.
|
|
83
|
+
|
|
84
|
+
Or connect to the full Pipeworx gateway to get every pack's tools listed
|
|
85
|
+
directly, instead of just this one's:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"pipeworx": {
|
|
91
|
+
"url": "https://gateway.pipeworx.io/mcp"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Both URLs reach the same gateway and the same 1679+ data sources. The
|
|
98
|
+
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
|
|
99
|
+
reaches all of them from either one.
|
|
100
|
+
|
|
101
|
+
## No MCP client? Call it over HTTP
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
curl -X POST https://gateway.pipeworx.io/v1/tools/datalab_query \
|
|
105
|
+
-H 'Content-Type: application/json' \
|
|
106
|
+
-d '{"sql":"SELECT ra, dec, phot_g_mean_mag FROM gaia_dr3.gaia_source WHERE phot_g_mean_mag < 6","limit":5}'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/datalab_query`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.
|
|
110
|
+
|
|
111
|
+
## Standalone (no gateway account)
|
|
112
|
+
|
|
113
|
+
This package also runs as a local stdio MCP server — no Pipeworx account, no
|
|
114
|
+
gateway round-trip:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"mcpServers": {
|
|
119
|
+
"noirlab-datalab": {
|
|
120
|
+
"command": "npx",
|
|
121
|
+
"args": ["-y", "@pipeworx/mcp-noirlab-datalab"]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Or run it directly to confirm it starts:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npx -y @pipeworx/mcp-noirlab-datalab
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
It speaks MCP over stdin/stdout and answers `initialize`/`tools/list`/`tools/call`
|
|
134
|
+
for **only** this pack's tools — none of the shared meta-tools the gateway
|
|
135
|
+
connection above adds. Same source, same tools, no ask_pipeworx routing.
|
|
136
|
+
|
|
137
|
+
## Using with ask_pipeworx
|
|
138
|
+
|
|
139
|
+
Instead of calling tools directly, you can ask questions in plain English —
|
|
140
|
+
this works on the pack endpoint above as well as on the full gateway:
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
ask_pipeworx({ question: "your question about Noirlab Datalab data" })
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The gateway picks the right tool and fills the arguments automatically.
|
|
147
|
+
|
|
148
|
+
## More
|
|
149
|
+
|
|
150
|
+
- [Docs and guides](https://pipeworx.io/docs)
|
|
151
|
+
- [pipeworx.io](https://pipeworx.io)
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
MIT
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//
|
|
3
|
+
// Entry point for `npx @pipeworx/mcp-<slug>`.
|
|
4
|
+
//
|
|
5
|
+
// Packs ship as raw TypeScript (no build step — see publish-pack.sh for why:
|
|
6
|
+
// tsx sidesteps every extensionless-import / bare-JSON-import edge case a
|
|
7
|
+
// per-pack tsc build would have to solve one pack at a time). This file
|
|
8
|
+
// registers tsx's ESM loader programmatically, then hands off to src/server.ts,
|
|
9
|
+
// which wraps the pack's {tools, callTool} export in a stdio MCP server.
|
|
10
|
+
//
|
|
11
|
+
// Copied verbatim into every published pack repo by scripts/publish-pack.sh —
|
|
12
|
+
// edit this file, not a per-pack copy.
|
|
13
|
+
import { register } from 'tsx/esm/api';
|
|
14
|
+
|
|
15
|
+
register();
|
|
16
|
+
|
|
17
|
+
await import('../src/server.ts');
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-noirlab-datalab",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "NOIRLab Astro Data Lab — datalab.noirlab.edu.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"mcp-noirlab-datalab": "bin/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "noirlab-datalab"],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/pipeworx-io/mcp-noirlab-datalab.git"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"typecheck": "tsc --noEmit"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
22
|
+
"tsx": "^4.19.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "^5.9.3",
|
|
26
|
+
"@cloudflare/workers-types": "^4.20260405.1"
|
|
27
|
+
},
|
|
28
|
+
"pipeworx": {
|
|
29
|
+
"sourceHash": "v1-bdbdbce036ad0781055f4a9be485b7edf245fef631a779068fa6ff4251b07cad",
|
|
30
|
+
"sourceCommit": "b0fb3c31386cf0256dcf1e2f1b3440435a87ec35"
|
|
31
|
+
}
|
|
32
|
+
}
|
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/noirlab-datalab",
|
|
4
|
+
"title": "Noirlab Datalab",
|
|
5
|
+
"description": "NOIRLab Astro Data Lab — datalab.noirlab.edu.",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/noirlab-datalab",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-noirlab-datalab",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/noirlab-datalab/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|