maha-mcp-bridge
OfficialThis server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
maha-mcp-bridge
Zero-trust local MCP bridge for the Maha Provenance Standard API. Your source data stays on your machine; only sanitized context ever reaches the API.
Install
npm install -g @mahastrategies/maha-mcp-bridgeRelated MCP server: privacy-first-search-mcp
Quick start
maha login # paste your mhaic_ credential (input hidden), verified live
maha status # token validity + remaining audit credits
maha logout # remove the stored credentialCredentials are verified against the live backend before being stored in a user-only file (0600), like the AWS and gcloud CLIs. Set MAHA_MPS_CREDENTIAL instead for CI and containers — it always takes precedence and nothing is written to disk.
MAHA_MPS_API_URL overrides the backend origin (https required, localhost exempt) for staging and local development.
The MCP bridge
maha serve # stdio MCP server; requires `maha login` firstmaha serve refuses to start without a valid credential — an unauthenticated host exposes no tools. Register it with any MCP client, e.g. Claude Code:
{ "mcpServers": { "maha": { "command": "maha", "args": ["serve"] } } }Tools
Tool | What it does |
| Tables and columns of a configured local database, redacted. |
| One read-only SQL statement; rows capped, cells truncated, results redacted locally. |
| Redacts a passage locally, then submits the sanitized text for an MPS claim-level audit. |
| Aggregate counts from the local hash-chained ledger. No payloads. |
Two-tier PII redaction
Before any row or schema reaches the agent it passes through two redaction tiers, and both are counted separately in the ledger:
Regex tier (always on, fast): emails, SSNs, payment cards, phones, access/bearer tokens, secret-named fields, plus any custom patterns.
Contextual tier (local ONNX model via
@huggingface/transformers): a Named Entity Recognition model (Xenova/bert-base-NER) catches free-text PII the regexes miss —PER(people),LOC(locations),ORG(organizations),MISC. It runs entirely on your machine on the nativeonnxruntime-nodebackend; the model downloads once to~/.cache/maha-mcp-bridge/and never phones home afterward.
The model loads lazily so it never blocks the MCP handshake, and if it can't load (offline, disk, etc.) the bridge degrades to regex-only rather than failing. Disable it with "pii": { "contextual": { "enabled": false } } or MAHA_MPS_DISABLE_NER=1. Redaction is best-effort, not a guarantee that every entity is caught.
The contextual (NER) tier works out of the box.
onnxruntime-nodeships prebuilt native binaries for macOS, Linux, and Windows (x64 and arm64) inside the npm package, so a plainnpm install -gruns the fullregex + NERpipeline with no extra flags. (Recent npm prints annpm warn allow-scriptsabout the package'spostinstall; on the supported platforms that script isn't needed — the binary is already bundled.)You never have to guess which tiers are live:
maha statusreports the active redaction tier —Redaction regex + NER,regex-only (NER unavailable), orregex-only (NER disabled)— andmaha serveprints the same on startup. If your platform has no prebuilt binary, NER is skipped and the bridge degrades to regex-only (safely, not fatally). Only then do you need to rebuild the backend from source:npm install -g --allow-scripts=onnxruntime-node @mahastrategies/maha-mcp-bridge
Read-only, enforced twice
A statement gate rejects anything that isn't a single SELECT/WITH/SHOW/EXPLAIN/DESCRIBE, and every query then runs inside a server-side READ ONLY transaction that is always rolled back — so a data-modifying CTE that slips past the gate still dies in the database engine.
Configuration
~/.config/maha-mcp-bridge/config.json:
{
"databases": [
{ "name": "appdb", "kind": "postgres", "urlEnv": "APPDB_URL" },
{ "name": "legacy", "kind": "mysql", "urlEnv": "LEGACY_DB_URL" }
],
"pii": { "customPatterns": [{ "name": "employee_id", "source": "EMP-\\d{6}" }] }
}Connection URLs come from environment variables (urlEnv); inline url values are rejected if they embed a password. Use a database role with read-only grants as a third layer.
Every tool invocation is recorded in a local, hash-chained SQLite ledger (0600) holding only hashes and redaction counts — never passage text, SQL, or rows.
Configuration (contextual model)
{
"pii": {
"contextual": { "enabled": true, "model": "Xenova/bert-base-NER", "minScore": 0.5 }
}
}Mount a book
Mount a purchased book as a local MCP server so your agent can navigate it by section instead of scrolling a wall of text:
maha book mount the-imagined-life # uses your MHAIC token (~/.maha/config.json or MHAIC_TOKEN)On first use it prompts for your mhaic_ token (input hidden), verifies it, and stores it 0600. Register the mounted book with any MCP client:
{ "mcpServers": { "maha-book-the-imagined-life": { "command": "maha", "args": ["book", "mount", "the-imagined-life"] } } }maha book mount prints this exact snippet on a successful mount. The book is fetched once (entitlement-checked) and served from memory — the tools are:
Tool | What it does |
| The book's outline: sections and per-section chunk counts. |
| One section's text, by heading (partial match allowed) or numeric index. |
| Ranked plain-text search across the book's chunks. |
The full text of each book is free to read on the web; this structured, agent-queryable form is the paid endpoint. If your token isn't entitled, maha book mount prints the purchase URL instead of starting.
Security notes
The contextual model runs locally; database rows are never sent anywhere for inference.
npm auditis clean (0 vulnerabilities). Inference uses the maintained@huggingface/transformerson the nativeonnxruntime-nodebackend — noonnxruntime-web/protobufjs.adm-zip(pulled byonnxruntime-nodeto unpack its native binary) is pinned to a patched^0.6.0via a package override.
Why open source
Security teams should be able to audit exactly what leaves the building. The bridge is MIT-licensed; the cloud control plane (billing, idempotent credit ledger, audit engine) is the paid service behind it.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP gateway: one connection for your AI apps, with tool policies, PII redaction and audit logs.
Zero-secret MCP gateway for AI agents: risk-scored, audited calls with human-in-the-loop approval.
AI agent security, MCP 2026 schema & graph audits, <250ms guardrails, and compliance dossiers
Read-only Remote MCP for externally grounded AI agent trust receipts.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables local tools to interact with a private-first knowledge graph, with full CRUD access to authorized data while remote AI providers only see approved plaintext through policy-scoped MCP surfaces.MIT
- AlicenseNot gradedqualityBmaintenanceEnables privacy-preserving document retrieval by exposing read-only search tools over MCP, allowing agents to query local vector and structured indexes without sending data to the cloud.2MIT
- FlicenseBqualityBmaintenanceEnables AI agents to query an air-gapped enterprise knowledge vault via seven MCP tools for deterministic and hybrid retrieval, entity graph traversal, context compression, archive inspection, onboarding scans, and node status.7-
- AlicenseNot gradedqualityBmaintenanceExposes scattered business REST APIs and read-only databases to AI clients through a single MCP endpoint with unified API-key authentication, service- and operation-level authorization, department-scoped filtering, masking, and audit logging. AI agents discover only the tools and data they are permitted to use, without needing to know endpoint addresses, SQL, or credentials.MIT