@casys/mcp-server 0.17.2 → 0.17.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casys/mcp-server",
3
- "version": "0.17.2",
3
+ "version": "0.17.3",
4
4
  "description": "Production-ready MCP server framework with concurrency control, auth, and observability",
5
5
  "type": "module",
6
6
  "main": "mod.ts",
package/src/mcp-app.ts CHANGED
@@ -2297,7 +2297,8 @@ export interface RegisterViewersConfig {
2297
2297
  prefix: string;
2298
2298
  /** import.meta.url of the consumer's server.ts (for resolving dist paths) */
2299
2299
  moduleUrl: string;
2300
- /** Check if a filesystem path exists */
2300
+ /** Check if a path or URL exists. Receives a filesystem path for local
2301
+ * modules (file://) or an HTTPS URL for remote modules (JSR, CDN). */
2301
2302
  exists: (path: string) => boolean;
2302
2303
  /** Read a file and return its content as string */
2303
2304
  readFile: (path: string) => string | Promise<string>;
@@ -46,6 +46,22 @@ export function resolveViewerDistPath(
46
46
  viewerName: string,
47
47
  exists: (path: string) => boolean,
48
48
  ): string | null {
49
+ // When consumed from JSR or any remote registry, import.meta.url is an
50
+ // HTTPS URL. fileUrlToPath() only handles file:// — passing an HTTPS URL
51
+ // produces a broken UNC-like path ("//jsr.io/..."). Return the raw resolved
52
+ // URL string instead; the caller's exists/readFile callbacks are responsible
53
+ // for handling remote URLs (e.g., via fetch()).
54
+ if (moduleUrl.startsWith("https://") || moduleUrl.startsWith("http://")) {
55
+ const candidates = [
56
+ new URL(`./src/ui/dist/${viewerName}/index.html`, moduleUrl).href,
57
+ new URL(`./ui-dist/${viewerName}/index.html`, moduleUrl).href,
58
+ ];
59
+ for (const candidate of candidates) {
60
+ if (exists(candidate)) return candidate;
61
+ }
62
+ return null;
63
+ }
64
+
49
65
  const candidates = [
50
66
  fileUrlToPath(new URL(`./src/ui/dist/${viewerName}/index.html`, moduleUrl)),
51
67
  fileUrlToPath(new URL(`./ui-dist/${viewerName}/index.html`, moduleUrl)),