@kopai/app 0.14.7 → 0.15.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.
@@ -9,8 +9,8 @@
9
9
  type="image/svg+xml"
10
10
  href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Crect width='32' height='32' rx='4' fill='%230a0a0a'/%3E%3Ctext x='3' y='22' font-family='ui-monospace,monospace' font-size='16' font-weight='400' fill='%23fafafa'%3Ek%3E%3C/text%3E%3C/svg%3E"
11
11
  />
12
- <script type="module" crossorigin src="/assets/index-BIthXnLe.js"></script>
13
- <link rel="stylesheet" crossorigin href="/assets/index-Bf4KyfOh.css">
12
+ <script type="module" crossorigin src="/assets/index-C7ABd8la.js"></script>
13
+ <link rel="stylesheet" crossorigin href="/assets/index-BF9CRKjp.css">
14
14
  </head>
15
15
  <body>
16
16
  <div id="root"></div>
@@ -12,6 +12,7 @@ let close_with_grace = require("close-with-grace");
12
12
  close_with_grace = require_config.__toESM(close_with_grace, 1);
13
13
  let _kopai_api = require("@kopai/api");
14
14
  require("@kopai/core");
15
+ let _kopai_mcp = require("@kopai/mcp");
15
16
  let _kopai_ui = require("@kopai/ui");
16
17
  let _kopai_collector = require("@kopai/collector");
17
18
  let _kopai_sqlite_datasource = require("@kopai/sqlite-datasource");
@@ -20,17 +21,112 @@ let node_url = require("node:url");
20
21
  let _fastify_vite = require("@fastify/vite");
21
22
  _fastify_vite = require_config.__toESM(_fastify_vite, 1);
22
23
  let node_os = require("node:os");
24
+ //#region src/loopback.ts
25
+ /**
26
+ * The names /mcp answers for, in both its Host and Origin allow-lists.
27
+ * Bracketed IPv6 is the form the validators compare against.
28
+ *
29
+ * NOTE neither list is network access control: a client on the LAN can send
30
+ * any Host it likes. Always loopback, whatever HOST the server binds to —
31
+ * widening this to a LAN address weakens the rebinding check and gains
32
+ * nothing, since a LAN client can send Host: localhost anyway.
33
+ */
34
+ const LOOPBACK_HOSTNAMES = [
35
+ "localhost",
36
+ "127.0.0.1",
37
+ "[::1]"
38
+ ];
39
+ const WILDCARD_HOSTS = ["0.0.0.0", "::"];
40
+ /**
41
+ * The URL an MCP client on this machine should use, given the HOST the server
42
+ * binds to, or undefined when there is none: bound to one specific non-loopback
43
+ * address, nothing listens on loopback, and /mcp refuses the address itself.
44
+ *
45
+ * The banner and /documentation both print this, so they cannot disagree with
46
+ * each other about whether MCP is reachable.
47
+ */
48
+ function localMcpUrl(host, port) {
49
+ const name = host.toLowerCase();
50
+ if (WILDCARD_HOSTS.includes(name)) return `http://localhost:${port}/mcp`;
51
+ if (name === "::1") return `http://[::1]:${port}/mcp`;
52
+ if (name === "localhost" || name === "127.0.0.1") return `http://${name}:${port}/mcp`;
53
+ }
54
+ /** What to print instead of a URL when {@link localMcpUrl} has none. */
55
+ const MCP_UNAVAILABLE_HINT = "bind HOST to localhost";
56
+ //#endregion
23
57
  //#region src/routes/index.ts
24
58
  const uiPkg = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("@kopai/ui/package.json");
25
59
  const promptInstructions = (0, _kopai_ui.generatePromptInstructions)(_kopai_ui.observabilityCatalog, uiPkg.version);
60
+ /**
61
+ * Every API route the app serves, with no prefix: the signals and dashboards
62
+ * REST routes, and the MCP endpoint at `/mcp`. All of them read the same
63
+ * telemetry datasource.
64
+ */
26
65
  const apiRoutes = async function(fastify, opts) {
27
66
  fastify.register(_kopai_api.signalsRoutes, { readTelemetryDatasource: opts.readTelemetryDatasource });
67
+ fastify.register(_kopai_mcp.mcpRoutes, {
68
+ readTelemetryDatasource: opts.readTelemetryDatasource,
69
+ allowedHosts: LOOPBACK_HOSTNAMES,
70
+ allowedOriginHostnames: LOOPBACK_HOSTNAMES
71
+ });
28
72
  fastify.register(_kopai_api.dashboardsRoutes, {
29
73
  dynamicDashboardDatasource: opts.dynamicDashboardDatasource,
30
74
  promptInstructions
31
75
  });
32
76
  };
33
77
  //#endregion
78
+ //#region src/openapi.ts
79
+ const uiRoutes = ["/", "/*"];
80
+ /**
81
+ * The swagger `transform` for the app: hides the UI routes, and describes the
82
+ * MCP endpoint in words, since JSON-RPC over Streamable HTTP has no meaningful
83
+ * OpenAPI shape.
84
+ *
85
+ * `/documentation` is what the README points to for "available endpoints",
86
+ * so `/mcp` stays listed — with how to connect to it, rather than a request
87
+ * body the page could not send anyway. GET and DELETE are hidden: they exist
88
+ * only so the SDK can answer them 405.
89
+ */
90
+ function createOpenapiTransform({ host, port }) {
91
+ const mcpUrl = localMcpUrl(host, port);
92
+ const connect = mcpUrl ? [
93
+ "Connect from Claude Code with:",
94
+ "",
95
+ `\`claude mcp add --transport http local-kopai ${mcpUrl}\``
96
+ ] : [`Unavailable while the server is bound to \`${host}\`: this endpoint accepts loopback Host headers only, and nothing listens on loopback. To use it, ${MCP_UNAVAILABLE_HINT}.`];
97
+ return ({ schema, url, route, ...rest }) => {
98
+ if (uiRoutes.includes(url)) return {
99
+ schema: { hide: true },
100
+ url
101
+ };
102
+ if (url === "/mcp") {
103
+ if (route.method !== "POST") return {
104
+ schema: { hide: true },
105
+ url
106
+ };
107
+ return {
108
+ schema: {
109
+ summary: "MCP server (Streamable HTTP, JSON-RPC)",
110
+ description: [
111
+ "Read-only MCP server exposing the `query` and `metrics_discover` tools over this app's telemetry.",
112
+ "",
113
+ ...connect,
114
+ "",
115
+ "Accepts only loopback `Host` and browser `Origin` headers."
116
+ ].join("\n")
117
+ },
118
+ url
119
+ };
120
+ }
121
+ return (0, fastify_type_provider_zod.jsonSchemaTransform)({
122
+ schema,
123
+ url,
124
+ route,
125
+ ...rest
126
+ });
127
+ };
128
+ }
129
+ //#endregion
34
130
  //#region src/collector/index.ts
35
131
  const otelCollectorRoutes = async function(fastify, opts) {
36
132
  fastify.register(_kopai_collector.collectorRoutes, {
@@ -53,6 +149,10 @@ function getNetworkAddress() {
53
149
  for (const net of interfaces) if (net.family === "IPv4" && !net.internal) return net.address;
54
150
  }
55
151
  }
152
+ /**
153
+ * Prints the URLs the app is reachable at. The MCP row shows only the local
154
+ * URL, from {@link localMcpUrl}, because `/mcp` refuses the network address.
155
+ */
56
156
  function printStartupBanner({ host, port, collectorPort, version }) {
57
157
  const localHost = host === "0.0.0.0" || host === "::" ? "localhost" : host;
58
158
  const networkAddress = getNetworkAddress();
@@ -78,6 +178,7 @@ function printStartupBanner({ host, port, collectorPort, version }) {
78
178
  ""
79
179
  ]
80
180
  ];
181
+ const mcpUrl = localMcpUrl(host, port);
81
182
  const maxLocalLen = Math.max(...rows.map(([, url]) => url.length));
82
183
  for (const [label, localUrl, path] of rows) {
83
184
  const padded = localUrl.padEnd(maxLocalLen);
@@ -88,6 +189,7 @@ function printStartupBanner({ host, port, collectorPort, version }) {
88
189
  }
89
190
  lines.push(line);
90
191
  }
192
+ lines.push(mcpUrl ? ` ${green}▸${reset} ${bold}${"MCP".padEnd(16)}${reset}${cyan}${mcpUrl}${reset}` : ` ${green}▸${reset} ${bold}${"MCP".padEnd(16)}${reset}${dim}unavailable (${MCP_UNAVAILABLE_HINT})${reset}`);
91
193
  lines.push("");
92
194
  console.log(lines.join("\n"));
93
195
  }
@@ -100,7 +202,6 @@ function hasComponentSchemas(doc) {
100
202
  const apiServer = (0, fastify.default)({ logger: { level: "warn" } });
101
203
  apiServer.setValidatorCompiler(fastify_type_provider_zod.validatorCompiler);
102
204
  apiServer.setSerializerCompiler(fastify_type_provider_zod.serializerCompiler);
103
- const uiRoutes = ["/", "/*"];
104
205
  apiServer.register(_fastify_swagger.default, {
105
206
  openapi: {
106
207
  info: {
@@ -110,17 +211,10 @@ apiServer.register(_fastify_swagger.default, {
110
211
  },
111
212
  servers: []
112
213
  },
113
- transform: ({ schema, url, ...rest }) => {
114
- if (uiRoutes.includes(url)) return {
115
- schema: { hide: true },
116
- url
117
- };
118
- return (0, fastify_type_provider_zod.jsonSchemaTransform)({
119
- schema,
120
- url,
121
- ...rest
122
- });
123
- },
214
+ transform: createOpenapiTransform({
215
+ host: require_config.env.HOST || "localhost",
216
+ port: require_config.env.PORT
217
+ }),
124
218
  transformObject: (input) => {
125
219
  const result = (0, fastify_type_provider_zod.jsonSchemaTransformObject)(input);
126
220
  const renamed = JSON.stringify(result).replaceAll("#/components/schemas/schema0", "#/components/schemas/AttributeValue");
@@ -8,6 +8,7 @@ import fastifySwaggerUI from "@fastify/swagger-ui";
8
8
  import closeWithGrace from "close-with-grace";
9
9
  import { dashboardsRoutes, signalsRoutes } from "@kopai/api";
10
10
  import "@kopai/core";
11
+ import { mcpRoutes } from "@kopai/mcp";
11
12
  import { generatePromptInstructions, observabilityCatalog } from "@kopai/ui";
12
13
  import { collectorRoutes } from "@kopai/collector";
13
14
  import { DashboardDbDatasource, createOptimizedDatasource, initializeDatabase } from "@kopai/sqlite-datasource";
@@ -15,17 +16,112 @@ import { dirname, resolve } from "node:path";
15
16
  import { fileURLToPath } from "node:url";
16
17
  import FastifyVite from "@fastify/vite";
17
18
  import { networkInterfaces } from "node:os";
19
+ //#region src/loopback.ts
20
+ /**
21
+ * The names /mcp answers for, in both its Host and Origin allow-lists.
22
+ * Bracketed IPv6 is the form the validators compare against.
23
+ *
24
+ * NOTE neither list is network access control: a client on the LAN can send
25
+ * any Host it likes. Always loopback, whatever HOST the server binds to —
26
+ * widening this to a LAN address weakens the rebinding check and gains
27
+ * nothing, since a LAN client can send Host: localhost anyway.
28
+ */
29
+ const LOOPBACK_HOSTNAMES = [
30
+ "localhost",
31
+ "127.0.0.1",
32
+ "[::1]"
33
+ ];
34
+ const WILDCARD_HOSTS = ["0.0.0.0", "::"];
35
+ /**
36
+ * The URL an MCP client on this machine should use, given the HOST the server
37
+ * binds to, or undefined when there is none: bound to one specific non-loopback
38
+ * address, nothing listens on loopback, and /mcp refuses the address itself.
39
+ *
40
+ * The banner and /documentation both print this, so they cannot disagree with
41
+ * each other about whether MCP is reachable.
42
+ */
43
+ function localMcpUrl(host, port) {
44
+ const name = host.toLowerCase();
45
+ if (WILDCARD_HOSTS.includes(name)) return `http://localhost:${port}/mcp`;
46
+ if (name === "::1") return `http://[::1]:${port}/mcp`;
47
+ if (name === "localhost" || name === "127.0.0.1") return `http://${name}:${port}/mcp`;
48
+ }
49
+ /** What to print instead of a URL when {@link localMcpUrl} has none. */
50
+ const MCP_UNAVAILABLE_HINT = "bind HOST to localhost";
51
+ //#endregion
18
52
  //#region src/routes/index.ts
19
53
  const uiPkg = createRequire(import.meta.url)("@kopai/ui/package.json");
20
54
  const promptInstructions = generatePromptInstructions(observabilityCatalog, uiPkg.version);
55
+ /**
56
+ * Every API route the app serves, with no prefix: the signals and dashboards
57
+ * REST routes, and the MCP endpoint at `/mcp`. All of them read the same
58
+ * telemetry datasource.
59
+ */
21
60
  const apiRoutes = async function(fastify, opts) {
22
61
  fastify.register(signalsRoutes, { readTelemetryDatasource: opts.readTelemetryDatasource });
62
+ fastify.register(mcpRoutes, {
63
+ readTelemetryDatasource: opts.readTelemetryDatasource,
64
+ allowedHosts: LOOPBACK_HOSTNAMES,
65
+ allowedOriginHostnames: LOOPBACK_HOSTNAMES
66
+ });
23
67
  fastify.register(dashboardsRoutes, {
24
68
  dynamicDashboardDatasource: opts.dynamicDashboardDatasource,
25
69
  promptInstructions
26
70
  });
27
71
  };
28
72
  //#endregion
73
+ //#region src/openapi.ts
74
+ const uiRoutes = ["/", "/*"];
75
+ /**
76
+ * The swagger `transform` for the app: hides the UI routes, and describes the
77
+ * MCP endpoint in words, since JSON-RPC over Streamable HTTP has no meaningful
78
+ * OpenAPI shape.
79
+ *
80
+ * `/documentation` is what the README points to for "available endpoints",
81
+ * so `/mcp` stays listed — with how to connect to it, rather than a request
82
+ * body the page could not send anyway. GET and DELETE are hidden: they exist
83
+ * only so the SDK can answer them 405.
84
+ */
85
+ function createOpenapiTransform({ host, port }) {
86
+ const mcpUrl = localMcpUrl(host, port);
87
+ const connect = mcpUrl ? [
88
+ "Connect from Claude Code with:",
89
+ "",
90
+ `\`claude mcp add --transport http local-kopai ${mcpUrl}\``
91
+ ] : [`Unavailable while the server is bound to \`${host}\`: this endpoint accepts loopback Host headers only, and nothing listens on loopback. To use it, ${MCP_UNAVAILABLE_HINT}.`];
92
+ return ({ schema, url, route, ...rest }) => {
93
+ if (uiRoutes.includes(url)) return {
94
+ schema: { hide: true },
95
+ url
96
+ };
97
+ if (url === "/mcp") {
98
+ if (route.method !== "POST") return {
99
+ schema: { hide: true },
100
+ url
101
+ };
102
+ return {
103
+ schema: {
104
+ summary: "MCP server (Streamable HTTP, JSON-RPC)",
105
+ description: [
106
+ "Read-only MCP server exposing the `query` and `metrics_discover` tools over this app's telemetry.",
107
+ "",
108
+ ...connect,
109
+ "",
110
+ "Accepts only loopback `Host` and browser `Origin` headers."
111
+ ].join("\n")
112
+ },
113
+ url
114
+ };
115
+ }
116
+ return jsonSchemaTransform({
117
+ schema,
118
+ url,
119
+ route,
120
+ ...rest
121
+ });
122
+ };
123
+ }
124
+ //#endregion
29
125
  //#region src/collector/index.ts
30
126
  const otelCollectorRoutes = async function(fastify, opts) {
31
127
  fastify.register(collectorRoutes, {
@@ -48,6 +144,10 @@ function getNetworkAddress() {
48
144
  for (const net of interfaces) if (net.family === "IPv4" && !net.internal) return net.address;
49
145
  }
50
146
  }
147
+ /**
148
+ * Prints the URLs the app is reachable at. The MCP row shows only the local
149
+ * URL, from {@link localMcpUrl}, because `/mcp` refuses the network address.
150
+ */
51
151
  function printStartupBanner({ host, port, collectorPort, version }) {
52
152
  const localHost = host === "0.0.0.0" || host === "::" ? "localhost" : host;
53
153
  const networkAddress = getNetworkAddress();
@@ -73,6 +173,7 @@ function printStartupBanner({ host, port, collectorPort, version }) {
73
173
  ""
74
174
  ]
75
175
  ];
176
+ const mcpUrl = localMcpUrl(host, port);
76
177
  const maxLocalLen = Math.max(...rows.map(([, url]) => url.length));
77
178
  for (const [label, localUrl, path] of rows) {
78
179
  const padded = localUrl.padEnd(maxLocalLen);
@@ -83,6 +184,7 @@ function printStartupBanner({ host, port, collectorPort, version }) {
83
184
  }
84
185
  lines.push(line);
85
186
  }
187
+ lines.push(mcpUrl ? ` ${green}▸${reset} ${bold}${"MCP".padEnd(16)}${reset}${cyan}${mcpUrl}${reset}` : ` ${green}▸${reset} ${bold}${"MCP".padEnd(16)}${reset}${dim}unavailable (${MCP_UNAVAILABLE_HINT})${reset}`);
86
188
  lines.push("");
87
189
  console.log(lines.join("\n"));
88
190
  }
@@ -95,7 +197,6 @@ function hasComponentSchemas(doc) {
95
197
  const apiServer = fastify({ logger: { level: "warn" } });
96
198
  apiServer.setValidatorCompiler(validatorCompiler);
97
199
  apiServer.setSerializerCompiler(serializerCompiler);
98
- const uiRoutes = ["/", "/*"];
99
200
  apiServer.register(fastifySwagger, {
100
201
  openapi: {
101
202
  info: {
@@ -105,17 +206,10 @@ apiServer.register(fastifySwagger, {
105
206
  },
106
207
  servers: []
107
208
  },
108
- transform: ({ schema, url, ...rest }) => {
109
- if (uiRoutes.includes(url)) return {
110
- schema: { hide: true },
111
- url
112
- };
113
- return jsonSchemaTransform({
114
- schema,
115
- url,
116
- ...rest
117
- });
118
- },
209
+ transform: createOpenapiTransform({
210
+ host: env.HOST || "localhost",
211
+ port: env.PORT
212
+ }),
119
213
  transformObject: (input) => {
120
214
  const result = jsonSchemaTransformObject(input);
121
215
  const renamed = JSON.stringify(result).replaceAll("#/components/schemas/schema0", "#/components/schemas/AttributeValue");
@@ -220,4 +314,4 @@ closeWithGrace(async ({ signal, err }) => {
220
314
  //#endregion
221
315
  export {};
222
316
 
223
- //# sourceMappingURL=server-Bsn_YWCD.mjs.map
317
+ //# sourceMappingURL=server-DbYM-UOQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-DbYM-UOQ.mjs","names":[],"sources":["../src/loopback.ts","../src/routes/index.ts","../src/openapi.ts","../src/collector/index.ts","../src/startup-banner.ts","../src/server.ts"],"sourcesContent":["/**\n * The names /mcp answers for, in both its Host and Origin allow-lists.\n * Bracketed IPv6 is the form the validators compare against.\n *\n * NOTE neither list is network access control: a client on the LAN can send\n * any Host it likes. Always loopback, whatever HOST the server binds to —\n * widening this to a LAN address weakens the rebinding check and gains\n * nothing, since a LAN client can send Host: localhost anyway.\n */\nexport const LOOPBACK_HOSTNAMES = [\"localhost\", \"127.0.0.1\", \"[::1]\"];\n\nconst WILDCARD_HOSTS = [\"0.0.0.0\", \"::\"];\n\n/**\n * The URL an MCP client on this machine should use, given the HOST the server\n * binds to, or undefined when there is none: bound to one specific non-loopback\n * address, nothing listens on loopback, and /mcp refuses the address itself.\n *\n * The banner and /documentation both print this, so they cannot disagree with\n * each other about whether MCP is reachable.\n */\nexport function localMcpUrl(host: string, port: number): string | undefined {\n const name = host.toLowerCase();\n if (WILDCARD_HOSTS.includes(name)) return `http://localhost:${port}/mcp`;\n if (name === \"::1\") return `http://[::1]:${port}/mcp`;\n if (name === \"localhost\" || name === \"127.0.0.1\") {\n return `http://${name}:${port}/mcp`;\n }\n return undefined;\n}\n\n/** What to print instead of a URL when {@link localMcpUrl} has none. */\nexport const MCP_UNAVAILABLE_HINT = \"bind HOST to localhost\";\n","import { createRequire } from \"node:module\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { signalsRoutes, dashboardsRoutes } from \"@kopai/api\";\nimport { type datasource, type dashboardDatasource } from \"@kopai/core\";\nimport { mcpRoutes } from \"@kopai/mcp\";\nimport { generatePromptInstructions, observabilityCatalog } from \"@kopai/ui\";\n\nimport { LOOPBACK_HOSTNAMES } from \"../loopback.js\";\n\nconst require = createRequire(import.meta.url);\nconst uiPkg = require(\"@kopai/ui/package.json\");\n\n// The local app has no authentication, so these two lists are all that stands\n// between a web page and /mcp. Host stops a DNS-rebinding page; Origin\n// stops a page that simply fetches http://127.0.0.1:<port>/mcp, which arrives\n// with a genuinely loopback Host. MCP clients outside a browser (Claude Code,\n// curl, Node fetch) send no Origin, so they pass.\n//\n// NOTE the REST routes registered beside it check neither header, so a\n// rebinding page can still read the same data there. That gap is pinned by a\n// test in index.test.ts and tracked separately; it is not closed here.\n\nconst promptInstructions = generatePromptInstructions(\n observabilityCatalog,\n uiPkg.version\n);\n\n/**\n * Every API route the app serves, with no prefix: the signals and dashboards\n * REST routes, and the MCP endpoint at `/mcp`. All of them read the same\n * telemetry datasource.\n */\nexport const apiRoutes: FastifyPluginAsyncZod<{\n readTelemetryDatasource: datasource.ReadTelemetryDatasource;\n dynamicDashboardDatasource: dashboardDatasource.DynamicDashboardDatasource;\n}> = async function (fastify, opts) {\n fastify.register(signalsRoutes, {\n readTelemetryDatasource: opts.readTelemetryDatasource,\n });\n fastify.register(mcpRoutes, {\n readTelemetryDatasource: opts.readTelemetryDatasource,\n allowedHosts: LOOPBACK_HOSTNAMES,\n allowedOriginHostnames: LOOPBACK_HOSTNAMES,\n });\n fastify.register(dashboardsRoutes, {\n dynamicDashboardDatasource: opts.dynamicDashboardDatasource,\n promptInstructions,\n });\n};\n","import { jsonSchemaTransform } from \"fastify-type-provider-zod\";\n\nimport { localMcpUrl, MCP_UNAVAILABLE_HINT } from \"./loopback.js\";\n\ntype Transform = typeof jsonSchemaTransform;\n\nconst uiRoutes = [\"/\", \"/*\"];\n\n/**\n * The swagger `transform` for the app: hides the UI routes, and describes the\n * MCP endpoint in words, since JSON-RPC over Streamable HTTP has no meaningful\n * OpenAPI shape.\n *\n * `/documentation` is what the README points to for \"available endpoints\",\n * so `/mcp` stays listed — with how to connect to it, rather than a request\n * body the page could not send anyway. GET and DELETE are hidden: they exist\n * only so the SDK can answer them 405.\n */\nexport function createOpenapiTransform({\n host,\n port,\n}: {\n host: string;\n port: number;\n}): Transform {\n const mcpUrl = localMcpUrl(host, port);\n const connect = mcpUrl\n ? [\n \"Connect from Claude Code with:\",\n \"\",\n `\\`claude mcp add --transport http local-kopai ${mcpUrl}\\``,\n ]\n : [\n `Unavailable while the server is bound to \\`${host}\\`: this endpoint accepts loopback Host headers only, and nothing listens on loopback. To use it, ${MCP_UNAVAILABLE_HINT}.`,\n ];\n return ({ schema, url, route, ...rest }) => {\n if (uiRoutes.includes(url)) return { schema: { hide: true }, url };\n if (url === \"/mcp\") {\n if (route.method !== \"POST\") return { schema: { hide: true }, url };\n return {\n schema: {\n summary: \"MCP server (Streamable HTTP, JSON-RPC)\",\n description: [\n \"Read-only MCP server exposing the `query` and `metrics_discover` tools over this app's telemetry.\",\n \"\",\n ...connect,\n \"\",\n \"Accepts only loopback `Host` and browser `Origin` headers.\",\n ].join(\"\\n\"),\n },\n url,\n };\n }\n return jsonSchemaTransform({ schema, url, route, ...rest });\n };\n}\n","import type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { collectorRoutes } from \"@kopai/collector\";\nimport type { datasource } from \"@kopai/core\";\n\nexport const otelCollectorRoutes: FastifyPluginAsyncZod<{\n telemetryDatasource: datasource.WriteTelemetryDatasource;\n}> = async function (fastify, opts) {\n fastify.register(collectorRoutes, {\n ...opts,\n ingestionMetricsDatasource: opts.telemetryDatasource,\n });\n};\n","import { networkInterfaces } from \"node:os\";\n\nimport { localMcpUrl, MCP_UNAVAILABLE_HINT } from \"./loopback.js\";\n\nconst isTTY = process.stdout.isTTY;\nconst bold = isTTY ? \"\\x1b[1m\" : \"\";\nconst dim = isTTY ? \"\\x1b[2m\" : \"\";\nconst green = isTTY ? \"\\x1b[32m\" : \"\";\nconst cyan = isTTY ? \"\\x1b[36m\" : \"\";\nconst reset = isTTY ? \"\\x1b[0m\" : \"\";\n\nfunction getNetworkAddress(): string | undefined {\n const nets = networkInterfaces();\n for (const interfaces of Object.values(nets)) {\n if (!interfaces) continue;\n for (const net of interfaces) {\n if (net.family === \"IPv4\" && !net.internal) {\n return net.address;\n }\n }\n }\n return undefined;\n}\n\n/**\n * Prints the URLs the app is reachable at. The MCP row shows only the local\n * URL, from {@link localMcpUrl}, because `/mcp` refuses the network address.\n */\nexport function printStartupBanner({\n host,\n port,\n collectorPort,\n version,\n}: {\n host: string;\n port: number;\n collectorPort: number;\n version: string;\n}) {\n const localHost = host === \"0.0.0.0\" || host === \"::\" ? \"localhost\" : host;\n const networkAddress = getNetworkAddress();\n\n const lines: string[] = [\n \"\",\n ` ${bold}${green}|--k> @kopai/app${reset} ${dim}v${version}${reset}`,\n \"\",\n ];\n\n const rows: [string, string, string][] = [\n [\"Dashboard\", `http://${localHost}:${port}`, \"\"],\n [\"API Docs\", `http://${localHost}:${port}/documentation`, \"/documentation\"],\n [\"Collector\", `http://${localHost}:${collectorPort}`, \"\"],\n ];\n\n const mcpUrl = localMcpUrl(host, port);\n\n const maxLocalLen = Math.max(...rows.map(([, url]) => url.length));\n\n for (const [label, localUrl, path] of rows) {\n const padded = localUrl.padEnd(maxLocalLen);\n let line = ` ${green}▸${reset} ${bold}${label.padEnd(16)}${reset}${cyan}${padded}${reset}`;\n if (networkAddress) {\n const netPort = label === \"Collector\" ? collectorPort : port;\n const netUrl = `http://${networkAddress}:${netPort}${path}`;\n line += ` ${dim}${cyan}${netUrl}${reset}`;\n }\n lines.push(line);\n }\n\n // Local URL only: the endpoint refuses the network address by design.\n lines.push(\n mcpUrl\n ? ` ${green}▸${reset} ${bold}${\"MCP\".padEnd(16)}${reset}${cyan}${mcpUrl}${reset}`\n : ` ${green}▸${reset} ${bold}${\"MCP\".padEnd(16)}${reset}${dim}unavailable (${MCP_UNAVAILABLE_HINT})${reset}`\n );\n\n lines.push(\"\");\n console.log(lines.join(\"\\n\"));\n}\n","import fastify from \"fastify\";\nimport {\n jsonSchemaTransformObject,\n serializerCompiler,\n validatorCompiler,\n} from \"fastify-type-provider-zod\";\nimport fastifySwagger from \"@fastify/swagger\";\nimport fastifySwaggerUI from \"@fastify/swagger-ui\";\nimport closeWithGrace from \"close-with-grace\";\n\nimport { env } from \"./config.js\";\nimport { version } from \"./version.js\";\nimport { apiRoutes } from \"./routes/index.js\";\nimport { createOpenapiTransform } from \"./openapi.js\";\nimport { otelCollectorRoutes } from \"./collector/index.js\";\nimport {\n initializeDatabase,\n createOptimizedDatasource,\n DashboardDbDatasource,\n} from \"@kopai/sqlite-datasource\";\nimport { resolve, dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport FastifyVite from \"@fastify/vite\";\nimport { printStartupBanner } from \"./startup-banner.js\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nfunction hasComponentSchemas(\n doc: unknown\n): doc is { components: { schemas: Record<string, object> } } {\n return (\n typeof doc === \"object\" &&\n doc !== null &&\n \"components\" in doc &&\n typeof doc.components === \"object\" &&\n doc.components !== null &&\n \"schemas\" in doc.components &&\n typeof doc.components.schemas === \"object\" &&\n doc.components.schemas !== null\n );\n}\n\nconst apiServer = fastify({\n logger: { level: \"warn\" },\n});\n\n// Add schema validator and serializer\napiServer.setValidatorCompiler(validatorCompiler);\napiServer.setSerializerCompiler(serializerCompiler);\n\napiServer.register(fastifySwagger, {\n openapi: {\n info: {\n title: \"Kopai App\",\n description: \"Kopai App documentation\",\n version,\n },\n servers: [],\n },\n transform: createOpenapiTransform({\n host: env.HOST || \"localhost\",\n port: env.PORT,\n }),\n transformObject: (input) => {\n const result = jsonSchemaTransformObject(input);\n // Fix: z.lazy() recursive schemas generate $ref to schema0\n // but fastify-type-provider-zod doesn't define it in components.\n // Inject the missing schema definition and rename schema0 → AttributeValue.\n const raw = JSON.stringify(result);\n const renamed = raw.replaceAll(\n \"#/components/schemas/schema0\",\n \"#/components/schemas/AttributeValue\"\n );\n const patched: unknown = JSON.parse(renamed);\n if (\n hasComponentSchemas(patched) &&\n !patched.components.schemas.AttributeValue\n ) {\n patched.components.schemas.AttributeValue = {\n anyOf: [\n { type: \"string\" },\n { type: \"number\" },\n { type: \"boolean\" },\n {\n type: \"array\",\n items: { $ref: \"#/components/schemas/AttributeValue\" },\n },\n {\n type: \"object\",\n additionalProperties: {\n $ref: \"#/components/schemas/AttributeValue\",\n },\n },\n ],\n };\n }\n return patched as ReturnType<typeof jsonSchemaTransformObject>;\n },\n});\n\napiServer.register(fastifySwaggerUI, {\n routePrefix: \"/documentation\",\n logo: {\n type: \"image/svg+xml\",\n content: Buffer.from(\n \"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNjAgNDAiIGZpbGw9Im5vbmUiPjx0ZXh0IHg9IjAiIHk9IjI4IiBmb250LWZhbWlseT0idWktbW9ub3NwYWNlLCBtb25vc3BhY2UiIGZvbnQtc2l6ZT0iMjAiIGZvbnQtd2VpZ2h0PSI0MDAiIGZpbGw9IiNmYWZhZmEiPnwtLWsmZ3Q7IGtvcGFpPC90ZXh0Pjwvc3ZnPg==\",\n \"base64\"\n ),\n href: \"/documentation\",\n target: \"_blank\",\n },\n theme: {\n favicon: [\n {\n filename: \"favicon.svg\",\n rel: \"icon\",\n sizes: \"32x32\",\n type: \"image/svg+xml\",\n content: Buffer.from(\n \"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSI+PHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiByeD0iNCIgZmlsbD0iIzBhMGEwYSIvPjx0ZXh0IHg9IjMiIHk9IjIyIiBmb250LWZhbWlseT0idWktbW9ub3NwYWNlLCBtb25vc3BhY2UiIGZvbnQtc2l6ZT0iMTYiIGZvbnQtd2VpZ2h0PSI0MDAiIGZpbGw9IiNmYWZhZmEiPmsmZ3Q7PC90ZXh0Pjwvc3ZnPg==\",\n \"base64\"\n ),\n },\n ],\n },\n});\n\nconst sqliteDatabase = initializeDatabase(env.SQLITE_DB_FILE_PATH);\nconst telemetryDatasource = createOptimizedDatasource(sqliteDatabase);\nconst dashboardDatasource = new DashboardDbDatasource(sqliteDatabase);\n\napiServer.after(() => {\n apiServer.register(apiRoutes, {\n readTelemetryDatasource: telemetryDatasource,\n dynamicDashboardDatasource: dashboardDatasource,\n });\n apiServer.register(async (fastify) => {\n await fastify.register(FastifyVite, {\n root: resolve(__dirname, \"..\"),\n distDir: \"dist\",\n dev: false,\n spa: true,\n });\n fastify.get(\"/\", (_req, reply) => reply.html());\n fastify.get(\"/*\", (_req, reply) => reply.html());\n await fastify.vite.ready();\n });\n});\n\nconst collectorServer = fastify({\n logger: { level: \"warn\" },\n});\n\ncollectorServer.setValidatorCompiler(validatorCompiler);\ncollectorServer.setSerializerCompiler(serializerCompiler);\n\ncollectorServer.after(() => {\n collectorServer.register(otelCollectorRoutes, {\n telemetryDatasource,\n });\n});\n\nasync function run() {\n await apiServer.ready();\n await collectorServer.ready();\n\n const host = env.HOST || \"localhost\";\n const port = env.PORT;\n const collectorPort = 4318;\n\n await apiServer.listen({ port, host });\n await collectorServer.listen({ port: collectorPort, host });\n\n printStartupBanner({ host, port, collectorPort, version });\n\n apiServer.log.level = \"info\";\n collectorServer.log.level = \"info\";\n}\n\nrun().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n\ncloseWithGrace(async ({ signal, err }) => {\n if (err) {\n collectorServer.log.fatal(\n { err },\n \"Closing OTEL collector server with error\"\n );\n apiServer.log.fatal({ err }, \"Closing API server with error\");\n } else {\n collectorServer.log.info(\n `Received signal ${signal}, closing OTEL collector server`\n );\n apiServer.log.info(`Received signal ${signal}, closing API server`);\n }\n\n await collectorServer.close();\n sqliteDatabase?.close();\n await apiServer.close();\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAa,qBAAqB;CAAC;CAAa;CAAa;AAAO;AAEpE,MAAM,iBAAiB,CAAC,WAAW,IAAI;;;;;;;;;AAUvC,SAAgB,YAAY,MAAc,MAAkC;CAC1E,MAAM,OAAO,KAAK,YAAY;CAC9B,IAAI,eAAe,SAAS,IAAI,GAAG,OAAO,oBAAoB,KAAK;CACnE,IAAI,SAAS,OAAO,OAAO,gBAAgB,KAAK;CAChD,IAAI,SAAS,eAAe,SAAS,aACnC,OAAO,UAAU,KAAK,GAAG,KAAK;AAGlC;;AAGA,MAAa,uBAAuB;;;ACtBpC,MAAM,QADU,cAAc,YAAY,GACtB,CAAC,CAAC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C;CAE1D,mBAAmB;EAAE;EAAM;EAAM;EAAe;CAAQ,CAAC;CAEzD,UAAU,IAAI,QAAQ;CACtB,gBAAgB,IAAI,QAAQ;AAC9B;AAEA,IAAI,CAAC,CAAC,OAAO,QAAQ;CACnB,QAAQ,MAAM,GAAG;CACjB,QAAQ,KAAK,CAAC;AAChB,CAAC;AAED,eAAe,OAAO,EAAE,QAAQ,UAAU;CACxC,IAAI,KAAK;EACP,gBAAgB,IAAI,MAClB,EAAE,IAAI,GACN,0CACF;EACA,UAAU,IAAI,MAAM,EAAE,IAAI,GAAG,+BAA+B;CAC9D,OAAO;EACL,gBAAgB,IAAI,KAClB,mBAAmB,OAAO,gCAC5B;EACA,UAAU,IAAI,KAAK,mBAAmB,OAAO,qBAAqB;CACpE;CAEA,MAAM,gBAAgB,MAAM;CAC5B,gBAAgB,MAAM;CACtB,MAAM,UAAU,MAAM;AACxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopai/app",
3
- "version": "0.14.7",
3
+ "version": "0.15.1",
4
4
  "description": "Local OpenTelemetry backend for testing instrumentation - no Docker, no config, just npx",
5
5
  "keywords": [
6
6
  "opentelemetry",
@@ -48,30 +48,31 @@
48
48
  ],
49
49
  "dependencies": {
50
50
  "@fastify/vite": "^10.0.0",
51
- "@fastify/swagger": "^9.8.1",
51
+ "@fastify/swagger": "^9.9.1",
52
52
  "@fastify/swagger-ui": "^6.1.1",
53
53
  "close-with-grace": "^2.5.0",
54
- "fastify": "^5.12.4",
54
+ "fastify": "^5.12.5",
55
55
  "fastify-type-provider-zod": "^7.0.0",
56
56
  "zod": "^4.6.5",
57
57
  "@kopai/api": "0.9.0",
58
58
  "@kopai/core": "0.12.0",
59
- "@kopai/ui": "0.16.1",
60
59
  "@kopai/sqlite-datasource": "0.13.0",
61
- "@kopai/collector": "0.7.4"
60
+ "@kopai/mcp": "0.1.1",
61
+ "@kopai/collector": "0.7.4",
62
+ "@kopai/ui": "0.16.1"
62
63
  },
63
64
  "devDependencies": {
64
65
  "@types/react": "^19.3.0",
65
66
  "@types/react-dom": "^19.3.0",
66
- "@vitejs/plugin-react": "^6.1.1",
67
+ "@vitejs/plugin-react": "^6.1.2",
67
68
  "@tailwindcss/postcss": "^4.3.3",
68
- "postcss": "^8.5.28",
69
+ "postcss": "^8.5.29",
69
70
  "react": "^19.3.0",
70
71
  "react-dom": "^19.3.0",
71
72
  "tailwindcss": "^4.3.3",
72
73
  "tsdown": "^0.23.0",
73
74
  "typescript": "^6.0.3",
74
- "vite": "^8.3.0",
75
+ "vite": "^8.3.3",
75
76
  "@kopai/tsconfig": "0.2.0"
76
77
  },
77
78
  "scripts": {
@@ -80,6 +81,7 @@
80
81
  "dev": "node --env-file-if-exists=.env ./dist/cli.mjs start",
81
82
  "lint": "eslint src",
82
83
  "type-check": "tsc --noEmit",
84
+ "test": "vitest run",
83
85
  "start": "node ./dist/cli.mjs start"
84
86
  }
85
87
  }