@ao_zorin/zocket 1.0.0
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/LICENSE +21 -0
- package/README.md +92 -0
- package/bin/zocket-setup.cjs +12 -0
- package/bin/zocket.cjs +174 -0
- package/docs/AI_AUTODEPLOY.md +52 -0
- package/docs/CLIENTS_MCP.md +59 -0
- package/docs/INSTALL.md +288 -0
- package/docs/LOCAL_MODELS.md +95 -0
- package/package.json +52 -0
- package/pyproject.toml +29 -0
- package/scripts/ai-autodeploy.py +127 -0
- package/scripts/install-zocket.ps1 +116 -0
- package/scripts/install-zocket.sh +228 -0
- package/zocket/__init__.py +2 -0
- package/zocket/__main__.py +5 -0
- package/zocket/audit.py +76 -0
- package/zocket/auth.py +34 -0
- package/zocket/autostart.py +281 -0
- package/zocket/backup.py +33 -0
- package/zocket/cli.py +655 -0
- package/zocket/config_store.py +68 -0
- package/zocket/crypto.py +158 -0
- package/zocket/harden.py +136 -0
- package/zocket/i18n.py +216 -0
- package/zocket/mcp_server.py +249 -0
- package/zocket/paths.py +50 -0
- package/zocket/runner.py +108 -0
- package/zocket/templates/index.html +1062 -0
- package/zocket/templates/login.html +244 -0
- package/zocket/vault.py +331 -0
- package/zocket/web.py +490 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zocket contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# zocket
|
|
2
|
+
|
|
3
|
+
Local encrypted vault + web panel + MCP server for AI agent workflows.
|
|
4
|
+
|
|
5
|
+
## What zocket provides
|
|
6
|
+
|
|
7
|
+
- encrypted secret vault across projects/sessions
|
|
8
|
+
- local web panel (`127.0.0.1:18001`)
|
|
9
|
+
- MCP server:
|
|
10
|
+
- stdio
|
|
11
|
+
- SSE (`127.0.0.1:18002/sse`) for Claude Code
|
|
12
|
+
- streamable HTTP (`127.0.0.1:18003/mcp`) for Codex
|
|
13
|
+
- EN/RU UI and CLI
|
|
14
|
+
- first-run web setup:
|
|
15
|
+
- set your own password
|
|
16
|
+
- generate strong password
|
|
17
|
+
- continue without password (with explicit warning)
|
|
18
|
+
- project-to-folder mapping with folder picker
|
|
19
|
+
- audit log, backup/restore, key rotation
|
|
20
|
+
- Linux hardened system services (`zocketd`)
|
|
21
|
+
|
|
22
|
+
## Install (instant)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm i -g @zocket/cli
|
|
26
|
+
zocket setup
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Install (dev)
|
|
30
|
+
|
|
31
|
+
### Python
|
|
32
|
+
```bash
|
|
33
|
+
pip install -e .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### npm wrapper
|
|
37
|
+
```bash
|
|
38
|
+
npm install
|
|
39
|
+
npm run smoke:npm
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
or global from git:
|
|
43
|
+
```bash
|
|
44
|
+
npm i -g github:your-org/zocket
|
|
45
|
+
zocket setup
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
zocket init
|
|
52
|
+
zocket web --host 127.0.0.1 --port 18001
|
|
53
|
+
zocket mcp --transport sse --mode metadata --host 127.0.0.1 --port 18002
|
|
54
|
+
zocket mcp --transport streamable-http --mode metadata --host 127.0.0.1 --port 18003
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Open `http://127.0.0.1:18001`.
|
|
58
|
+
|
|
59
|
+
## Docs
|
|
60
|
+
|
|
61
|
+
- installation (Windows/Linux/macOS): [`docs/INSTALL.md`](docs/INSTALL.md)
|
|
62
|
+
- MCP clients (Codex/Claude Code): [`docs/CLIENTS_MCP.md`](docs/CLIENTS_MCP.md)
|
|
63
|
+
- local models (Ollama/Hugging Face): [`docs/LOCAL_MODELS.md`](docs/LOCAL_MODELS.md)
|
|
64
|
+
- AI one-file auto-deploy playbook: [`docs/AI_AUTODEPLOY.md`](docs/AI_AUTODEPLOY.md)
|
|
65
|
+
- git + npm + pypi release flow: [`docs/GIT_NPM_RELEASE.md`](docs/GIT_NPM_RELEASE.md)
|
|
66
|
+
- external source links: [`docs/SOURCES.md`](docs/SOURCES.md)
|
|
67
|
+
|
|
68
|
+
## Security defaults
|
|
69
|
+
|
|
70
|
+
- keep MCP in `metadata` mode unless admin tools are required
|
|
71
|
+
- bind web/MCP to loopback
|
|
72
|
+
- on Linux production use:
|
|
73
|
+
```bash
|
|
74
|
+
sudo env ZOCKET_HOME=/var/lib/zocket zocket harden install-linux-system \
|
|
75
|
+
--service-user zocketd \
|
|
76
|
+
--zocket-home /var/lib/zocket \
|
|
77
|
+
--web-port 18001 \
|
|
78
|
+
--mcp-host 127.0.0.1 \
|
|
79
|
+
--mcp-port 18002 \
|
|
80
|
+
--mcp-mode metadata
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
PYTHONPATH=. pytest -q
|
|
87
|
+
bash scripts/release-check.sh
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT, see [`LICENSE`](LICENSE).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const cp = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const launcher = path.resolve(__dirname, "zocket.cjs");
|
|
7
|
+
const res = cp.spawnSync(process.execPath, [launcher, "setup"], {
|
|
8
|
+
stdio: "inherit",
|
|
9
|
+
env: process.env,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
process.exit(res.status === null ? 1 : res.status);
|
package/bin/zocket.cjs
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const cp = require("child_process");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
|
|
8
|
+
const isWin = process.platform === "win32";
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
const pkgRoot = path.resolve(__dirname, "..");
|
|
11
|
+
const launcherVersion = "1.0.0";
|
|
12
|
+
|
|
13
|
+
function fail(msg, code = 1) {
|
|
14
|
+
process.stderr.write(`${msg}\n`);
|
|
15
|
+
process.exit(code);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function run(cmd, cmdArgs, opts = {}) {
|
|
19
|
+
const res = cp.spawnSync(cmd, cmdArgs, {
|
|
20
|
+
stdio: "inherit",
|
|
21
|
+
env: process.env,
|
|
22
|
+
...opts,
|
|
23
|
+
});
|
|
24
|
+
return res.status === null ? 1 : res.status;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function probe(cmd, cmdArgs) {
|
|
28
|
+
const res = cp.spawnSync(cmd, cmdArgs, {
|
|
29
|
+
stdio: "ignore",
|
|
30
|
+
env: process.env,
|
|
31
|
+
});
|
|
32
|
+
return res.status === 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function findPython() {
|
|
36
|
+
const candidates = isWin
|
|
37
|
+
? [
|
|
38
|
+
{ cmd: "py", prefix: ["-3"] },
|
|
39
|
+
{ cmd: "python", prefix: [] },
|
|
40
|
+
{ cmd: "python3", prefix: [] },
|
|
41
|
+
]
|
|
42
|
+
: [
|
|
43
|
+
{ cmd: "python3", prefix: [] },
|
|
44
|
+
{ cmd: "python", prefix: [] },
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
for (const item of candidates) {
|
|
48
|
+
const ok = probe(item.cmd, [...item.prefix, "-c", "import sys;sys.exit(0)"]);
|
|
49
|
+
if (ok) {
|
|
50
|
+
return item;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function installRoot() {
|
|
57
|
+
if (isWin) {
|
|
58
|
+
const base = process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local");
|
|
59
|
+
return path.join(base, "zocket");
|
|
60
|
+
}
|
|
61
|
+
return path.join(os.homedir(), ".local", "share", "zocket");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function venvPython(venvDir) {
|
|
65
|
+
return isWin
|
|
66
|
+
? path.join(venvDir, "Scripts", "python.exe")
|
|
67
|
+
: path.join(venvDir, "bin", "python3");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function removeIfExists(target) {
|
|
71
|
+
if (fs.existsSync(target)) {
|
|
72
|
+
fs.rmSync(target, { recursive: true, force: true });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function prepareInstallSource(rootDir) {
|
|
77
|
+
const sourceDir = path.join(rootDir, "npm-install-source");
|
|
78
|
+
removeIfExists(sourceDir);
|
|
79
|
+
fs.mkdirSync(sourceDir, { recursive: true });
|
|
80
|
+
|
|
81
|
+
const filesToCopy = ["pyproject.toml", "README.md", "zocket"];
|
|
82
|
+
for (const item of filesToCopy) {
|
|
83
|
+
const src = path.join(pkgRoot, item);
|
|
84
|
+
if (!fs.existsSync(src)) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const dst = path.join(sourceDir, item);
|
|
88
|
+
const stat = fs.statSync(src);
|
|
89
|
+
if (stat.isDirectory()) {
|
|
90
|
+
fs.cpSync(src, dst, { recursive: true });
|
|
91
|
+
} else {
|
|
92
|
+
fs.copyFileSync(src, dst);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return sourceDir;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function ensureVenv() {
|
|
99
|
+
const root = installRoot();
|
|
100
|
+
const venvDir = path.join(root, "venv");
|
|
101
|
+
const marker = path.join(root, "npm-launcher-version.txt");
|
|
102
|
+
const pyBin = venvPython(venvDir);
|
|
103
|
+
let needInstall = !fs.existsSync(pyBin);
|
|
104
|
+
|
|
105
|
+
if (!needInstall && fs.existsSync(marker)) {
|
|
106
|
+
const current = fs.readFileSync(marker, "utf-8").trim();
|
|
107
|
+
if (current !== launcherVersion) {
|
|
108
|
+
needInstall = true;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!needInstall) {
|
|
113
|
+
const healthy = probe(pyBin, ["-c", "import zocket, cryptography"]);
|
|
114
|
+
if (!healthy) {
|
|
115
|
+
needInstall = true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!needInstall) {
|
|
120
|
+
return pyBin;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const py = findPython();
|
|
124
|
+
if (!py) {
|
|
125
|
+
fail(
|
|
126
|
+
[
|
|
127
|
+
"Python 3.10+ was not found.",
|
|
128
|
+
"Install Python first, then rerun:",
|
|
129
|
+
" zocket setup",
|
|
130
|
+
].join("\n")
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
fs.mkdirSync(root, { recursive: true });
|
|
135
|
+
let code = run(py.cmd, [...py.prefix, "-m", "venv", venvDir]);
|
|
136
|
+
if (code !== 0) {
|
|
137
|
+
fail("Failed to create virtual environment for zocket.");
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
code = run(pyBin, ["-m", "pip", "install", "--upgrade", "pip", "setuptools", "wheel"]);
|
|
141
|
+
if (code !== 0) {
|
|
142
|
+
fail("Failed to bootstrap pip in zocket virtual environment.");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Install from a writable user-owned source copy to avoid permission issues.
|
|
146
|
+
const sourceDir = prepareInstallSource(root);
|
|
147
|
+
code = run(pyBin, ["-m", "pip", "install", sourceDir]);
|
|
148
|
+
if (code !== 0) {
|
|
149
|
+
fail("Failed to install zocket Python package from npm bundle.");
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
fs.writeFileSync(marker, `${launcherVersion}\n`, "utf-8");
|
|
153
|
+
return pyBin;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (args[0] === "setup") {
|
|
157
|
+
ensureVenv();
|
|
158
|
+
process.stdout.write("zocket runtime is installed.\n");
|
|
159
|
+
process.exit(0);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (args[0] === "doctor") {
|
|
163
|
+
const py = findPython();
|
|
164
|
+
const root = installRoot();
|
|
165
|
+
const pyBin = venvPython(path.join(root, "venv"));
|
|
166
|
+
process.stdout.write(`python_found=${py ? "yes" : "no"}\n`);
|
|
167
|
+
process.stdout.write(`venv_python=${pyBin}\n`);
|
|
168
|
+
process.stdout.write(`venv_exists=${fs.existsSync(pyBin) ? "yes" : "no"}\n`);
|
|
169
|
+
process.exit(0);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const runtimePython = ensureVenv();
|
|
173
|
+
const code = run(runtimePython, ["-m", "zocket", ...args]);
|
|
174
|
+
process.exit(code);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# AI Auto-Deploy Playbook
|
|
2
|
+
|
|
3
|
+
This is the file you can send to an AI coding agent so it can deploy zocket end-to-end.
|
|
4
|
+
|
|
5
|
+
## One-command bootstrap
|
|
6
|
+
|
|
7
|
+
If this repo is already present locally:
|
|
8
|
+
```bash
|
|
9
|
+
python3 scripts/ai-autodeploy.py --repo-url https://github.com/your-org/zocket.git --repo-ref main
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
If only the file is available, the script will clone the repo and run the platform installer.
|
|
13
|
+
|
|
14
|
+
## Agent task prompt (copy/paste)
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
Deploy zocket on this machine with secure defaults:
|
|
18
|
+
1) Detect OS and shell.
|
|
19
|
+
2) Run scripts/ai-autodeploy.py with:
|
|
20
|
+
--lang en
|
|
21
|
+
--web-port 18001
|
|
22
|
+
--mcp-port 18002
|
|
23
|
+
--mcp-mode metadata
|
|
24
|
+
--autostart user (Linux/macOS) or enabled startup task (Windows)
|
|
25
|
+
3) Verify:
|
|
26
|
+
- web panel on http://127.0.0.1:18001
|
|
27
|
+
- MCP SSE endpoint on http://127.0.0.1:18002/sse (Claude Code)
|
|
28
|
+
- MCP streamable endpoint on http://127.0.0.1:18003/mcp (Codex)
|
|
29
|
+
4) Configure MCP clients using docs/CLIENTS_MCP.md (Codex + Claude Code only).
|
|
30
|
+
5) Return final report with commands executed and health-check results.
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Optional production profile (Linux system services)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
python3 scripts/ai-autodeploy.py \
|
|
37
|
+
--repo-url https://github.com/your-org/zocket.git \
|
|
38
|
+
--repo-ref main \
|
|
39
|
+
--autostart system \
|
|
40
|
+
--zocket-home /var/lib/zocket
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Post-deploy checklist for agent
|
|
44
|
+
|
|
45
|
+
1. Confirm web login/setup page opens.
|
|
46
|
+
2. Confirm MCP HTTP is reachable on loopback only.
|
|
47
|
+
3. Configure one client (Codex or Claude Code) and run `list_projects` tool.
|
|
48
|
+
4. Ensure no secret values are returned in metadata mode.
|
|
49
|
+
5. Save final links:
|
|
50
|
+
- [INSTALL.md](/home/zorin/project/zocket/docs/INSTALL.md)
|
|
51
|
+
- [CLIENTS_MCP.md](/home/zorin/project/zocket/docs/CLIENTS_MCP.md)
|
|
52
|
+
- [LOCAL_MODELS.md](/home/zorin/project/zocket/docs/LOCAL_MODELS.md)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# MCP Client Integration (Codex + Claude Code)
|
|
2
|
+
|
|
3
|
+
This file contains ready-to-use zocket MCP configs for:
|
|
4
|
+
- Codex CLI
|
|
5
|
+
- Claude Code
|
|
6
|
+
|
|
7
|
+
Use safest mode by default:
|
|
8
|
+
- `metadata` (recommended)
|
|
9
|
+
|
|
10
|
+
Use admin mode only when needed:
|
|
11
|
+
- `admin`
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Endpoints
|
|
16
|
+
|
|
17
|
+
- Claude Code (SSE):
|
|
18
|
+
- `http://127.0.0.1:18002/sse`
|
|
19
|
+
|
|
20
|
+
- Codex (streamable HTTP):
|
|
21
|
+
- `http://127.0.0.1:18003/mcp`
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Claude Code
|
|
26
|
+
|
|
27
|
+
Recommended: SSE (loopback only).
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
claude mcp add --transport sse zocket http://127.0.0.1:18002/sse
|
|
31
|
+
claude mcp list
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Note: Claude Code uses `--transport sse` (not http) for SSE endpoints.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Codex CLI
|
|
39
|
+
|
|
40
|
+
Recommended: streamable HTTP.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
codex mcp add zocket --url http://127.0.0.1:18003/mcp
|
|
44
|
+
codex mcp list
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Config file alternative (`~/.codex/config.toml`):
|
|
48
|
+
```toml
|
|
49
|
+
[mcp_servers.zocket]
|
|
50
|
+
url = "http://127.0.0.1:18003/mcp"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Security defaults
|
|
56
|
+
|
|
57
|
+
- Prefer `metadata` mode in all clients.
|
|
58
|
+
- Keep MCP bound to `127.0.0.1`.
|
|
59
|
+
- Do not expose these ports to the network.
|
package/docs/INSTALL.md
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# Install Guide (Windows / Linux / macOS)
|
|
2
|
+
|
|
3
|
+
This guide installs **zocket** as:
|
|
4
|
+
- local web panel on `127.0.0.1:18001`
|
|
5
|
+
- MCP SSE server on `127.0.0.1:18002/sse` (Claude Code)
|
|
6
|
+
- MCP streamable HTTP server on `127.0.0.1:18003/mcp` (Codex)
|
|
7
|
+
- optional MCP stdio server for local CLI use
|
|
8
|
+
|
|
9
|
+
## 1) Quick Install (recommended)
|
|
10
|
+
|
|
11
|
+
### Linux and macOS
|
|
12
|
+
```bash
|
|
13
|
+
curl -fsSL https://raw.githubusercontent.com/your-org/zocket/main/scripts/install-zocket.sh | bash
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
If you run from a local clone:
|
|
17
|
+
```bash
|
|
18
|
+
bash scripts/install-zocket.sh --source local
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Windows (PowerShell)
|
|
22
|
+
```powershell
|
|
23
|
+
irm https://raw.githubusercontent.com/your-org/zocket/main/scripts/install-zocket.ps1 | iex
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If you run from a local clone:
|
|
27
|
+
```powershell
|
|
28
|
+
powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1 -Source Local
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 2) Linux details
|
|
32
|
+
|
|
33
|
+
### Debian/Ubuntu and Debian-based
|
|
34
|
+
Installer auto-installs:
|
|
35
|
+
- `python3`
|
|
36
|
+
- `python3-venv`
|
|
37
|
+
- `python3-pip`
|
|
38
|
+
- `git`
|
|
39
|
+
- `curl`
|
|
40
|
+
|
|
41
|
+
Equivalent manual install:
|
|
42
|
+
```bash
|
|
43
|
+
sudo apt-get update
|
|
44
|
+
sudo apt-get install -y python3 python3-venv python3-pip git curl
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Other Linux distros
|
|
48
|
+
Installer supports:
|
|
49
|
+
- `dnf`/`yum` (RHEL/Fedora)
|
|
50
|
+
- `pacman` (Arch)
|
|
51
|
+
- `zypper` (openSUSE)
|
|
52
|
+
- `apk` (Alpine)
|
|
53
|
+
|
|
54
|
+
If your distro is unsupported, install manually:
|
|
55
|
+
- Python `>=3.10`
|
|
56
|
+
- `pip`
|
|
57
|
+
- `venv`
|
|
58
|
+
- `git`
|
|
59
|
+
|
|
60
|
+
## 3) macOS details
|
|
61
|
+
|
|
62
|
+
Installer uses Homebrew when dependencies are missing:
|
|
63
|
+
```bash
|
|
64
|
+
brew install python git curl
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 4) Windows details
|
|
68
|
+
|
|
69
|
+
Requirements:
|
|
70
|
+
- Python 3.10+ (recommended from `python.org` or `winget`)
|
|
71
|
+
- Git for Windows
|
|
72
|
+
|
|
73
|
+
Optional autostart:
|
|
74
|
+
```powershell
|
|
75
|
+
powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1 -EnableAutostart
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This creates scheduled tasks:
|
|
79
|
+
- `ZocketWeb`
|
|
80
|
+
- `ZocketMcpHttp`
|
|
81
|
+
|
|
82
|
+
## 5) NPM package usage
|
|
83
|
+
|
|
84
|
+
This repo now includes an npm wrapper package.
|
|
85
|
+
|
|
86
|
+
Global install from npm:
|
|
87
|
+
```bash
|
|
88
|
+
npm i -g @zocket/cli
|
|
89
|
+
zocket setup
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Or install from your git repo (example):
|
|
93
|
+
```bash
|
|
94
|
+
npm i -g github:your-org/zocket
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
First-run setup:
|
|
98
|
+
```bash
|
|
99
|
+
zocket setup
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Then use normal CLI:
|
|
103
|
+
```bash
|
|
104
|
+
zocket init
|
|
105
|
+
zocket web --host 127.0.0.1 --port 18001
|
|
106
|
+
zocket mcp --transport sse --mode metadata --host 127.0.0.1 --port 18002
|
|
107
|
+
zocket mcp --transport streamable-http --mode metadata --host 127.0.0.1 --port 18003
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 6) Systemd hardening on Linux (production)
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
sudo env ZOCKET_HOME=/var/lib/zocket zocket harden install-linux-system \
|
|
114
|
+
--service-user zocketd \
|
|
115
|
+
--zocket-home /var/lib/zocket \
|
|
116
|
+
--web-port 18001 \
|
|
117
|
+
--mcp-host 127.0.0.1 \
|
|
118
|
+
--mcp-port 18002 \
|
|
119
|
+
--mcp-mode metadata
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Check:
|
|
123
|
+
```bash
|
|
124
|
+
systemctl status zocket-web.service --no-pager
|
|
125
|
+
systemctl status zocket-mcp-http.service --no-pager
|
|
126
|
+
systemctl status zocket-mcp-http-streamable.service --no-pager
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Optional: systemd unit for Codex (streamable HTTP on 18003)
|
|
130
|
+
|
|
131
|
+
Create `/etc/systemd/system/zocket-mcp-http-streamable.service`:
|
|
132
|
+
```ini
|
|
133
|
+
[Unit]
|
|
134
|
+
Description=Zocket MCP HTTP Streamable (system)
|
|
135
|
+
After=network-online.target
|
|
136
|
+
Wants=network-online.target
|
|
137
|
+
|
|
138
|
+
[Service]
|
|
139
|
+
Type=simple
|
|
140
|
+
User=zocketd
|
|
141
|
+
Group=zocketd
|
|
142
|
+
Environment=ZOCKET_HOME=/var/lib/zocket
|
|
143
|
+
ExecStart=/usr/bin/python3 -m zocket mcp --transport streamable-http --mode metadata --host 127.0.0.1 --port 18003
|
|
144
|
+
Restart=on-failure
|
|
145
|
+
RestartSec=2
|
|
146
|
+
NoNewPrivileges=true
|
|
147
|
+
PrivateTmp=true
|
|
148
|
+
ProtectSystem=strict
|
|
149
|
+
ProtectHome=read-only
|
|
150
|
+
ProtectKernelTunables=true
|
|
151
|
+
ProtectControlGroups=true
|
|
152
|
+
LockPersonality=true
|
|
153
|
+
MemoryDenyWriteExecute=true
|
|
154
|
+
ReadWritePaths=/var/lib/zocket
|
|
155
|
+
|
|
156
|
+
[Install]
|
|
157
|
+
WantedBy=multi-user.target
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Enable and start:
|
|
161
|
+
```bash
|
|
162
|
+
sudo systemctl daemon-reload
|
|
163
|
+
sudo systemctl enable --now zocket-mcp-http-streamable.service
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Linux user-level autostart (no root)
|
|
167
|
+
```bash
|
|
168
|
+
zocket autostart install --target web --web-port 18001
|
|
169
|
+
zocket autostart install --target mcp --mcp-port 18002 --mcp-mode metadata --mcp-host 127.0.0.1
|
|
170
|
+
zocket autostart status --target both
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### macOS launchd autostart (manual)
|
|
174
|
+
Create `~/Library/LaunchAgents/dev.zocket.web.plist`, `dev.zocket.mcp-sse.plist`,
|
|
175
|
+
and `dev.zocket.mcp-streamable.plist`:
|
|
176
|
+
|
|
177
|
+
```xml
|
|
178
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
179
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
180
|
+
<plist version="1.0">
|
|
181
|
+
<dict>
|
|
182
|
+
<key>Label</key><string>dev.zocket.web</string>
|
|
183
|
+
<key>ProgramArguments</key>
|
|
184
|
+
<array>
|
|
185
|
+
<string>/Users/YOUR_USER/.local/share/zocket/venv/bin/python3</string>
|
|
186
|
+
<string>-m</string><string>zocket</string>
|
|
187
|
+
<string>web</string><string>--host</string><string>127.0.0.1</string>
|
|
188
|
+
<string>--port</string><string>18001</string>
|
|
189
|
+
</array>
|
|
190
|
+
<key>EnvironmentVariables</key>
|
|
191
|
+
<dict>
|
|
192
|
+
<key>ZOCKET_HOME</key><string>/Users/YOUR_USER/.zocket</string>
|
|
193
|
+
</dict>
|
|
194
|
+
<key>RunAtLoad</key><true/>
|
|
195
|
+
<key>KeepAlive</key><true/>
|
|
196
|
+
</dict>
|
|
197
|
+
</plist>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
SSE MCP (`dev.zocket.mcp-sse.plist`):
|
|
201
|
+
```xml
|
|
202
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
203
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
204
|
+
<plist version="1.0">
|
|
205
|
+
<dict>
|
|
206
|
+
<key>Label</key><string>dev.zocket.mcp-sse</string>
|
|
207
|
+
<key>ProgramArguments</key>
|
|
208
|
+
<array>
|
|
209
|
+
<string>/Users/YOUR_USER/.local/share/zocket/venv/bin/python3</string>
|
|
210
|
+
<string>-m</string><string>zocket</string>
|
|
211
|
+
<string>mcp</string><string>--transport</string><string>sse</string>
|
|
212
|
+
<string>--mode</string><string>metadata</string>
|
|
213
|
+
<string>--host</string><string>127.0.0.1</string>
|
|
214
|
+
<string>--port</string><string>18002</string>
|
|
215
|
+
</array>
|
|
216
|
+
<key>EnvironmentVariables</key>
|
|
217
|
+
<dict>
|
|
218
|
+
<key>ZOCKET_HOME</key><string>/Users/YOUR_USER/.zocket</string>
|
|
219
|
+
</dict>
|
|
220
|
+
<key>RunAtLoad</key><true/>
|
|
221
|
+
<key>KeepAlive</key><true/>
|
|
222
|
+
</dict>
|
|
223
|
+
</plist>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Streamable HTTP MCP (`dev.zocket.mcp-streamable.plist`):
|
|
227
|
+
```xml
|
|
228
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
229
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
230
|
+
<plist version="1.0">
|
|
231
|
+
<dict>
|
|
232
|
+
<key>Label</key><string>dev.zocket.mcp-streamable</string>
|
|
233
|
+
<key>ProgramArguments</key>
|
|
234
|
+
<array>
|
|
235
|
+
<string>/Users/YOUR_USER/.local/share/zocket/venv/bin/python3</string>
|
|
236
|
+
<string>-m</string><string>zocket</string>
|
|
237
|
+
<string>mcp</string><string>--transport</string><string>streamable-http</string>
|
|
238
|
+
<string>--mode</string><string>metadata</string>
|
|
239
|
+
<string>--host</string><string>127.0.0.1</string>
|
|
240
|
+
<string>--port</string><string>18003</string>
|
|
241
|
+
</array>
|
|
242
|
+
<key>EnvironmentVariables</key>
|
|
243
|
+
<dict>
|
|
244
|
+
<key>ZOCKET_HOME</key><string>/Users/YOUR_USER/.zocket</string>
|
|
245
|
+
</dict>
|
|
246
|
+
<key>RunAtLoad</key><true/>
|
|
247
|
+
<key>KeepAlive</key><true/>
|
|
248
|
+
</dict>
|
|
249
|
+
</plist>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Load services:
|
|
253
|
+
```bash
|
|
254
|
+
launchctl load ~/Library/LaunchAgents/dev.zocket.web.plist
|
|
255
|
+
launchctl load ~/Library/LaunchAgents/dev.zocket.mcp-sse.plist
|
|
256
|
+
launchctl load ~/Library/LaunchAgents/dev.zocket.mcp-streamable.plist
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Windows autostart (Task Scheduler)
|
|
260
|
+
Installer can create tasks with:
|
|
261
|
+
```powershell
|
|
262
|
+
powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1 -EnableAutostart
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Or create manually:
|
|
266
|
+
- task `ZocketWeb` on logon
|
|
267
|
+
- task `ZocketMcpSse` on logon
|
|
268
|
+
- task `ZocketMcpStreamable` on logon
|
|
269
|
+
- actions:
|
|
270
|
+
- `python -m zocket web --host 127.0.0.1 --port 18001`
|
|
271
|
+
- `python -m zocket mcp --transport sse --mode metadata --host 127.0.0.1 --port 18002`
|
|
272
|
+
- `python -m zocket mcp --transport streamable-http --mode metadata --host 127.0.0.1 --port 18003`
|
|
273
|
+
|
|
274
|
+
## 7) First web open
|
|
275
|
+
|
|
276
|
+
Open `http://127.0.0.1:18001` and choose one:
|
|
277
|
+
- set your own password
|
|
278
|
+
- generate strong password
|
|
279
|
+
- continue without password (explicit warning + confirmation)
|
|
280
|
+
|
|
281
|
+
## 8) Health checks
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
curl -I http://127.0.0.1:18001/login
|
|
285
|
+
curl -I http://127.0.0.1:18002/sse
|
|
286
|
+
curl -I http://127.0.0.1:18003/mcp
|
|
287
|
+
zocket mcp --transport stdio --mode metadata
|
|
288
|
+
```
|