Remove HTTP server mode, keep MCP + CLI only

Drop express dependency and HTTP server in favor of MCP-only architecture.
CLI still works for quick screenshots and queries.

- Delete src/server.ts and src/server.test.ts
- Remove express, @types/express, supertest from dependencies
- Update CLI to show help when no URL provided
- Remove server exports from index.ts

-33 packages removed, 757 lines deleted.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Adam Ladachowski
2026-02-11 12:31:42 +01:00
parent 1fd9ffa84d
commit 3014cf98e8
12 changed files with 13 additions and 757 deletions
Vendored
+4 -32
View File
@@ -5,7 +5,6 @@ import { fileURLToPath } from 'node:url';
import { parseArgs } from 'node:util';
import { ClaudeBrowser } from './browser.js';
import * as image from './image.js';
import { startServer } from './server.js';
const __dirname = dirname(fileURLToPath(import.meta.url));
const pkg = JSON.parse(readFileSync(resolve(__dirname, '../package.json'), 'utf-8'));
const { values, positionals } = parseArgs({
@@ -71,25 +70,8 @@ Image processing examples:
browse https://example.com --resize 800x600
browse https://example.com --compress 60
Server mode (default):
browse # Start server on port 13373
browse --headed # Start with visible browser
# Send commands via curl:
curl -X POST http://localhost:13373 -d '{"cmd":"goto","url":"https://example.com"}'
curl -X POST http://localhost:13373 -d '{"cmd":"click","selector":"button"}'
curl -X POST http://localhost:13373 -d '{"cmd":"type","selector":"input","text":"hello"}'
curl -X POST http://localhost:13373 -d '{"cmd":"query","selector":"a[href]"}'
curl -X POST http://localhost:13373 -d '{"cmd":"screenshot","path":"shot.png"}'
curl -X POST http://localhost:13373 -d '{"cmd":"url"}'
curl -X POST http://localhost:13373 -d '{"cmd":"html"}'
curl -X POST http://localhost:13373 -d '{"cmd":"close"}'
# Image processing via server:
curl localhost:13373 -d '{"cmd":"favicon","input":"screenshot.png","outputDir":"./favicons"}'
curl localhost:13373 -d '{"cmd":"convert","input":"img.png","output":"img.webp","format":"webp"}'
curl localhost:13373 -d '{"cmd":"resize","input":"img.png","output":"small.png","width":400}'
curl localhost:13373 -d '{"cmd":"compress","input":"img.png","output":"compressed.png","quality":60}'
MCP Server (for Claude Code integration):
browse-mcp # Run as MCP server (stdio transport)
`;
function getViewportConfig() {
return {
@@ -98,16 +80,6 @@ function getViewportConfig() {
height: Number.parseInt(values.height),
};
}
async function runServerMode() {
const port = 13373;
const server = await startServer({ port, ...getViewportConfig() });
process.on('SIGINT', async () => {
console.log('\nShutting down...');
await server.stop();
process.exit(0);
});
await new Promise(() => { });
}
async function processTypeActions(browser) {
const typeActions = values.type;
if (!typeActions?.length)
@@ -235,8 +207,8 @@ async function main() {
process.exit(0);
}
if (positionals.length === 0) {
await runServerMode();
return;
console.log(HELP);
process.exit(0);
}
await runBrowserMode();
}