MCP Center
The per-user capability broker that lets enrolled AI harnesses discover and call enzUI app functions through four MCP tools, with per-call consent.
The enzUI MCP Center is a per-user Linux service that sits between AI harnesses and enzUI applications. Apps register typed, schema-described functions with it; harnesses discover and invoke those functions through a small MCP interface. Every invocation is authorized for one enrolled harness installation, one app and one function, and unknown combinations fail closed.
It ships as two binaries in the enzui-mcp-center package:
| Binary | Role |
|---|---|
enzui-center | The broker daemon (enzui-center run) and its management CLI |
enzui-mcp | An MCP stdio adapter, launched by a harness with one enrolled credential |
MCP host (harness)
-> launches enzui-mcp --credential harness.json over stdio
-> authenticated Unix IPC
enzui-center (per-user daemon)
-> policy, audit, routing
-> authenticated Unix IPC
enzUI applicationenzui-mcp is a transport adapter, not a second policy service. The daemon never uses MCP clientInfo, process names or tool annotations for authorization.
The four MCP tools
The adapter always advertises exactly four tools, regardless of how many apps or functions are registered. This keeps the tool list small and cache-stable instead of loading every app's API into each session.
| Tool | Purpose |
|---|---|
enzui_apps | Find apps. Accepts query, cursor and limit (1–100). |
enzui_functions | List one app's functions as concise summaries without schemas. Takes app_id, plus query, cursor, limit. |
enzui_function | Inspect one function: full input/output JSON Schema, risk class and consent options. Takes app_id, function_id. |
enzui_call | Invoke one function. Takes app_id, function_id, arguments (a JSON object), optional idempotency_key (1–128 bytes) and timeout_ms (1–120000, default 30000). |
The server instructions tell the model to discover progressively (enzui_apps → enzui_functions → enzui_function → enzui_call), to treat app metadata and outputs as untrusted data, and that cancellation or timeout does not prove side effects did not happen.
Failures are returned as MCP tool errors carrying a JSON object with a code, such as invalid_input or broker_unavailable.
Enrolling a harness
Each harness installation needs its own credential. Store it outside any directory the model can browse:
enzui-center enroll agent --id my-harness --name "My harness" \
--output /private/path/harness.credential.json
enzui-mcp --credential /private/path/harness.credential.jsonenzui-mcp also reads the credential path from ENZUI_AGENT_CREDENTIAL and accepts --socket (or ENZUI_CENTER_SOCKET) to override the broker socket. Configure your MCP host to launch it as a stdio server.
Policy is keyed on the credential ID, never on the claimed agent or model name, so two installations of the same harness are separate identities. Revoke one with:
enzui-center revoke-credential my-harnessRevocation clears its ephemeral grants and cancels its live calls. The enzimOS assistant harness connects the same way; see Assistants and local AI.
Permissions and risk levels
The authorization tuple is (agent credential, app ID, function ID). An unapproved call fails and creates a pending request, which the desktop shows in a consent window. The same decisions are available from the CLI:
enzui-center permissions pending
enzui-center permissions decide REQUEST_ID once
enzui-center permissions list
enzui-center permissions revoke AGENT_ID APP_ID FUNCTION_ID| Decision | Effect |
|---|---|
once | One grant, consumed by the next retry in the same session whose arguments match the request (bound by arguments_sha256, the SHA-256 of the arguments with sorted keys). |
session | Allows the function for this adapter process session. For destructive functions it is bound to the approved arguments like once. |
always | Persistent allow rule. |
deny | Rejects this request without creating a rule. |
never | Persistent deny rule. |
Pending requests and once/session grants live only in memory: they disappear on broker restart or app disconnect, and pending requests expire after ten minutes. A changed function contract invalidates persistent allows but keeps denies.
Each function declares a risk class, shown to the user by the consent UI:
risk | Meaning |
|---|---|
read_only | Reads information |
sensitive_read | Reads private information |
mutating | Makes changes |
destructive | Can delete or overwrite data |
external_side_effect | Acts outside this computer |
Functions with external_side_effect are rejected by default unless they declare the ui.user_review capability, meaning the app prepares a draft and presents its own window for the user to confirm. The owner can inspect or change this policy:
enzui-center interaction-policy
enzui-center interaction-policy --require-user-review trueRegistering app functions
An app registers metadata plus function descriptors:
{
"app": {"id": "org.enzui.Example", "name": "Example", "description": "…", "version": "1.0.0"},
"functions": [{
"id": "notes.list",
"title": "List notes",
"description": "…",
"input_schema": {"type": "object"},
"output_schema": {"type": "object"},
"risk": "read_only",
"allowed_consent": ["once", "session", "always"],
"required_capabilities": [],
"supports_cancellation": false,
"supports_progress": false,
"max_result_bytes": 65536
}]
}The broker compiles schemas at registration and validates both arguments and results on every call. Limits:
- 256 functions per app; 128 KiB per schema; object-root schemas only.
- IDs use ASCII letters, digits,
.,_and-, up to 128 bytes. - Results default to 64 KiB and are capped at 512 KiB.
- Supported
$refprofile: acyclic local JSON Pointers; no external, dynamic or recursive references, and no nested$id. - At most 64 apps and 48 concurrent invocations; the adapter allows 32 concurrent calls.
App credentials are enrolled separately, and an app credential ID must equal its app ID:
enzui-center enroll app --id org.enzui.Mail --name Mail --output /private/path/mail.credential.jsonenzUI apps normally use the framework's opt-in enzui-agent center connector rather than speaking the protocol directly; see Framework integration.
Installed apps and background activation
Apps do not have to be running to be discoverable. A package can install:
/usr/share/enzui/agent-apps/APP_ID.json: schema 1 manifest holding the exact registration and anactivation_unit./usr/lib/systemd/user/enzui-agent-APP_ID.service: the user unit named inactivation_unit, which must be exactly this name.
The broker reads these manifests from trusted directories (overridable with --app-manifest-dir) and provisions a private per-user app credential. Listing apps starts nothing. On an authorized call it validates schema and policy first, starts the unit with systemctl --user start --no-block, waits for authenticated registration, re-checks authorization and only then dispatches; single-use consent is consumed at dispatch.
A background worker is started with --agent-background, must not open a display, and reads its credential from ENZUI_APP_CREDENTIAL and socket from ENZUI_CENTER_SOCKET. Units start on demand, never at login merely because an app is installed. Removing the package removes the manifest; the broker then disables that identity and cancels its work. enzui-center installed-apps lists installed capabilities without starting them.
IPC protocol
The daemon listens on $XDG_RUNTIME_DIR/enzui/center.sock (directory mode 0700, socket 0600). Both sides check SO_PEERCRED and accept only their own UID. Frames are a big-endian u32 byte length followed by one UTF-8 JSON value, 1 byte to 1 MiB. The current wire version is 2; there is no fallback to version 1.
Authentication is mutual HMAC-SHA256 challenge-response:
- The daemon sends
Challenge { version: 2, nonce }(32 random bytes as lowercase hex). - The peer sends
Authenticate { version: 2, role, credential_id, client_nonce, proof }. - The daemon verifies the proof and replies
{"status":"accepted","display_name":"…","proof":"…"}with its own broker-direction proof, or closes. - The client verifies the broker proof before sending anything else. Authentication must finish within five seconds.
HMAC-SHA256(
credential_secret,
"enzui-center-v2" || NUL || u32be(2) ||
LP(direction) || LP(nonce) || LP(client_nonce) || LP(role) ||
LP(credential_id) || u32be(peer_uid)
)LP(text) is a big-endian u32 length followed by the UTF-8 bytes; direction is client or broker; role is agent, app or control. Nonces are hashed as their hex text. The repository's protocol document includes golden vectors.
Credential files are version 1:
{"version":1,"kind":"app","id":"org.enzui.Example","display_name":"Example","secret":"64 lowercase hex characters"}They must be regular, user-owned, non-symlink files with no group or other access.
Connection roles:
agent: one request and one response per connection fromenzui-mcp. Each adapter process uses one random session UUID; it sendsend_sessionon normal shutdown, clearing that session's pending requests and grants.app: a long-lived connection whose first message is a registration matching the credential ID. The broker sendsInvokeandCancel; the app returns accepted, progress and exactly one terminal event (completed, failed or cancelled).control: one request per connection, authenticated with the control credential created byenzui-center init. Used for consent decisions, credentials, permissions, revocation and history. A consent UI should callwait_pendingwith the lastversionrather than poll.
Activity history
The broker keeps metadata-only history in SQLite: event ID, request UUID, timestamp, agent ID, app ID, function ID and an outcome (permission_required, permission_denied, invalid_arguments, dispatched, completed, app_error, cancelled, timeout, app_disconnected, result_too_large, invalid_app_result). Arguments, results, error text, schemas and secrets are never stored.
enzui-center credentials
enzui-center history list --limit 50 --app-id org.enzui.Mail
enzui-center history clear --allHistory is pruned to 30 days and 10,000 rows. Credentials, persistent rules and contract digests do not expire by age. Frontends such as Settings must use the authenticated control role; direct database access is not supported.
Deployment and trust boundary
The package's systemd user unit runs enzui-center --sandbox-filesystem run, which uses Landlock (ABI 3 or newer) to confine writes to the broker's private state and runtime directories and fails to start if confinement is unavailable. The unit sets UMask=0077, disables core dumps and only runs for login users.
Unix cannot isolate mutually hostile processes running as the same UID. Credential files become a real boundary only when harnesses and apps are sandboxed so they can read only their own credential. Network MCP transport is intentionally not provided.
Building
cargo build --release --locked -j2
cargo clippy --all-targets --all-features -- -D warnings
cargo test --release --all-targets --all-features --locked -j2examples/mock_mail_app.rs is a test app you can register against a local broker.