@hcu-lab.me/mcp-device 1.0.1 → 1.0.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.
Files changed (47) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +70 -51
  3. package/dist/bootstrap.js +0 -0
  4. package/dist/command-manager.js +0 -0
  5. package/dist/config-field-definitions.js +0 -0
  6. package/dist/config-manager.js +0 -0
  7. package/dist/config.js +0 -0
  8. package/dist/custom-stdio.js +0 -0
  9. package/dist/data/official-app-ca.pem +12 -12
  10. package/dist/data/onboarding-prompts.json +70 -70
  11. package/dist/device/gateway-config.d.ts +1 -9
  12. package/dist/device/gateway-config.js +7 -27
  13. package/dist/device/gateway-identity.d.ts +2 -11
  14. package/dist/device/gateway-identity.js +11 -52
  15. package/dist/error-handlers.js +0 -0
  16. package/dist/handlers/filesystem-handlers.js +2 -2
  17. package/dist/index.js +0 -0
  18. package/dist/mcp-device.js +0 -0
  19. package/dist/search-manager.js +0 -0
  20. package/dist/server.js +656 -656
  21. package/dist/terminal-manager.js +0 -0
  22. package/dist/tools/edit.js +2 -2
  23. package/dist/tools/fuzzySearch.js +9 -9
  24. package/dist/tools/improved-process-tools.js +10 -10
  25. package/dist/tools/prompts.js +1 -1
  26. package/dist/types.js +0 -0
  27. package/dist/ui/config-editor/index.html +13 -13
  28. package/dist/ui/config-editor/src/app.js +30 -30
  29. package/dist/ui/config-editor/src/array-modal.js +32 -32
  30. package/dist/ui/config-editor/styles.css +586 -586
  31. package/dist/ui/file-preview/index.html +16 -16
  32. package/dist/ui/file-preview/src/app.js +8 -8
  33. package/dist/ui/file-preview/src/document-layout.js +31 -31
  34. package/dist/ui/file-preview/src/document-outline.js +8 -8
  35. package/dist/ui/file-preview/src/markdown/conflict-dialog.js +33 -33
  36. package/dist/ui/file-preview/src/markdown/controller.js +9 -9
  37. package/dist/ui/file-preview/src/markdown/editor.js +31 -31
  38. package/dist/ui/file-preview/styles.css +1630 -1630
  39. package/dist/utils/files/binary.js +4 -4
  40. package/dist/utils/files/excel.js +3 -3
  41. package/dist/utils/system-info.js +90 -90
  42. package/dist/utils/usageTracker.js +49 -49
  43. package/dist/version.d.ts +1 -1
  44. package/dist/version.js +1 -1
  45. package/package.json +131 -131
  46. package/dist/device/windows-dpapi.d.ts +0 -11
  47. package/dist/device/windows-dpapi.js +0 -67
package/package.json CHANGED
@@ -1,131 +1,131 @@
1
- {
2
- "name": "@hcu-lab.me/mcp-device",
3
- "version": "1.0.1",
4
- "description": "MCP Device securely connects a user-owned computer to an authenticated Model Context Protocol gateway.",
5
- "license": "MIT",
6
- "author": "Hirohimeow",
7
- "homepage": "https://github.com/Hiroshimeow/agent-mcp-device",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/Hiroshimeow/agent-mcp-device.git"
11
- },
12
- "bugs": "https://github.com/Hiroshimeow/agent-mcp-device/issues",
13
- "type": "module",
14
- "engines": {
15
- "node": ">=18.0.0"
16
- },
17
- "bin": {
18
- "mcp-device": "dist/mcp-device.js",
19
- "md": "dist/mcp-device.js"
20
- },
21
- "files": [
22
- "dist"
23
- ],
24
- "scripts": {
25
- "device:install": "cd src/device && npm install",
26
- "device:start": "tsx src/device/device.ts",
27
- "device:start:dev": "nodemon --watch src/device --exec tsx src/device/device.ts",
28
- "sync-version": "node scripts/sync-version.js",
29
- "bump": "node scripts/sync-version.js --bump",
30
- "bump:minor": "node scripts/sync-version.js --bump --minor",
31
- "bump:major": "node scripts/sync-version.js --bump --major",
32
- "build": "shx rm -rf dist/remote-device && shx rm -f dist/device/desktop-commander-integration.js dist/device/desktop-commander-integration.d.ts && tsc && shx chmod +x dist/*.js && shx mkdir -p dist/data && shx cp src/data/onboarding-prompts.json dist/data/ && node scripts/copy-official-ca.cjs && node scripts/build-ui-runtime.cjs",
33
- "watch": "tsc --watch",
34
- "start": "node dist/mcp-device.js",
35
- "start:debug": "node --inspect-brk=9229 dist/mcp-device.js",
36
- "prepack": "node scripts/verify-production-trust.cjs && shx rm -rf dist/remote-device && shx rm -f dist/device/desktop-commander-integration.js dist/device/desktop-commander-integration.d.ts dist/hcu-device.js dist/hcu-device.d.ts dist/track-installation.js dist/setup-claude-server.js dist/uninstall-claude-server.js dist/npm-scripts/setup.js dist/npm-scripts/setup.d.ts dist/npm-scripts/uninstall.js dist/npm-scripts/uninstall.d.ts dist/npm-scripts/verify-ripgrep.js dist/npm-scripts/verify-ripgrep.d.ts",
37
- "prepare": "npm run build",
38
- "clean": "shx rm -rf dist",
39
- "test": "npm run build && node test/run-all-tests.js",
40
- "test:integration": "npm run build && node test/integration/run-all-integration-tests.js",
41
- "test:debug": "node --inspect test/run-all-tests.js",
42
- "link:local": "npm run build && npm link",
43
- "unlink:local": "npm unlink",
44
- "inspector": "npx @modelcontextprotocol/inspector dist/index.js",
45
- "logs:view": "npm run build && node scripts/view-fuzzy-logs.js",
46
- "logs:analyze": "npm run build && node scripts/analyze-fuzzy-logs.js",
47
- "logs:clear": "npm run build && node scripts/clear-fuzzy-logs.js",
48
- "logs:export": "npm run build && node scripts/export-fuzzy-logs.js",
49
- "count-tokens": "npm run build && node scripts/count-tokens.js",
50
- "count-tokens:json": "npm run build && node scripts/count-tokens.js --json"
51
- },
52
- "keywords": [
53
- "mcp",
54
- "model-context-protocol",
55
- "terminal",
56
- "claude",
57
- "ai",
58
- "command-line",
59
- "process-management",
60
- "file-editing",
61
- "code-editing",
62
- "diff",
63
- "patch",
64
- "block-editing",
65
- "file-system",
66
- "text-manipulation",
67
- "code-modification",
68
- "surgical-edits",
69
- "file-operations"
70
- ],
71
- "dependencies": {
72
- "@modelcontextprotocol/sdk": "^1.9.0",
73
- "@opendocsg/pdf2md": "^0.2.2",
74
- "@tiptap/core": "^3.31.3",
75
- "@tiptap/extension-image": "^3.31.3",
76
- "@tiptap/extension-table": "^3.31.3",
77
- "@tiptap/extension-table-cell": "^3.31.3",
78
- "@tiptap/extension-table-header": "^3.31.3",
79
- "@tiptap/extension-table-row": "^3.31.3",
80
- "@tiptap/pm": "^3.31.3",
81
- "@tiptap/starter-kit": "^3.31.3",
82
- "@vscode/ripgrep": "^1.15.9",
83
- "cross-fetch": "^4.1.0",
84
- "exceljs": "^4.4.0",
85
- "fastest-levenshtein": "^1.0.16",
86
- "file-type": "^21.1.1",
87
- "highlight.js": "^11.11.1",
88
- "isbinaryfile": "^5.0.4",
89
- "markdown-it": "^14.1.0",
90
- "md-to-pdf": "^5.2.5",
91
- "open": "^10.2.0",
92
- "pdf-lib": "^1.17.1",
93
- "pizzip": "^3.2.0",
94
- "proxy-agent": "6.5.0",
95
- "proxy-from-env": "2.1.0",
96
- "qrcode-terminal": "^0.12.0",
97
- "remark": "^15.0.1",
98
- "remark-gfm": "^4.0.1",
99
- "remark-parse": "^11.0.0",
100
- "sharp": "^0.35.4",
101
- "tiptap-markdown": "^0.9.0",
102
- "unified": "^11.0.5",
103
- "unpdf": "^1.4.0",
104
- "ws": "^8.18.3",
105
- "zod": "^3.24.1",
106
- "zod-to-json-schema": "^3.23.5"
107
- },
108
- "optionalDependencies": {
109
- "caffeinate": "^1.0.1"
110
- },
111
- "devDependencies": {
112
- "@modelcontextprotocol/ext-apps": "^1.0.1",
113
- "@types/node": "^20.17.24",
114
- "@types/ws": "^8.18.1",
115
- "commander": "^13.1.0",
116
- "esbuild": "^0.27.2",
117
- "js-tiktoken": "^1.0.21",
118
- "jsdom": "^24.1.3",
119
- "nodemon": "^3.0.2",
120
- "shx": "^0.3.4",
121
- "ts-node": "^10.9.2",
122
- "tsx": "^4.21.0",
123
- "typescript": "^5.3.3"
124
- },
125
- "overrides": {
126
- "@mapbox/node-pre-gyp": "^2.0.3",
127
- "exceljs": {
128
- "uuid": "^11.1.1"
129
- }
130
- }
131
- }
1
+ {
2
+ "name": "@hcu-lab.me/mcp-device",
3
+ "version": "1.0.3",
4
+ "description": "MCP Device securely connects a user-owned computer to an authenticated Model Context Protocol gateway.",
5
+ "license": "MIT",
6
+ "author": "Hirohimeow",
7
+ "homepage": "https://github.com/Hiroshimeow/agent-mcp-device",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Hiroshimeow/agent-mcp-device.git"
11
+ },
12
+ "bugs": "https://github.com/Hiroshimeow/agent-mcp-device/issues",
13
+ "type": "module",
14
+ "engines": {
15
+ "node": ">=18.0.0"
16
+ },
17
+ "bin": {
18
+ "mcp-device": "dist/mcp-device.js",
19
+ "md": "dist/mcp-device.js"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "device:install": "cd src/device && npm install",
26
+ "device:start": "tsx src/device/device.ts",
27
+ "device:start:dev": "nodemon --watch src/device --exec tsx src/device/device.ts",
28
+ "sync-version": "node scripts/sync-version.js",
29
+ "bump": "node scripts/sync-version.js --bump",
30
+ "bump:minor": "node scripts/sync-version.js --bump --minor",
31
+ "bump:major": "node scripts/sync-version.js --bump --major",
32
+ "build": "shx rm -rf dist/remote-device && shx rm -f dist/device/desktop-commander-integration.js dist/device/desktop-commander-integration.d.ts dist/device/windows-dpapi.js dist/device/windows-dpapi.d.ts && tsc && shx chmod +x dist/*.js && shx mkdir -p dist/data && shx cp src/data/onboarding-prompts.json dist/data/ && node scripts/copy-official-ca.cjs && node scripts/build-ui-runtime.cjs",
33
+ "watch": "tsc --watch",
34
+ "start": "node dist/mcp-device.js",
35
+ "start:debug": "node --inspect-brk=9229 dist/mcp-device.js",
36
+ "prepack": "node scripts/verify-production-trust.cjs && shx rm -rf dist/remote-device && shx rm -f dist/device/desktop-commander-integration.js dist/device/desktop-commander-integration.d.ts dist/device/windows-dpapi.js dist/device/windows-dpapi.d.ts dist/hcu-device.js dist/hcu-device.d.ts dist/track-installation.js dist/setup-claude-server.js dist/uninstall-claude-server.js dist/npm-scripts/setup.js dist/npm-scripts/setup.d.ts dist/npm-scripts/uninstall.js dist/npm-scripts/uninstall.d.ts dist/npm-scripts/verify-ripgrep.js dist/npm-scripts/verify-ripgrep.d.ts",
37
+ "prepare": "npm run build",
38
+ "clean": "shx rm -rf dist",
39
+ "test": "npm run build && node test/run-all-tests.js",
40
+ "test:integration": "npm run build && node test/integration/run-all-integration-tests.js",
41
+ "test:debug": "node --inspect test/run-all-tests.js",
42
+ "link:local": "npm run build && npm link",
43
+ "unlink:local": "npm unlink",
44
+ "inspector": "npx @modelcontextprotocol/inspector dist/index.js",
45
+ "logs:view": "npm run build && node scripts/view-fuzzy-logs.js",
46
+ "logs:analyze": "npm run build && node scripts/analyze-fuzzy-logs.js",
47
+ "logs:clear": "npm run build && node scripts/clear-fuzzy-logs.js",
48
+ "logs:export": "npm run build && node scripts/export-fuzzy-logs.js",
49
+ "count-tokens": "npm run build && node scripts/count-tokens.js",
50
+ "count-tokens:json": "npm run build && node scripts/count-tokens.js --json"
51
+ },
52
+ "keywords": [
53
+ "mcp",
54
+ "model-context-protocol",
55
+ "terminal",
56
+ "claude",
57
+ "ai",
58
+ "command-line",
59
+ "process-management",
60
+ "file-editing",
61
+ "code-editing",
62
+ "diff",
63
+ "patch",
64
+ "block-editing",
65
+ "file-system",
66
+ "text-manipulation",
67
+ "code-modification",
68
+ "surgical-edits",
69
+ "file-operations"
70
+ ],
71
+ "dependencies": {
72
+ "@modelcontextprotocol/sdk": "^1.9.0",
73
+ "@opendocsg/pdf2md": "^0.2.2",
74
+ "@tiptap/core": "^3.31.3",
75
+ "@tiptap/extension-image": "^3.31.3",
76
+ "@tiptap/extension-table": "^3.31.3",
77
+ "@tiptap/extension-table-cell": "^3.31.3",
78
+ "@tiptap/extension-table-header": "^3.31.3",
79
+ "@tiptap/extension-table-row": "^3.31.3",
80
+ "@tiptap/pm": "^3.31.3",
81
+ "@tiptap/starter-kit": "^3.31.3",
82
+ "@vscode/ripgrep": "^1.15.9",
83
+ "cross-fetch": "^4.1.0",
84
+ "exceljs": "^4.4.0",
85
+ "fastest-levenshtein": "^1.0.16",
86
+ "file-type": "^21.1.1",
87
+ "highlight.js": "^11.11.1",
88
+ "isbinaryfile": "^5.0.4",
89
+ "markdown-it": "^14.1.0",
90
+ "md-to-pdf": "^5.2.5",
91
+ "open": "^10.2.0",
92
+ "pdf-lib": "^1.17.1",
93
+ "pizzip": "^3.2.0",
94
+ "proxy-agent": "6.5.0",
95
+ "proxy-from-env": "2.1.0",
96
+ "qrcode-terminal": "^0.12.0",
97
+ "remark": "^15.0.1",
98
+ "remark-gfm": "^4.0.1",
99
+ "remark-parse": "^11.0.0",
100
+ "sharp": "^0.35.4",
101
+ "tiptap-markdown": "^0.9.0",
102
+ "unified": "^11.0.5",
103
+ "unpdf": "^1.4.0",
104
+ "ws": "^8.18.3",
105
+ "zod": "^3.24.1",
106
+ "zod-to-json-schema": "^3.23.5"
107
+ },
108
+ "optionalDependencies": {
109
+ "caffeinate": "^1.0.1"
110
+ },
111
+ "devDependencies": {
112
+ "@modelcontextprotocol/ext-apps": "^1.0.1",
113
+ "@types/node": "^20.17.24",
114
+ "@types/ws": "^8.18.1",
115
+ "commander": "^13.1.0",
116
+ "esbuild": "^0.27.2",
117
+ "js-tiktoken": "^1.0.21",
118
+ "jsdom": "^24.1.3",
119
+ "nodemon": "^3.0.2",
120
+ "shx": "^0.3.4",
121
+ "ts-node": "^10.9.2",
122
+ "tsx": "^4.21.0",
123
+ "typescript": "^5.3.3"
124
+ },
125
+ "overrides": {
126
+ "@mapbox/node-pre-gyp": "^2.0.3",
127
+ "exceljs": {
128
+ "uuid": "^11.1.1"
129
+ }
130
+ }
131
+ }
@@ -1,11 +0,0 @@
1
- type DpapiLabel = 'identity' | 'proxy';
2
- type PowerShellRunner = (script: string, input: string) => Promise<string>;
3
- export declare function protectWindowsSecret(secret: Buffer | Uint8Array | string, label: DpapiLabel, options?: {
4
- platform?: NodeJS.Platform | string;
5
- runner?: PowerShellRunner;
6
- }): Promise<string>;
7
- export declare function unprotectWindowsSecret(blob: string, label: DpapiLabel, options?: {
8
- platform?: NodeJS.Platform | string;
9
- runner?: PowerShellRunner;
10
- }): Promise<Buffer>;
11
- export {};
@@ -1,67 +0,0 @@
1
- import { spawn } from 'child_process';
2
- const ENTROPY = {
3
- identity: 'hcu-device-identity-private-key-v1',
4
- proxy: 'hcu-device-proxy-url-v1'
5
- };
6
- function assertLabel(label) {
7
- if (!(label in ENTROPY))
8
- throw new Error('Unsupported DPAPI secret label.');
9
- }
10
- async function runPowerShell(script, input) {
11
- return await new Promise((resolve, reject) => {
12
- const child = spawn('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', script], {
13
- windowsHide: true,
14
- stdio: ['pipe', 'pipe', 'pipe']
15
- });
16
- const stdout = [];
17
- const stderr = [];
18
- child.stdout.on('data', chunk => stdout.push(Buffer.from(chunk)));
19
- child.stderr.on('data', chunk => stderr.push(Buffer.from(chunk)));
20
- child.once('error', reject);
21
- child.once('close', code => {
22
- if (code !== 0) {
23
- reject(new Error(Buffer.concat(stderr).toString('utf8').trim() || `DPAPI PowerShell failed with exit code ${code}`));
24
- return;
25
- }
26
- resolve(Buffer.concat(stdout).toString('utf8').trim());
27
- });
28
- child.stdin.end(input, 'utf8');
29
- });
30
- }
31
- function dpapiScript(action, label) {
32
- const entropy = Buffer.from(ENTROPY[label], 'utf8').toString('base64');
33
- return [
34
- "$ErrorActionPreference = 'Stop'",
35
- 'Add-Type -AssemblyName System.Security',
36
- '$inputB64 = [Console]::In.ReadToEnd().Trim()',
37
- '$data = [Convert]::FromBase64String($inputB64)',
38
- `$entropy = [Convert]::FromBase64String('${entropy}')`,
39
- '$scope = [System.Security.Cryptography.DataProtectionScope]::CurrentUser',
40
- `$output = [System.Security.Cryptography.ProtectedData]::${action}($data, $entropy, $scope)`,
41
- '[Console]::Out.Write([Convert]::ToBase64String($output))'
42
- ].join('; ');
43
- }
44
- export async function protectWindowsSecret(secret, label, options = {}) {
45
- const platform = options.platform || process.platform;
46
- if (platform !== 'win32')
47
- throw new Error('Windows DPAPI is only available on Windows.');
48
- assertLabel(label);
49
- const bytes = typeof secret === 'string' ? Buffer.from(secret, 'utf8') : Buffer.from(secret);
50
- const output = await (options.runner || runPowerShell)(dpapiScript('Protect', label), bytes.toString('base64'));
51
- if (!output)
52
- throw new Error('Windows DPAPI returned an empty protected value.');
53
- return output;
54
- }
55
- export async function unprotectWindowsSecret(blob, label, options = {}) {
56
- const platform = options.platform || process.platform;
57
- if (platform !== 'win32')
58
- throw new Error('Windows DPAPI is only available on Windows.');
59
- assertLabel(label);
60
- const input = String(blob || '').trim();
61
- if (!input)
62
- throw new Error('Windows DPAPI protected value is empty.');
63
- const output = await (options.runner || runPowerShell)(dpapiScript('Unprotect', label), input);
64
- if (!output)
65
- throw new Error('Windows DPAPI returned an empty unprotected value.');
66
- return Buffer.from(output, 'base64');
67
- }