@systemdox/mcp-server 0.1.23 → 0.1.24

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/cli.js CHANGED
@@ -10,6 +10,22 @@ var __export = (target, all) => {
10
10
  };
11
11
 
12
12
  // src/lib/config.ts
13
+ function requireHttpsApiUrl(apiUrl) {
14
+ let parsed;
15
+ try {
16
+ parsed = new URL(apiUrl);
17
+ } catch {
18
+ throw new Error(
19
+ `SYSTEMDOX_API_URL is not a valid URL: ${apiUrl}`
20
+ );
21
+ }
22
+ if (parsed.protocol !== "https:") {
23
+ throw new Error(
24
+ `SYSTEMDOX_API_URL must use https:// \u2014 refusing to send the API key over ${parsed.protocol}// in cleartext. Got: ${apiUrl}`
25
+ );
26
+ }
27
+ return apiUrl;
28
+ }
13
29
  function loadConfig() {
14
30
  const apiKey = process.env.SYSTEMDOX_API_KEY;
15
31
  if (!apiKey) {
@@ -17,16 +33,21 @@ function loadConfig() {
17
33
  "SYSTEMDOX_API_KEY is required. Generate one at your SystemDox settings page."
18
34
  );
19
35
  }
36
+ const apiUrl = requireHttpsApiUrl(
37
+ process.env.SYSTEMDOX_API_URL ?? API_URL_DEFAULT
38
+ );
20
39
  return {
21
40
  apiKey,
22
- apiUrl: process.env.SYSTEMDOX_API_URL ?? "https://api.puglieseweb.com/systemdox",
41
+ apiUrl,
23
42
  cacheTtlMs: parseInt(process.env.SYSTEMDOX_CACHE_TTL ?? "300", 10) * 1e3,
24
43
  defaultOrg: process.env.SYSTEMDOX_DEFAULT_ORG
25
44
  };
26
45
  }
46
+ var API_URL_DEFAULT;
27
47
  var init_config = __esm({
28
48
  "src/lib/config.ts"() {
29
49
  "use strict";
50
+ API_URL_DEFAULT = "https://api.puglieseweb.com/systemdox";
30
51
  }
31
52
  });
32
53
 
@@ -1979,7 +2000,7 @@ var init_server = __esm({
1979
2000
  init_create_project_rule();
1980
2001
  init_get_prompt_templates();
1981
2002
  init_create_prompt_template();
1982
- SERVER_VERSION = true ? "0.1.23" : "0.0.0-dev";
2003
+ SERVER_VERSION = true ? "0.1.24" : "0.0.0-dev";
1983
2004
  }
1984
2005
  });
1985
2006
 
@@ -2012,12 +2033,12 @@ var init_index = __esm({
2012
2033
  });
2013
2034
 
2014
2035
  // src/cli.ts
2015
- import { readFile, writeFile } from "fs/promises";
2036
+ init_config();
2037
+ import { readFile, writeFile, chmod } from "fs/promises";
2016
2038
  import { existsSync } from "fs";
2017
2039
  import { homedir } from "os";
2018
2040
  import { join } from "path";
2019
2041
  import { createInterface } from "readline";
2020
- var API_URL_DEFAULT = "https://api.puglieseweb.com/systemdox";
2021
2042
  function prompt(question) {
2022
2043
  const rl = createInterface({ input: process.stdin, output: process.stdout });
2023
2044
  return new Promise((resolve) => {
@@ -2093,7 +2114,11 @@ async function writeConfig(path, config2) {
2093
2114
  const { mkdir } = await import("fs/promises");
2094
2115
  await mkdir(dir, { recursive: true });
2095
2116
  }
2096
- await writeFile(path, JSON.stringify(config2, null, 2) + "\n");
2117
+ await writeFile(path, JSON.stringify(config2, null, 2) + "\n", { mode: 384 });
2118
+ try {
2119
+ await chmod(path, 384);
2120
+ } catch {
2121
+ }
2097
2122
  }
2098
2123
  function serverEntry(apiKey, apiUrl) {
2099
2124
  const entry = {
@@ -2121,6 +2146,14 @@ async function setup() {
2121
2146
  ` API URL [${API_URL_DEFAULT}]: `
2122
2147
  );
2123
2148
  const apiUrl = apiUrlInput || API_URL_DEFAULT;
2149
+ try {
2150
+ requireHttpsApiUrl(apiUrl);
2151
+ } catch (err) {
2152
+ console.error(`
2153
+ Error: ${err.message}
2154
+ `);
2155
+ process.exit(1);
2156
+ }
2124
2157
  console.log("\n Validating API key...");
2125
2158
  const valid = await validateApiKey(apiKey, apiUrl);
2126
2159
  if (!valid) {
package/dist/http.js CHANGED
@@ -1825,7 +1825,7 @@ function registerCreatePromptTemplate(server, apiClient) {
1825
1825
  }
1826
1826
 
1827
1827
  // src/server.ts
1828
- var SERVER_VERSION = true ? "0.1.23" : "0.0.0-dev";
1828
+ var SERVER_VERSION = true ? "0.1.24" : "0.0.0-dev";
1829
1829
  function createServer(apiClient) {
1830
1830
  const server = new McpServer({
1831
1831
  name: "systemdox-mcp-server",
package/dist/index.js CHANGED
@@ -4,6 +4,23 @@
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
 
6
6
  // src/lib/config.ts
7
+ var API_URL_DEFAULT = "https://api.puglieseweb.com/systemdox";
8
+ function requireHttpsApiUrl(apiUrl) {
9
+ let parsed;
10
+ try {
11
+ parsed = new URL(apiUrl);
12
+ } catch {
13
+ throw new Error(
14
+ `SYSTEMDOX_API_URL is not a valid URL: ${apiUrl}`
15
+ );
16
+ }
17
+ if (parsed.protocol !== "https:") {
18
+ throw new Error(
19
+ `SYSTEMDOX_API_URL must use https:// \u2014 refusing to send the API key over ${parsed.protocol}// in cleartext. Got: ${apiUrl}`
20
+ );
21
+ }
22
+ return apiUrl;
23
+ }
7
24
  function loadConfig() {
8
25
  const apiKey = process.env.SYSTEMDOX_API_KEY;
9
26
  if (!apiKey) {
@@ -11,9 +28,12 @@ function loadConfig() {
11
28
  "SYSTEMDOX_API_KEY is required. Generate one at your SystemDox settings page."
12
29
  );
13
30
  }
31
+ const apiUrl = requireHttpsApiUrl(
32
+ process.env.SYSTEMDOX_API_URL ?? API_URL_DEFAULT
33
+ );
14
34
  return {
15
35
  apiKey,
16
- apiUrl: process.env.SYSTEMDOX_API_URL ?? "https://api.puglieseweb.com/systemdox",
36
+ apiUrl,
17
37
  cacheTtlMs: parseInt(process.env.SYSTEMDOX_CACHE_TTL ?? "300", 10) * 1e3,
18
38
  defaultOrg: process.env.SYSTEMDOX_DEFAULT_ORG
19
39
  };
@@ -1806,7 +1826,7 @@ function registerCreatePromptTemplate(server2, apiClient2) {
1806
1826
  }
1807
1827
 
1808
1828
  // src/server.ts
1809
- var SERVER_VERSION = true ? "0.1.23" : "0.0.0-dev";
1829
+ var SERVER_VERSION = true ? "0.1.24" : "0.0.0-dev";
1810
1830
  function createServer(apiClient2) {
1811
1831
  const server2 = new McpServer({
1812
1832
  name: "systemdox-mcp-server",
@@ -4,4 +4,11 @@ export interface ServerConfig {
4
4
  cacheTtlMs: number;
5
5
  defaultOrg: string | undefined;
6
6
  }
7
+ export declare const API_URL_DEFAULT = "https://api.puglieseweb.com/systemdox";
8
+ /**
9
+ * Fail closed on a non-https API URL. The API key travels as a bearer token in
10
+ * the Authorization header on every request, so an http:// URL would leak it in
11
+ * cleartext. Reject rather than downgrade. Returns the URL unchanged when valid.
12
+ */
13
+ export declare function requireHttpsApiUrl(apiUrl: string): string;
7
14
  export declare function loadConfig(): ServerConfig;
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/lib/config.ts
4
+ var API_URL_DEFAULT = "https://api.puglieseweb.com/systemdox";
5
+ function requireHttpsApiUrl(apiUrl) {
6
+ let parsed;
7
+ try {
8
+ parsed = new URL(apiUrl);
9
+ } catch {
10
+ throw new Error(
11
+ `SYSTEMDOX_API_URL is not a valid URL: ${apiUrl}`
12
+ );
13
+ }
14
+ if (parsed.protocol !== "https:") {
15
+ throw new Error(
16
+ `SYSTEMDOX_API_URL must use https:// \u2014 refusing to send the API key over ${parsed.protocol}// in cleartext. Got: ${apiUrl}`
17
+ );
18
+ }
19
+ return apiUrl;
20
+ }
21
+ function loadConfig() {
22
+ const apiKey = process.env.SYSTEMDOX_API_KEY;
23
+ if (!apiKey) {
24
+ throw new Error(
25
+ "SYSTEMDOX_API_KEY is required. Generate one at your SystemDox settings page."
26
+ );
27
+ }
28
+ const apiUrl = requireHttpsApiUrl(
29
+ process.env.SYSTEMDOX_API_URL ?? API_URL_DEFAULT
30
+ );
31
+ return {
32
+ apiKey,
33
+ apiUrl,
34
+ cacheTtlMs: parseInt(process.env.SYSTEMDOX_CACHE_TTL ?? "300", 10) * 1e3,
35
+ defaultOrg: process.env.SYSTEMDOX_DEFAULT_ORG
36
+ };
37
+ }
38
+ export {
39
+ API_URL_DEFAULT,
40
+ loadConfig,
41
+ requireHttpsApiUrl
42
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@systemdox/mcp-server",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "mcpName": "io.github.puglieseweb/systemdox",
5
5
  "type": "module",
6
6
  "description": "Give AI coding agents your architecture context over MCP — checks, specs, ADRs, project rules, and docs from SystemDox, delivered at write time",