feat: print remote config on MCP service start

Make scripts/mcp_service.sh start create the token env file when missing, then start the user service and print the remote MCP URL, Authorization header, and client JSON.

Document the one-command startup flow and cover automatic token creation with tests.
This commit is contained in:
Codex
2026-07-05 11:44:24 +00:00
parent baa8c0beae
commit d543831b5e
4 changed files with 72 additions and 7 deletions
+13 -2
View File
@@ -364,11 +364,22 @@ Client configuration example:
For long-running access from another machine, use the managed user service:
```bash
bash scripts/mcp_service.sh new-token
bash scripts/mcp_service.sh start
```
`mcp_service.sh new-token` writes `.runtime/obsidian-wiki-mcp.env` with `0600` permissions and prints the remote URL, `Authorization` header, and client JSON. `mcp_service.sh start` writes `~/.config/systemd/user/obsidian-wiki-mcp.service` and starts it. The service defaults to `0.0.0.0:8765/mcp` because it is intended for remote clients, but it still requires the bearer token. Prefer SSH tunnel, Tailscale, WireGuard, or another trusted network boundary instead of directly exposing the port to the public internet.
`mcp_service.sh start` creates `.runtime/obsidian-wiki-mcp.env` with `0600` permissions if it does not exist, writes `~/.config/systemd/user/obsidian-wiki-mcp.service`, starts the service, and prints the remote URL, `Authorization` header, and client JSON to copy into another agent. The service defaults to `0.0.0.0:8765/mcp` because it is intended for remote clients, but it still requires the bearer token. Prefer SSH tunnel, Tailscale, WireGuard, or another trusted network boundary instead of directly exposing the port to the public internet.
Customize the first startup if needed:
```bash
bash scripts/mcp_service.sh start --host 0.0.0.0 --port 9876 --path /wiki-mcp
```
Rotate the token later with:
```bash
bash scripts/mcp_service.sh new-token
```
Useful service commands: