fix: MCP server compatibility and web UI path resolution
Fixes #371, #369 **Issue #371: MCP server fails when Bun not in PATH** - Changed MCP server shebang from `#!/usr/bin/env bun` to `#!/usr/bin/env node` - MCP server now works regardless of whether Bun is in PATH - Worker service correctly uses getBunPath() to find Bun in common install locations **Issue #369: Web UI returns ENOENT error** - Fixed hardcoded 'plugin/' path in ViewerRoutes - Now checks both cache structure (ui/viewer.html) and marketplace structure (plugin/ui/viewer.html) - Web UI now works from both ~/.claude/plugins/cache and ~/.claude/plugins/marketplaces **Technical Details:** - Updated build-hooks.js to use Node shebang for MCP server (line 169) - Enhanced ViewerRoutes.handleViewerUI() to try multiple path patterns - Added existsSync check to find viewer.html in either location 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -166,7 +166,7 @@ async function buildHooks() {
|
|||||||
'__DEFAULT_PACKAGE_VERSION__': `"${version}"`
|
'__DEFAULT_PACKAGE_VERSION__': `"${version}"`
|
||||||
},
|
},
|
||||||
banner: {
|
banner: {
|
||||||
js: '#!/usr/bin/env bun'
|
js: '#!/usr/bin/env node'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import express, { Request, Response } from 'express';
|
import express, { Request, Response } from 'express';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { readFileSync } from 'fs';
|
import { readFileSync, existsSync } from 'fs';
|
||||||
import { getPackageRoot } from '../../../../shared/paths.js';
|
import { getPackageRoot } from '../../../../shared/paths.js';
|
||||||
import { SSEBroadcaster } from '../../SSEBroadcaster.js';
|
import { SSEBroadcaster } from '../../SSEBroadcaster.js';
|
||||||
import { DatabaseManager } from '../../DatabaseManager.js';
|
import { DatabaseManager } from '../../DatabaseManager.js';
|
||||||
@@ -41,7 +41,19 @@ export class ViewerRoutes extends BaseRouteHandler {
|
|||||||
*/
|
*/
|
||||||
private handleViewerUI = this.wrapHandler((req: Request, res: Response): void => {
|
private handleViewerUI = this.wrapHandler((req: Request, res: Response): void => {
|
||||||
const packageRoot = getPackageRoot();
|
const packageRoot = getPackageRoot();
|
||||||
const viewerPath = path.join(packageRoot, 'plugin', 'ui', 'viewer.html');
|
|
||||||
|
// Try cache structure first (ui/viewer.html), then marketplace structure (plugin/ui/viewer.html)
|
||||||
|
const viewerPaths = [
|
||||||
|
path.join(packageRoot, 'ui', 'viewer.html'),
|
||||||
|
path.join(packageRoot, 'plugin', 'ui', 'viewer.html')
|
||||||
|
];
|
||||||
|
|
||||||
|
const viewerPath = viewerPaths.find(p => existsSync(p));
|
||||||
|
|
||||||
|
if (!viewerPath) {
|
||||||
|
throw new Error('Viewer UI not found at any expected location');
|
||||||
|
}
|
||||||
|
|
||||||
const html = readFileSync(viewerPath, 'utf-8');
|
const html = readFileSync(viewerPath, 'utf-8');
|
||||||
res.setHeader('Content-Type', 'text/html');
|
res.setHeader('Content-Type', 'text/html');
|
||||||
res.send(html);
|
res.send(html);
|
||||||
|
|||||||
Reference in New Issue
Block a user