# SiloFree × AI agents — integration pack

Part of **Agent Compass** (by iggym), inside the SiloFree repo.

This pack lets AI agents use your SiloFree vault through **scoped, auditable, read-only
tools** — instead of pasting secrets into chats. One file does all of it:
[`mcp-server.mjs`](mcp-server.mjs) (zero dependencies, Node ≥ 22.5, built-in
`node:sqlite` + `node:crypto`).

## What it speaks

| Protocol | How | Who uses it |
|---|---|---|
| **MCP (stdio)** | `node mcp-server.mjs --vault …` | Claude Code / Claude Desktop, Cursor, Grok Bot, any MCP client |
| **MCP (HTTP)** | `--http 8377`, then `POST /mcp` | remote/tenant stacks (Microsoft Autopilot), multi-agent runners |
| **REST (OpenAPI)** | same server, [`openapi.yaml`](openapi.yaml) | Dots / OpenAI custom connectors, Perplexity connectors, Apple Shortcuts, curl |
| **A2A** | `--http 8377 --a2a`, card at `/.well-known/agent-card.json`, `POST /a2a` | A2A-capable stacks (experimental) |

## Security model (non-negotiable)

- **Read-only.** The server never writes to the vault.
- **The passphrase is never a tool.** Prompted muted at startup (`--passphrase-stdin` reads
  two lines: passphrase, then Secret Key if any). Env vars `SILOFREE_PASSPHRASE` /
  `SILOFREE_SECRET_KEY` work but are discouraged — prefer the prompt or stdin.
- **Scopes** (`--scope`, comma list; default `status,totp`):
  - `status` — counts/lock state. Always on, no secrets.
  - `totp` — one-time 2FA codes (self-expiring ~30 s).
  - `titles` — item titles/domains only.
  - `secrets` — passwords/API keys. **Off by default.** Cards never, in any scope.
- **Auto-lock** after `--lock-after 15` minutes of inactivity: keys wiped, stdio exits,
  HTTP returns `423`.
- **No writes, no logging, no telemetry.** The only output is tool results the agent asked for.

## Quick start (MCP, local agents)

```bash
# 1. Export your vault from SiloFree (Export vault → Encrypted vault .sqlite) → silofree-vault-YYYY-MM-DD.sqlite
# 2. Try it by hand:
node integrations/mcp-server.mjs --vault ~/silofree-vault.sqlite
#    → "initialize" via any MCP client, or test:  Claude Code:
claude mcp add silofree -- node /ABS/path/agent-compass/integrations/mcp-server.mjs --vault /ABS/path/vault.sqlite
```

**Claude Desktop** (`claude_desktop_config.json`):

```json
{ "mcpServers": { "silofree": {
    "command": "node",
    "args": ["/ABS/path/agent-compass/integrations/mcp-server.mjs", "--vault", "/path/vault.sqlite"] } } }
```

**Cursor** (`.cursor/mcp.json`) — same shape. **Grok Bot** accepts the same MCP JSON via its
connectors + MCP settings (mind its shared-computer caveat: keep the vault file on your
machine, not on the bot's computer).

## REST bridge (connectors / Shortcuts)

```bash
node integrations/mcp-server.mjs --vault vault.sqlite --http 8377 --token $(openssl rand -hex 16) [--a2a]
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8377/status
curl -H "Authorization: Bearer $TOKEN" "http://127.0.0.1:8377/totp?title=github"
```

- **Dots / OpenAI custom connectors**: upload `openapi.yaml`; run the bridge behind your own
  tunnel only if you accept that trust zone — or keep Dots on the manual path.
- **Apple Shortcuts**: "Get contents of URL" → `http://<mac-ip>:8377/totp?title=…` with
  `--host <mac-ip>` and the bearer header.
- **Microsoft Autopilot / tenant stacks**: point MCP HTTP at the bridge inside your network;
  wire scopes into your governance policy.

## Testing

```bash
printf 'passphrase\nSF-SECRET-KEY\n' | node integrations/mcp-server.mjs --vault test.sqlite --passphrase-stdin --scope status,totp,titles,secrets
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node integrations/mcp-server.mjs --vault test.sqlite --passphrase-stdin --scope status,totp,titles,secrets < test-rpc.txt
```

Full per-agent matrix and honest "no API" verdicts: **[the Integrations page](index.html)**.

## License

MIT, like the rest of SiloFree. Author: Iggy — [github.com/iggym](https://github.com/iggym) · [@iggym](https://x.com/iggym)
