Skip to content

Architecture

Cyproxy is one container between your AI clients and the tools that they use. All tool calls go through one function, Gateway.invoke. This function decides if a call runs.

Cyproxy architecture

Cyproxy needs no database, no queue and no cloud service. It sends no telemetry.

Components

Component Function
MCP endpoint (/mcp) AI clients connect here with an access token or OAuth.
Console The web interface for the owner.
Policy gate (Gateway.invoke) Applies all rules to each call.
Agent (optional) A chat in the console. Its tool calls go through the policy gate.
Data volume (/data) Files for keys, rules, the owner account, collections and the audit log.
Bundled servers The AbuseIPDB and GreyNoise MCP servers run in the container. They are confined: they cannot read /data or the memory of Cyproxy.

The path of one tool call

sequenceDiagram
    actor Owner
    participant Client as AI client
    participant Cy as Cyproxy
    participant Tool as Tool server
    Client->>Cy: Run this tool with these arguments
    Cy->>Cy: 1. Is the access token valid?
    Cy->>Cy: 2. Are integrations paused? Is the tool on?
    Cy->>Cy: 3. Data protection check of the arguments
    Cy->>Tool: 4. List your tools (at most every 5 minutes)
    Cy->>Cy: 5. Is the tool definition the approved definition?
    alt Read tool
        Cy->>Tool: Call
    else Write tool
        Cy->>Owner: 6. Approve this call?
        Owner-->>Cy: Approve once
        Cy->>Cy: 7. All checks again. Audit log entry.
        Cy->>Tool: Call
    end
    Tool-->>Cy: Answer
    Cy->>Cy: 8. Removes its own keys and secrets from the answer
    Cy->>Cy: 9. Audit log entry
    Cy-->>Client: Answer

Each check can stop the call. If Cyproxy cannot complete a check, the call does not run.

Check Source file The call is refused when
Access token webapp.py The token is revoked, expired or incorrect.
Pause gateway.py You paused all integrations.
Data protection data_filter.py The arguments contain data with the action Block.
Tool review governance.py The tool is new, changed or blocked.
Tool type tool_kinds.py The client used run_tool for a write tool.
Approval governance.py You did not approve these arguments for this AI client.
Audit log audit_chain.py The entry for a write tool cannot be written.
Limits usage.py The monthly limit or the limit for each minute is reached.

Trust boundaries

flowchart TB
    subgraph t1["Fully trusted"]
        H["The computer, Docker and the data volume"]
        OW["The owner"]
    end
    subgraph t2["Trusted in the limits that Cyproxy applies"]
        AG["AI clients and the Agent"]
        BI["Built-in integrations"]
    end
    subgraph t3["Not trusted"]
        RS["The answer of any tool"]
        NW["The network"]
    end
  • An AI client can be misled by the text that it reads. It can request anything. It gets only the tools that are on and approved, and each write tool call needs your approval.
  • An integration gets only its own key. Its tools are approved when Cyproxy sees them for the first time. After that, a new tool or a changed tool goes on hold.
  • An answer is data. Cyproxy never runs it. Cyproxy removes keys from it.

What goes around Cyproxy

Cyproxy controls only the calls that go through it. It cannot see or stop:

  • an MCP server that is connected directly to an AI client
  • the own tools of an AI client (its shell, browser and file access)
  • a server that changes what a tool does and keeps the same definition
  • instructions that are hidden in an answer
  • data from one tool that an AI client sends to a different approved read tool
  • a person who controls the computer, the data volume, your browser, or the Docker socket

Where Cyproxy runs

flowchart LR
    subgraph one["On your computer"]
        C1["AI client"] -->|"http://localhost:8787"| Y1["Cyproxy"]
        Y1 --- D1[("Data volume")]
    end
    subgraph two["On a server"]
        C2["AI clients"] -->|"https"| CA["Caddy or your proxy"]
        CA --> Y2["Cyproxy, no published port"]
        Y2 --- D2[("Data volume")]
    end

The container runs as a user without privileges. Its file system is read-only, except /data and temporary folders. It has no Linux capabilities and cannot get new privileges.

Cyproxy is one process with one data folder. It is not made to run as more than one copy.

Authentication of AI clients

Method Description
Access token A token that starts with cyp_. Cyproxy keeps only its hash.
OAuth 2.1 Cyproxy is the authorization server. The client registers, you approve it in the console, and Cyproxy issues tokens with PKCE. Refresh tokens rotate.

Cyproxy checks the token on each request. When you revoke a token or disconnect an app, it stops working at the next call.

Storage

Cyproxy keeps files in /data. It encrypts the stored keys, sign-in tokens and authenticator secrets (AES-256-GCM). The other files are plain. The encryption key comes from CYPROXY_ENCRYPTION_KEY, or Cyproxy makes one in the volume. See Data files for the list of files, for what is encrypted, and for the limits.

Source files

See Develop.