@interstellar-tools/mcp 0.1.2 → 0.2.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/README.md +16 -21
- package/dist/bodies.d.ts +3 -3
- package/dist/bodies.d.ts.map +1 -1
- package/dist/bodies.js +10 -18
- package/dist/bodies.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -64,22 +64,22 @@ returned as `{ "rad": …, "deg": … }`.
|
|
|
64
64
|
|
|
65
65
|
## Tools
|
|
66
66
|
|
|
67
|
-
| Tool | What it computes
|
|
68
|
-
| ---------------------------- |
|
|
69
|
-
| `gravitational_parameter` | μ = G·(M + m) from masses
|
|
70
|
-
| `circular_speed` | Circular orbit speed at radius r
|
|
71
|
-
| `escape_speed` | Escape speed at radius r
|
|
72
|
-
| `vis_viva_speed` | Speed at radius r on an orbit with semi-major axis a
|
|
73
|
-
| `kepler_period` | Orbital period from semi-major axis
|
|
74
|
-
| `peri_apoapsis_radii` | Periapsis and apoapsis radii from a and e
|
|
75
|
-
| `sphere_of_influence_radius` | Laplace sphere of influence
|
|
76
|
-
| `hohmann_transfer` | Both burns, total Δv and transfer time
|
|
77
|
-
| `rocket_delta_v` | Tsiolkovsky rocket equation from Isp and masses
|
|
78
|
-
| `plane_change_delta_v` | Δv for a pure inclination change
|
|
79
|
-
| `solve_kepler` | Eccentric anomaly from mean anomaly and eccentricity
|
|
80
|
-
| `convert_anomaly` | Mean ↔ eccentric ↔ true anomaly (elliptic orbits)
|
|
81
|
-
| `convert_time` | Duration between units, attoseconds to gigayears
|
|
82
|
-
| `find_body` | Look up planets, moons, stars, comets, … by name
|
|
67
|
+
| Tool | What it computes |
|
|
68
|
+
| ---------------------------- | ------------------------------------------------------ |
|
|
69
|
+
| `gravitational_parameter` | μ = G·(M + m) from masses |
|
|
70
|
+
| `circular_speed` | Circular orbit speed at radius r |
|
|
71
|
+
| `escape_speed` | Escape speed at radius r |
|
|
72
|
+
| `vis_viva_speed` | Speed at radius r on an orbit with semi-major axis a |
|
|
73
|
+
| `kepler_period` | Orbital period from semi-major axis |
|
|
74
|
+
| `peri_apoapsis_radii` | Periapsis and apoapsis radii from a and e |
|
|
75
|
+
| `sphere_of_influence_radius` | Laplace sphere of influence |
|
|
76
|
+
| `hohmann_transfer` | Both burns, total Δv and transfer time |
|
|
77
|
+
| `rocket_delta_v` | Tsiolkovsky rocket equation from Isp and masses |
|
|
78
|
+
| `plane_change_delta_v` | Δv for a pure inclination change |
|
|
79
|
+
| `solve_kepler` | Eccentric anomaly from mean anomaly and eccentricity |
|
|
80
|
+
| `convert_anomaly` | Mean ↔ eccentric ↔ true anomaly (elliptic orbits) |
|
|
81
|
+
| `convert_time` | Duration between units, attoseconds to gigayears |
|
|
82
|
+
| `find_body` | Look up planets, moons, stars, comets, … by name or id |
|
|
83
83
|
|
|
84
84
|
All tools are pure and offline: no network access, no side effects.
|
|
85
85
|
|
|
@@ -89,11 +89,6 @@ Each dataset in `@interstellar-tools/constants` is available as a JSON resource
|
|
|
89
89
|
at `interstellar://datasets/{name}`, where `name` is one of `planets`, `moons`,
|
|
90
90
|
`stars`, `comets`, `asteroids`, `asteroid-belts`, `galaxies` or `systems`.
|
|
91
91
|
|
|
92
|
-
> [!NOTE]
|
|
93
|
-
>
|
|
94
|
-
> The Alpha Centauri entries are left out of `stars` until their orbital model
|
|
95
|
-
> is corrected.
|
|
96
|
-
|
|
97
92
|
## Programmatic use
|
|
98
93
|
|
|
99
94
|
```ts
|
package/dist/bodies.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export declare const DATASETS: {
|
|
|
9
9
|
readonly data: import("@interstellar-tools/types").MoonsType;
|
|
10
10
|
};
|
|
11
11
|
readonly stars: {
|
|
12
|
-
readonly description: "Stars
|
|
13
|
-
readonly data: import("@interstellar-tools/types").
|
|
12
|
+
readonly description: "Stars.";
|
|
13
|
+
readonly data: import("@interstellar-tools/types").StarsType;
|
|
14
14
|
};
|
|
15
15
|
readonly comets: {
|
|
16
16
|
readonly description: "Comets.";
|
|
@@ -29,7 +29,7 @@ export declare const DATASETS: {
|
|
|
29
29
|
readonly data: import("@interstellar-tools/types").GalaxiesType;
|
|
30
30
|
};
|
|
31
31
|
readonly systems: {
|
|
32
|
-
readonly description: "
|
|
32
|
+
readonly description: "Systems: the barycenters that stars and planets orbit, nested for multiple stars.";
|
|
33
33
|
readonly data: import("@interstellar-tools/types").SystemsType;
|
|
34
34
|
};
|
|
35
35
|
};
|
package/dist/bodies.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bodies.d.ts","sourceRoot":"","sources":["../src/bodies.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,SAAS,EAEV,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"bodies.d.ts","sourceRoot":"","sources":["../src/bodies.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,SAAS,EAEV,MAAM,yCAAyC,CAAC;AAKjD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBX,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,QAAQ,CAAC;AAUpD,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,SAyE/C,CAAC"}
|
package/dist/bodies.js
CHANGED
|
@@ -2,34 +2,25 @@ import { ASTEROID_BELTS, ASTEROIDS, COMETS, GALAXIES, MOONS, PLANETS, STARS, SYS
|
|
|
2
2
|
import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { PURE_TOOL, result } from './tools/shared.js';
|
|
5
|
-
/**
|
|
6
|
-
* The Alpha Centauri entries in `STARS` currently carry the Sun's galactic
|
|
7
|
-
* orbit instead of the binary + Proxima system, so they are held back until
|
|
8
|
-
* that model lands.
|
|
9
|
-
*/
|
|
10
|
-
const isTrusted = (body) => !(typeof body.system === 'object' &&
|
|
11
|
-
body.system !== null &&
|
|
12
|
-
'name' in body.system &&
|
|
13
|
-
body.system.name === 'Alpha Centauri');
|
|
14
5
|
export const DATASETS = {
|
|
15
6
|
planets: {
|
|
16
7
|
description: 'Planets and dwarf planets of the Solar System.',
|
|
17
8
|
data: PLANETS
|
|
18
9
|
},
|
|
19
10
|
moons: { description: 'Natural satellites.', data: MOONS },
|
|
20
|
-
stars: {
|
|
21
|
-
description: 'Stars (Alpha Centauri entries omitted pending a fix).',
|
|
22
|
-
data: STARS.filter(isTrusted)
|
|
23
|
-
},
|
|
11
|
+
stars: { description: 'Stars.', data: STARS },
|
|
24
12
|
comets: { description: 'Comets.', data: COMETS },
|
|
25
13
|
asteroids: { description: 'Asteroids.', data: ASTEROIDS },
|
|
26
14
|
'asteroid-belts': { description: 'Asteroid belts.', data: ASTEROID_BELTS },
|
|
27
15
|
galaxies: { description: 'Galaxies.', data: GALAXIES },
|
|
28
|
-
systems: {
|
|
16
|
+
systems: {
|
|
17
|
+
description: 'Systems: the barycenters that stars and planets orbit, nested for multiple stars.',
|
|
18
|
+
data: SYSTEMS
|
|
19
|
+
}
|
|
29
20
|
};
|
|
30
21
|
const DATASET_NAMES = Object.keys(DATASETS);
|
|
31
22
|
const uriFor = (name) => `interstellar://datasets/${name}`;
|
|
32
|
-
const UNITS_NOTE = 'Values carry their own units ({ value, unit }); `a` is usually in au, `period` in days (negative =
|
|
23
|
+
const UNITS_NOTE = 'Each body has a stable `id` and names the body, system or galaxy it is bound to in `parent`; `orbit` holds its elements around that parent. Values carry their own units ({ value, unit }); `orbit.a` is usually in au, `orbit.period` in days (negative = counter-clockwise), `radius` in km, `orbit.angle` in radians at J2000.';
|
|
33
24
|
export const registerBodies = (server) => {
|
|
34
25
|
server.registerResource('dataset', new ResourceTemplate('interstellar://datasets/{name}', {
|
|
35
26
|
list: () => ({
|
|
@@ -63,12 +54,12 @@ export const registerBodies = (server) => {
|
|
|
63
54
|
});
|
|
64
55
|
server.registerTool('find_body', {
|
|
65
56
|
title: 'Find celestial body',
|
|
66
|
-
description: `Look up celestial bodies by name (case-insensitive substring) across the bundled datasets. ${UNITS_NOTE}
|
|
57
|
+
description: `Look up celestial bodies by name or id (case-insensitive substring) across the bundled datasets. ${UNITS_NOTE} Only some stars carry a mass (in solar masses); use known μ values with the orbit tools.`,
|
|
67
58
|
inputSchema: {
|
|
68
59
|
query: z
|
|
69
60
|
.string()
|
|
70
61
|
.min(1)
|
|
71
|
-
.describe('Name or part of
|
|
62
|
+
.describe('Name, id or part of one, e.g. "mars" or "alpha-centauri".'),
|
|
72
63
|
dataset: z
|
|
73
64
|
.enum(DATASET_NAMES)
|
|
74
65
|
.optional()
|
|
@@ -79,7 +70,8 @@ export const registerBodies = (server) => {
|
|
|
79
70
|
const needle = query.trim().toLowerCase();
|
|
80
71
|
const names = dataset ? [dataset] : DATASET_NAMES;
|
|
81
72
|
const matches = names.flatMap((name) => DATASETS[name].data
|
|
82
|
-
.filter((body) => body.name.toLowerCase().includes(needle)
|
|
73
|
+
.filter((body) => body.name.toLowerCase().includes(needle) ||
|
|
74
|
+
body.id.includes(needle))
|
|
83
75
|
.map((body) => ({ dataset: name, body })));
|
|
84
76
|
return result({ count: matches.length, matches });
|
|
85
77
|
});
|
package/dist/bodies.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bodies.js","sourceRoot":"","sources":["../src/bodies.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,MAAM,EACN,QAAQ,EACR,KAAK,EACL,OAAO,EACP,KAAK,EACL,OAAO,EACR,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,gBAAgB,EACjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"bodies.js","sourceRoot":"","sources":["../src/bodies.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,CAAC;iBACL,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,2DAA2D,CAC5D;YACH,OAAO,EAAE,CAAC;iBACP,IAAI,CAAC,aAAa,CAAC;iBACnB,QAAQ,EAAE;iBACV,QAAQ,CAAC,qCAAqC,CAAC;SACnD;QACD,WAAW,EAAE,SAAS;KACvB,EACD,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;QACrB,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;QAClD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CACpC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAgD;aAC7D,MAAM,CACL,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;YACxC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAC3B;aACA,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAC5C,CAAC;QAEF,OAAO,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interstellar-tools/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Model Context Protocol (MCP) server exposing interstellar-tools orbital mechanics equations and celestial body datasets to AI assistants.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"test:ci": "glob-bin -c \"node --import tsx --test --no-warnings --experimental-test-coverage --test-reporter=cobertura --test-reporter-destination=coverage/cobertura-coverage.xml --test-reporter=spec --test-reporter-destination=stdout\" \"**/__tests__/**/*.spec.ts\""
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@interstellar-tools/constants": "^0.
|
|
59
|
-
"@interstellar-tools/equations": "^0.
|
|
58
|
+
"@interstellar-tools/constants": "^0.61.0",
|
|
59
|
+
"@interstellar-tools/equations": "^0.61.0",
|
|
60
60
|
"@interstellar-tools/temporal": "^0.60.0",
|
|
61
|
-
"@interstellar-tools/types": "^0.
|
|
61
|
+
"@interstellar-tools/types": "^0.61.0",
|
|
62
62
|
"@modelcontextprotocol/sdk": "1.31.0",
|
|
63
63
|
"zod": "4.6.5"
|
|
64
64
|
},
|