Skip to main content
Glama
Powerbrain MCP Server

Powerbrain MCP Server

Official
by nuetzliches

🧠 Powerbrain

CI License: Apache 2.0 Docker Compose MCP

Open source. Closed data. šŸ”

"AI eats context. We decide what's on the menu."

Open-source context engine that feeds AI agents with policy-compliant enterprise knowledge — self-hosted, GDPR-native, provider-agnostic.


The Problem

Every AI agent needs context. But feeding enterprise data to LLMs means losing control — over who sees what, how long it's retained, and whether it complies with GDPR. Most solutions either block AI entirely or hand everything over. Neither works.

Related MCP server: MetaGraph-MCP

The Solution

Powerbrain sits between your data and your AI agents. It delivers context through the Model Context Protocol (MCP), with every request checked by a policy engine. Your data stays on your infrastructure. Your policies decide what gets through.

Agent / Skill
    │ MCP
    ā–¼
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  Powerbrain MCP Server                          │
│  ā”œā”€ OPA Policy Check (every request)            │
│  ā”œā”€ Circuit Breaker + Approval Queue (Art. 14)  │
│  ā”œā”€ Qdrant Vector Search (oversampled)          │
│  ā”œā”€ Cross-Encoder Reranking (top-k)             │
│  ā”œā”€ Context Summarization (policy-controlled)   │
│  ā”œā”€ Sealed Vault (PII pseudonymization)         │
│  └─ Tamper-Evident Audit Log (Art. 12)          │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
    │           │           │           │
    ā–¼           ā–¼           ā–¼           ā–¼
 Qdrant    PostgreSQL     OPA       Ollama/vLLM/TEI
 (vectors)  (data+vault)  (policies) (embeddings+LLM)
                │
                ā–¼
         ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
         │  pb-worker   │  Accuracy metrics, drift
         │ (APScheduler)│  detection, audit retention
         ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

✨ Core Features

šŸ”’ Policy-Aware Context Delivery — Every search request is checked against OPA policies. Classification levels (public, internal, confidential, restricted) control what each agent role can access. Compliance is executable code, not documentation.

šŸ›”ļø Sealed Vault & Pseudonymization — PII is detected at ingestion (Microsoft Presidio), pseudonymized with per-project salts, and stored in a dual-layer vault. Originals require HMAC-signed, time-limited tokens with purpose binding. Art. 17 deletion: remove the vault mapping and pseudonyms become irreversible.

šŸŽÆ Relevance Pipeline — 3-stage search: Qdrant oversampling (5x candidates) → OPA policy filtering → Cross-Encoder reranking. Graceful degradation: if the reranker is down, results fall back to vector ordering.

šŸ“ Context Summarization — Agents can request summaries instead of raw chunks. OPA policies can enforce summarization for sensitive data (confidential = summary only, no raw text), control detail levels, or deny summarization entirely. Powered by any OpenAI-compatible LLM (Ollama, vLLM, or external).

šŸ”Œ MCP-Native Interface — 23 tools accessible through the Model Context Protocol. Works with any MCP-compatible agent (Claude, OpenCode, custom). One endpoint, one protocol.

šŸ  Self-Hosted & GDPR-Native — Everything runs on your infrastructure. No external API calls for embeddings, search, or summarization. Docker Compose up and you're running.

šŸ”€ AI Provider Proxy — Optional gateway between your AI consumers and their LLM providers. Transparently injects Powerbrain tools into every LLM request and executes tool calls automatically. Pseudonymises the chat content on the wire (PII scan via the ingestion pipeline) before it reaches the LLM. Your teams use any LLM they prefer (100+ providers via LiteLLM); Powerbrain ensures they always query policy-checked enterprise context. Without the proxy, direct chat from subscription clients (Claude Desktop / Claude Code Pro/Max) bypasses the chat-path PII scan — see the edition boundary. Activate with docker compose --profile proxy up.

āš–ļø EU AI Act Compliance Toolkit

Powerbrain is not itself a high-risk AI system, but Deployers who operate one in regulated sectors (finance, healthcare, HR) need infrastructure that delivers the Art. 9–15 capabilities. Powerbrain ships them as executable building blocks, not PDFs:

Article

Feature

How

Art. 9 — Risk management

Concrete risk register + live indicators

docs/risk-management.md with 8 identified risks (R-01..R-08). GET /health with Accept: application/json returns 6 live risk indicators and HTTP 503 when critical.

Art. 10 — Data quality

Blocking ingestion quality gate

Composite score (length, language confidence, PII density, encoding, metadata) with per-source_type thresholds via OPA pb.ingestion.quality_gate. Rejected documents are audited in ingestion_rejections.

Art. 11 / Annex IV — Technical docs

Admin-triggered Annex IV generator

generate_compliance_doc MCP tool renders all 9 Annex IV sections as Markdown from live runtime state (models, OPA policies, collections, audit chain, risk register).

Art. 12 — Logging

Tamper-evident audit hash chain

SHA-256 hash chain on agent_access_log via PostgreSQL trigger with advisory locks, append-only enforcement, checkpoint+prune retention that preserves chain continuity. Verify via verify_audit_integrity, export via export_audit_log.

Art. 13 — Transparency

Auth-required transparency endpoint

GET /transparency and get_system_info MCP tool expose active models, OPA policies, collection stats, PII scanner config, and audit integrity — with deterministic version fingerprint.

Art. 14 — Human oversight

Global kill-switch + approval queue

POST /circuit-breaker halts all data-retrieval tools instantly. Confidential/restricted requests from non-admin roles are intercepted into pending_reviews; admins decide via review_pending, agents poll via get_review_status.

Art. 15 — Accuracy & drift

Windowed feedback metrics + embedding drift detection

Per-collection baseline centroids in embedding_reference_set, refreshed every 5 minutes by pb-worker. Prometheus gauges + alerts (QualityDrift, HighEmptyResultRate, RerankerScoreDrift, EmbeddingDriftDetected), pre-provisioned pb-accuracy Grafana dashboard.

The pb-worker maintenance container runs four APScheduler jobs: accuracy metrics refresh (5 min), pending-review timeouts (hourly), GDPR retention cleanup (daily 02:00), audit retention cleanup (daily 03:00).

🧩 Editions

Powerbrain ships as two tiers, both Apache-2.0, both self-hosted. Community is the MCP context engine (search, vault, OPA, audit). Enterprise adds pb-proxy — an OpenAI-compatible chat gateway that orchestrates tool-call loops, pseudonymises the wire, and resolves vault pseudonyms for chat responses per OPA policy. Full capability matrix and migration notes in docs/editions.md.

Edition detection is on every service's /health and /transparency endpoint: "edition": "community" on mcp-server:8080, "edition": "enterprise" on pb-proxy:8090.

šŸŽ¬ Run a Sales Demo in 5 Minutes

Need to show a decision-maker what Powerbrain does? Spin up the full demo stack (role-aware search, live PII vault, knowledge-graph explorer) with a single command:

./scripts/quickstart.sh --demo

The script seeds 21 base documents, 6 customer records with German PII, and an 8-person org-chart graph. When healthchecks finish, open http://localhost:8095 — a five-tab Streamlit app with inline presenter notes: role-contrast search, live PII vault, knowledge graph, a MCP vs Proxy side-by-side that shows the community/enterprise contrast, and a Pipeline Inspector that dry-runs any document through the ingestion pipeline. The full 15-minute narrative lives in docs/playbook-sales-demo.md.

šŸš€ Quick Start

git clone https://github.com/nuetzliches/powerbrain.git && cd powerbrain

# Automated setup (recommended):
./scripts/quickstart.sh            # base stack, no seed
./scripts/quickstart.sh --seed     # + 21 sample documents
./scripts/quickstart.sh --demo     # + PII vault fixtures + graph + demo UI on :8095

# Or manually:
cp .env.example .env        # PG_PASSWORD comes from secrets/pg_password.txt (auto-generated)
docker compose --profile local-llm --profile local-reranker up -d
docker exec pb-ollama ollama pull nomic-embed-text
for col in pb_general pb_code pb_rules; do
  curl -s -X PUT "http://localhost:6333/collections/$col" \
    -H 'Content-Type: application/json' \
    -d '{"vectors":{"size":768,"distance":"Cosine"}}' && echo " → $col āœ“"
done

Verify everything is running:

curl -s http://localhost:8080/health   # MCP Server
curl -s http://localhost:6333/healthz  # Qdrant
curl -s http://localhost:8181/health   # OPA

Connect your agent (a default dev key is pre-seeded for local use):

{
  "mcpServers": {
    "powerbrain": {
      "type": "http",
      "url": "http://localhost:8080/mcp",
      "headers": {
        "Authorization": "Bearer pb_dev_localonly_do_not_use_in_production"
      }
    }
  }
}

That's it. Your agent now has access to search_knowledge, query_data, graph_query, generate_compliance_doc, and 19 more tools — see MCP Tool Reference. For production keys, see the Getting Started guide.

Optional: AI Provider Proxy

# 1. Uncomment/add your LLM provider in pb-proxy/litellm_config.yaml
# 2. Set API keys in .env (e.g. OPENAI_API_KEY=sk-...)
docker compose --profile proxy up -d

# List available models:
curl http://localhost:8090/v1/models

# Use the proxy — Powerbrain tools are injected automatically:
curl http://localhost:8090/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"What are our GDPR deletion policies?"}]}'

šŸ” How It Works

1. Agent calls search_knowledge("GDPR deletion policy", summarize=true)
2. Powerbrain embeds the query (nomic-embed-text via configurable provider)
3. Qdrant returns 50 candidates (10 Ɨ 5 oversampling)
4. OPA filters by agent role + data classification → 30 remain
5. Cross-Encoder reranks by query-document relevance → top 10
6. OPA summarization policy: allowed? required? detail level?
7. LLM summarizes the chunks (if applicable)
8. Response: results + summary + policy transparency

🧭 Principles

  1. Sovereignty by design — Data sovereignty is not a feature, it's the architecture. No external API calls. No cloud dependencies. Your data, your rules.

  2. Enable, don't restrict — The goal is not to prevent AI adoption, but to make it safely usable. Powerbrain says "yes, but with guardrails" instead of "no."

  3. Policy as code — Compliance rules are OPA/Rego policies, version-controlled and testable. Not Word documents. Not checkbox audits.

šŸ“š Documentation

Document

Description

Getting Started

Step-by-step tutorial: ingest data, search, understand policies

Editions (Community vs Enterprise)

Capability matrix, edition boundary, which tier governs which data path

Compliance with Claude Desktop / Code subscriptions

Honest answer on Pro/Max bypass, three-tier mitigation, DPA vs AI Act

MCP Tool Reference

All 23 MCP tools with parameters and access roles

What is Powerbrain?

Detailed overview and positioning

Architecture

Technical deep-dive

Deployment Guide

Dev, production, TLS, Docker Secrets

GitHub Adapter

Sync GitHub repositories into the knowledge base

Office 365 Adapter

Sync SharePoint, OneDrive, Outlook, Teams, OneNote

Technology Decisions

ADRs and trade-offs

Risk Register

EU AI Act Art. 9 risk register (R-01..R-08)

Dependency Audit

How dependencies are audited, and advisories accepted with a review date

EU AI Act Plan

Implementation plan for B-40..B-46

CLAUDE.md

Agent-facing reference (tools, schemas, conventions)

šŸ¤ Contributing

Powerbrain is open source (Apache 2.0). Contributions welcome — whether it's a new OPA policy, a better reranker model, or documentation improvements.

Open source. Closed data. šŸ”

šŸ“„ License

Apache License 2.0. Dependencies under their respective licenses.

AI Usage

Parts of this codebase were developed with the assistance of AI coding tools (e.g. Claude, GitHub Copilot).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      Provides a unified context layer for AI agents, enabling ranked search, file management, context bundles, database queries, and connected source access through MCP, all scoped to organizational permissions with citations.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables enterprise AI agents to query governed data lineage, PII-aware schema documentation, and semantic metadata from SQL logs via MCP, with role-based access and vector search.
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Enables AI agents to discover and query enterprise knowledge documents and business metrics through standardized MCP tools, supporting retrieval, structured sales/order analysis, anomaly scanning, and data lineage lookups.
      12
      -