본문으로 건너뛰기

Host Bridge

Overview​

Host Bridge is the plugin's embedded HTTP server that enables external AI tools (Codex, Claude Code, OpenCode, etc.) to access your Zotero library directly. It is the communication bridge between ACP Agents and Zotero, and serves as the underlying transport for both the zotero-bridge CLI and the MCP Server.

Architecture​

Zotero Plugin Process
│
├── Host Bridge HTTP Server (loopback: 127.0.0.1:<port>)
│ ├── Bearer Token auth (every request)
│ ├── Write Approval Gate (per-operation)
│ └── Capability Router (30+ capabilities)
│
└── zotero-bridge CLI (companion binary)
├── Semantic commands (context, library, mutation, synthesis)
├── Config files (bridge-profile.json)
└── Stdin/pipe mode (for ACP agent integration)

Protocol version: host-bridge.v1. All endpoints except GET /bridge/v1/health require Bearer Token authentication.

Configuration​

Zotero → Settings → Zotero Agents → Host Bridge

SettingTypeDefaultDescription
Enable MCP ServerbooleantrueAlso enable the MCP protocol for third-party agents
Disable Write ApprovalbooleanfalseDangerous: bypass all write approval. Marked as a red danger zone
Enable LAN AccessbooleanfalseBind to 0.0.0.0 for LAN access (forces fixed port)
Fixed PortbooleanfalsePin port (default 26570) instead of using a random port
Port Numbernumber26570Port used in fixed mode (1024-65535)
LAN IPstring""Manual override for advertised LAN IP; leave empty for auto-detect
Start / Show Endpointbutton—Ensure server is running and display current endpoint URL
Rotate Tokenbutton—Rotate the session token
Create / Rotate Master Tokenbutton—Generate a persistent cross-session token
Copy Master Tokenbutton—Copy token to clipboard
Copy Remote CLI Profilebutton—Copy the full remote CLI profile JSON
Install CLIbutton—One-click install of zotero-bridge to system PATH

Security Model​

Bearer Token Authentication​

  • Every request must include Authorization: Bearer <token> header
  • Session Token: auto-generated at plugin startup (24 bytes base64), lives for the plugin session
  • Master Token: optional persistent token, AES-256-GCM encrypted storage, for cross-session CLI access
  • Tokens are never written to prompts, logs, or agent output

Write Approval​

Write operations require Zotero UI approval:

LevelDescription
Approval requiredmutation.execute, workflow submit, debug.zotero.eval, citation_graph.refresh_metrics
Auto-approvedAll read-only operations, diagnostic.get_status, mutation.preview

Double-gate auto-approval:

  1. Workflow manifest declares allowWriteApprovalBypass: true
  2. User explicitly checks auto-approve in the submit dialog

Both must be satisfied for auto-approval to take effect.

LAN / Remote Security​

  • LAN mode binds 0.0.0.0 and must be manually enabled. Use only on trusted networks
  • Remote access requires a Master Token (manually created), never auto-distributed
  • LAN IP auto-detection uses SkillRunner backend network reflection; can be manually overridden

The zotero-bridge CLI​

zotero-bridge is a Rust CLI tool for ACP agents and terminal users to call Host Bridge.

Installation​

Use the "Install CLI" button in preferences. ACP runs use the plugin-bundled binary (injected into the workspace PATH).

Endpoint / Token Resolution Priority​

SourceEndpointToken
CLI flag--endpoint—
EnvironmentZOTERO_BRIDGE_ENDPOINTZOTERO_BRIDGE_TOKEN
Profile fileendpoint fieldauth.token / auth.tokenEnv

Semantic Commands​

zotero-bridge status # Health check (no auth)
zotero-bridge manifest # Full capability manifest
zotero-bridge call <capability> [--input] # Raw capability call
zotero-bridge item search --query <text>
zotero-bridge item get --key <key>
zotero-bridge item notes --key <key>
zotero-bridge item attachments --key <key>
zotero-bridge note get --key <key>
zotero-bridge note payloads --key <key>
zotero-bridge note payload --key <key>
zotero-bridge library list --input '{"limit":50}'
zotero-bridge library snapshot --input '{"limit":200,"cursor":"0"}'
zotero-bridge topics list
zotero-bridge topics get-context --input <JSON>
zotero-bridge topics get-report --input <JSON>
zotero-bridge schemas get
zotero-bridge concepts query --input <JSON>
zotero-bridge citation-graph query-cluster --input <JSON>
zotero-bridge citation-graph get-overview
zotero-bridge library-index get
zotero-bridge resolvers resolve --input <JSON>
zotero-bridge reference-index get
zotero-bridge paper-artifacts get-manifest --input <JSON>
zotero-bridge paper-artifacts read --input <JSON>
zotero-bridge insights get-attention-queue
zotero-bridge literature ingest --input <JSON>
zotero-bridge workflow list
zotero-bridge workflow describe --workflow <id>
zotero-bridge workflow submit --workflow <id> (--input <JSON> | --none)
zotero-bridge workflow agent-run --workflow <id> (--input <JSON> | --none) --output-dir <DIR>
zotero-bridge workflow run <runId>
zotero-bridge task list [--workflow <id>] [--active-only]
zotero-bridge file download <fileId> --output <path>

Input accepts: inline JSON, JSON file path, @file syntax, - (stdin).

Output Contract​

stdout always emits exactly one JSON object:

{ "ok": true, "data": {...}, "meta": { "cli": "zotero-bridge", "schema": "zotero-bridge.cli.v1" } }
{ "ok": false, "error": {...}, "meta": { "cli": "zotero-bridge", "schema": "zotero-bridge.cli.v1" } }

Error exit codes:

CategoryExit Code
usage2
config3
connection4
auth5
permission6
validation7
capability8
workflow9
download10
protocol11
internal70

Profile Files​

Well-known profile locations:

OSPath
Windows%LOCALAPPDATA%\zotero-agents\bridge-profile.json
macOS~/Library/Application Support/zotero-agents/bridge-profile.json
Linux${XDG_DATA_HOME:-~/.local/share}/zotero-agents/bridge-profile.json
{
"schema": "zotero-bridge.profile.v1",
"protocol": "host-bridge.v1",
"endpoint": "http://127.0.0.1:26570/bridge/v1",
"connectionMode": "local",
"auth": { "type": "bearer", "tokenEnv": "ZOTERO_BRIDGE_TOKEN" }
}

ACP Agent Integration​

When an ACP agent runs a skill, the plugin automatically injects:

<workspaceDir>/.zotero-bridge/
bin/zotero-bridge(.cmd) # CLI shim
profile.json # Connection profile (token via env var)
README.md # Usage hints

Injected environment variables:

  • ZOTERO_BRIDGE_PROFILE — path to profile.json
  • ZOTERO_BRIDGE_TOKEN — bearer token
  • ZOTERO_BRIDGE_SCOPE — approval scope JSON
  • PATH / Path — prepended with .zotero-bridge/bin

Available Capabilities​

All 30+ capabilities

Context​

CapabilityDescription
context.get_current_viewCurrent Zotero view info
context.get_selected_itemsCurrently selected items

Library​

CapabilityDescription
library.search_itemsSearch items
library.get_item_detailGet item details
library.list_itemsPaginated item listing
library.sync_snapshotPaginated metadata snapshot for local indexing
library.get_item_notesList notes
library.get_note_detailRead note content
library.list_note_payloadsList note payloads
library.get_note_payloadGet a specific payload
library.get_item_attachmentsList attachments

Mutation​

CapabilityDescription
mutation.previewPreview a write operation (no execute)
mutation.executeExecute a write operation (requires approval)

Synthesis​

CapabilityDescription
topics.listList all topics
topics.get_contextGet topic context
topics.get_reportGet topic report
topics.get_review_inputAssemble topic review package
schemas.getGet schema definitions
concepts.queryQuery concept knowledge base
citation_graph.query_clusterQuery citation cluster
citation_graph.get_overviewGet graph overview
citation_graph.get_sliceExtract subgraph slice
citation_graph.get_metricsCompute graph metrics
citation_graph.rank_external_referencesRank external references
citation_graph.rank_library_papersRank library papers
paper_artifacts.get_manifestGet artifact manifest
paper_artifacts.readRead artifact content
paper_artifacts.export_filteredExport filtered artifacts
paper_artifacts.resolve_topic_digestResolve topic digest
insights.get_attention_queueGet attention queue
resolvers.resolveResolve reference/topic resolvers
reference_index.getGet reference index
library_index.getGet library index

Diagnostic​

CapabilityDescription
diagnostic.get_statusGet service status

Write Approval Flow​

Agent calls write capability
│
├── 1. Request arrives at Host Bridge (with Bearer Token)
├── 2. Token validated
├── 3. Scope extracted
├── 4. Approval check:
│ ├── Read-only scope → execute immediately
│ ├── autoApproveWrites = true AND user pre-approved → execute
│ └── Approval needed → queue to Zotero UI
├── 5. Approval prompt shown in ACP Chat / SkillRunner panel
│ ├── User approves → execute
│ └── User denies → return error
└── 6. Result returned, audit log written

Scope routing:

ScopeApproval UI
acp-skill-runACP Skills UI
acp-chatACP Chat panel
skillrunner-runSkillRunner panel
No scope / globalGlobal Zotero approval UI

LAN / Remote Access​

  1. Check Enable LAN Access in preferences
  2. Pin a port or note the current port
  3. Create / copy a Master Token
  4. Click Copy Remote CLI Profile for the full connection config
  5. On the remote machine, configure endpoint (http://<LAN_IP>:<port>/bridge/v1) and token
  6. Test: zotero-bridge status --endpoint http://<LAN_IP>:<port>/bridge/v1

Important: LAN mode bypasses loopback protection. Use only on trusted local networks.

Next Steps​

  • MCP Server — standardized protocol interface for MCP-compatible clients (Claude Desktop, etc.)
  • Hermes Profiles — ready-to-install profile for managing your Zotero library with AI agents
  • Preferences — view all Host Bridge settings
  • ACP Backend — learn about ACP Agent configuration