telique-mcp 1.0.1 → 1.0.3

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/dist/index.js CHANGED
@@ -1,14 +1,19 @@
1
1
  #!/usr/bin/env node
2
- import { loadConfig } from "./config.js";
2
+ import { stdin } from "node:process";
3
3
  const subcommand = process.argv[2];
4
- if (subcommand === "setup") {
4
+ // If run with "setup" arg, or directly in a terminal (not piped by an MCP client),
5
+ // launch the interactive setup flow.
6
+ const isInteractiveTerminal = subcommand !== "serve" && stdin.isTTY === true;
7
+ if (subcommand === "setup" || isInteractiveTerminal) {
5
8
  const { runSetup } = await import("./setup.js");
6
9
  await runSetup();
7
10
  }
8
11
  else {
12
+ // MCP server mode — stdin is piped JSON-RPC from the MCP client
9
13
  const { McpServer } = await import("@modelcontextprotocol/sdk/server/mcp.js");
10
14
  const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
11
15
  const { TeliqueClient } = await import("./client.js");
16
+ const { loadConfig } = await import("./config.js");
12
17
  const { setAnonymousMode } = await import("./utils/formatting.js");
13
18
  const { registerRoutelinkTools } = await import("./tools/routelink.js");
14
19
  const { registerLrnTools } = await import("./tools/lrn.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telique-mcp",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "MCP server for Telique telecom APIs (RouteLink, LRN, CNAM, LERG)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/postinstall.js CHANGED
@@ -1,16 +1,21 @@
1
1
  #!/usr/bin/env node
2
- console.log(`
3
- ┌─────────────────────────────────────────────────┐
4
- │ │
5
- │ telique-mcp installed successfully! │
6
- │ │
7
- │ Get started: │
8
- │ telique-mcp setup │
9
- │ │
10
- │ Or use immediately in anonymous mode │
11
- │ (10 ops/min) no API key required.
12
- │ │
13
- │ Docs: https://github.com/Ringer/telique-mcp │
14
- │ │
15
- └─────────────────────────────────────────────────┘
16
- `);
2
+ import { stdin } from "node:process";
3
+ import { existsSync } from "node:fs";
4
+ import { execFileSync } from "node:child_process";
5
+ import { fileURLToPath } from "node:url";
6
+ import { join, dirname } from "node:path";
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ const setupScript = join(__dirname, "dist", "index.js");
10
+
11
+ // Only run interactive setup for global installs in a terminal.
12
+ // npm sets npm_config_global when installing globally.
13
+ const isGlobal = process.env.npm_config_global === "true";
14
+
15
+ if (isGlobal && stdin.isTTY && existsSync(setupScript)) {
16
+ try {
17
+ execFileSync("node", [setupScript, "setup"], { stdio: "inherit" });
18
+ } catch {
19
+ // Setup cancelled or failed — not fatal
20
+ }
21
+ }