Skip to content

Commit f49e859

Browse files
committed
Add an MCP server & CLI interface
1 parent 92c4d97 commit f49e859

12 files changed

Lines changed: 1302 additions & 192 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ httptoolkit-server/
66
appveyor-tools/
77
.playwright/
88
httptoolkit-server.tar.gz
9+
httptoolkit-cli

build-setup/build-cli.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { execFileSync, execSync } from 'child_process';
2+
3+
const SEA_CONFIG = 'src/cli/sea-config.json';
4+
const CLI_BINARY = 'httptoolkit-cli';
5+
const SEA_BLOB = 'build/cli/cli.blob';
6+
const SENTINEL_FUSE = 'NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2';
7+
8+
// Generate the single-executable-application blob from the compiled CLI JS:
9+
console.log('Generating SEA blob...');
10+
execFileSync(process.execPath, ['--experimental-sea-config', SEA_CONFIG], {
11+
stdio: 'inherit'
12+
});
13+
14+
// Copy the current Node binary to use as the CLI executable:
15+
console.log('Copying node binary...');
16+
const nodePath = execSync('which node', { encoding: 'utf8' }).trim();
17+
execFileSync('cp', [nodePath, CLI_BINARY]);
18+
19+
// Inject the SEA blob into the copied binary:
20+
console.log('Injecting SEA blob...');
21+
execFileSync('npx', [
22+
'postject', CLI_BINARY,
23+
'NODE_SEA_BLOB', SEA_BLOB,
24+
'--sentinel-fuse', SENTINEL_FUSE
25+
], {
26+
stdio: 'inherit'
27+
});
28+
29+
console.log('CLI build completed.');

package-lock.json

Lines changed: 6 additions & 183 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"start": "npm run server:setup && npm run start:app",
1919
"start:dev": "tsx ./build-setup/skip-server.ts && cross-env HTK_DEV=true APP_URL='http://localhost:8080' npm run start:app",
2020
"start:app": "tsc-watch --onSuccess \"electron .\"",
21+
"build:cli": "tsx ./build-setup/build-cli.ts",
2122
"test": "npm run server:setup && npm run build:src && playwright test"
2223
},
2324
"keywords": [],
@@ -57,7 +58,8 @@
5758
"!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}"
5859
],
5960
"extraResources": [
60-
"httptoolkit-server/**/*"
61+
"httptoolkit-server/**/*",
62+
"httptoolkit-cli"
6163
],
6264
"artifactName": "HttpToolkit-${version}-${arch}.${ext}",
6365
"mac": {

0 commit comments

Comments
 (0)