tryastro-mcp 0.2.0 → 0.2.1

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.
Files changed (3) hide show
  1. package/README.md +2 -6
  2. package/package.json +1 -1
  3. package/server.js +30 -4
package/README.md CHANGED
@@ -45,11 +45,7 @@ Use the published npm package:
45
45
  "mcpServers": {
46
46
  "tryastro-mcp": {
47
47
  "command": "npx",
48
- "args": ["-y", "tryastro-mcp@0.2.0"],
49
- "env": {
50
- "NPM_CONFIG_CACHE": "/tmp/astro-mcp-npm-cache",
51
- "npm_config_cache": "/tmp/astro-mcp-npm-cache"
52
- }
48
+ "args": ["-y", "tryastro-mcp@0.2.1"]
53
49
  }
54
50
  }
55
51
  }
@@ -60,7 +56,7 @@ Use the published npm package:
60
56
  1. Update `version` in `/package.json`.
61
57
  2. Login: `npm login`.
62
58
  3. Publish: `npm publish --access public`.
63
- 4. Verify install: `npx -y tryastro-mcp@0.2.0`.
59
+ 4. Verify install: `npx -y tryastro-mcp@0.2.1`.
64
60
 
65
61
  ## Data and source model
66
62
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tryastro-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "MCP server for TryAstro scenarios and standard support requests",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -1,10 +1,36 @@
1
1
  #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
2
4
  import process from "node:process";
5
+ import { fileURLToPath } from "node:url";
3
6
 
4
- const SERVER_INFO = {
5
- name: "tryastro-mcp",
6
- version: "0.2.0",
7
- };
7
+ function loadServerInfo() {
8
+ const fallback = {
9
+ name: "tryastro-mcp",
10
+ version: "0.2.1",
11
+ };
12
+
13
+ try {
14
+ const currentDir = path.dirname(fileURLToPath(import.meta.url));
15
+ const packageJsonPath = path.join(currentDir, "package.json");
16
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
17
+
18
+ const name =
19
+ typeof packageJson.name === "string" && packageJson.name.trim().length > 0
20
+ ? packageJson.name.trim()
21
+ : fallback.name;
22
+ const version =
23
+ typeof packageJson.version === "string" && packageJson.version.trim().length > 0
24
+ ? packageJson.version.trim()
25
+ : fallback.version;
26
+
27
+ return { name, version };
28
+ } catch {
29
+ return fallback;
30
+ }
31
+ }
32
+
33
+ const SERVER_INFO = loadServerInfo();
8
34
 
9
35
  const PROTOCOL_VERSION = "2024-11-05";
10
36
  const VERIFIED_ON = "2026-02-22";