membrian-mcp
v2.5.4
Published
MCP server for Membrian — project memory, knowledge base, and infrastructure ops for AI agents
Maintainers
Readme
Membrian MCP Server
MCP server for the Membrian AI OS — project memory, knowledge base, infrastructure operations.
Ships 37 tools that AI agents actually use. CRUD operations for clients, sites, scans, findings, and compliance are available via the Membrian web UI instead.
Quick Start (npx)
No clone or install needed — run directly via npx:
{
"mcpServers": {
"membrian": {
"command": "npx",
"args": ["-y", "membrian-mcp@latest"],
"env": {
"MEMBRIAN_API_URL": "https://membrian.ai",
"MEMBRIAN_API_KEY": "<your-api-key>",
"PORT_WEB": "0"
}
}
}
}Add this to ~/.cursor/mcp.json (Cursor) or the MCP config for your client. That's it — npx downloads and runs the server automatically.
PORT_WEB: "0"disables the local web UI. Cursor spawns a separate MCP process per workspace; without this, only the first instance binds the port and the rest crash. The hosted UI is athttps://membrian.ai.
Setup (from source)
git clone <repo-url> ~/Kloner-Membrian-Mcp
cd ~/Kloner-Membrian-Mcp
npm install
npm run build # compile TypeScript to dist/After install, the console suggests optional next steps: install the Cursor rule and run verify. Cursor cannot attach rules automatically when you add an MCP server (by design); the rule ships in this repo and can be installed globally or copied per project.
Cursor rule + skill (strongly recommended)
The MCP tools only work well if the agent knows when to call them. This repo ships a compact rule and a detailed skill — together they give agents the right guidance at the right time without wasting context tokens.
Layering:
| Layer | What it is | Loaded |
|-------|------------|--------|
| Cursor rule (membrian-ai-os.mdc) | Compact always-on checklist: auto-context on task start, write-back on task end, basic principles. ~25 lines. | Every chat |
| MCP instructions | Tool routing guidance; sent when the MCP connects (see src/mcp-metadata.ts). | Every chat (via MCP) |
| Cursor skill (~/.cursor/skills/membrian/SKILL.md) | Detailed workflows: project import, knowledge extraction criteria, feedback reasons, snapshot types, quality bar. ~140 lines. | On demand |
The rule handles the 90% case. The skill is loaded automatically by the agent when it needs the full decision framework (importing a project, extracting knowledge, detailed feedback, etc.).
| Install | Command / action |
|---------|------------------|
| All rules — from Membrian repo (recommended) | pnpm install-cursor-rules in the Kloner-Membrian checkout — installs all 6 shared rules to ~/.cursor/rules/ |
| Rule only — from this MCP repo | npm run install-cursor-rule — copies membrian-ai-os.mdc to ~/.cursor/rules/ |
| Rule — single app repo | Copy .cursor/rules/membrian-ai-os.mdc into that repo (same path) |
| Skill — all workspaces | Copy the membrian/ folder to ~/.cursor/skills/membrian/ |
Canonical source: The Membrian repo (Kloner-Membrian/.cursor/rules/) is the source of truth for all shared rules. This MCP repo ships a copy of membrian-ai-os.mdc for convenience. When updating rules, edit in the Membrian repo first, then sync here.
Restart Cursor or start a new chat after installing. The bundled rule uses alwaysApply: true.
Cursor rules vs this MCP (FAQ)
| Question | Answer |
|----------|--------|
| Are Cursor rules part of the MCP server? | No. Rules are files under .cursor/rules/ (per repo) or ~/.cursor/rules/ (global). The MCP is a separate node …/dist/index.js process Cursor spawns. This repo ships both so you can version them together, but Cursor loads rules from disk, not from MCP. |
| Can this repo control rules in all my projects? | Not automatically, but close. The Membrian repo ships all shared rules at .cursor/rules/ and a one-command installer: pnpm install-cursor-rules copies them to ~/.cursor/rules/ (global — applies in every workspace). Team members pull updates and re-run the command. See docs/TEAM-SETUP.md in Kloner-Membrian for the full workflow. |
Optional: company knowledge in Membrian
Repo README + Cursor rule + MCP instructions are the source of truth for this connector. Add a Membrian knowledge item (e.g. short STANDARD or PLAYBOOK) only if you want the same guidance to appear for other projects via search_knowledge without opening this repo — e.g. “Membrian MCP: pass taskDescription for context-pack intent; hybrid search uses RRF scores.” Avoid duplicating a long doc; link to internal git/docs if needed.
Verify API + credentials
Checks the same URL and API key the MCP server uses (read-only health call):
export MEMBRIAN_API_URL=https://membrian.ai # optional if default
export MEMBRIAN_API_KEY=your-key-here
npm run verify- Success: prints
OKand the health JSON. - Failure: wrong key, API down, or wrong URL — fix
mcp.json/ env to match.
In CI without API credentials, skip the check with SKIP_MEMBRIAN_VERIFY=1 npm run verify. To skip the postinstall banner, use npm install --ignore-scripts (you must run npm run build yourself).
End-to-end in Cursor: after MCP is configured, ask the agent to call the get_system_health tool (or another membrian tool). If that works, the bridge from Cursor → MCP → Membrian API is good.
Cursor MCP Config
Option A: npx (recommended — no local clone needed)
{
"mcpServers": {
"membrian": {
"command": "npx",
"args": ["-y", "membrian-mcp@latest"],
"env": {
"MEMBRIAN_API_URL": "https://membrian.ai",
"MEMBRIAN_API_KEY": "<your-api-key>",
"PORT_WEB": "0"
}
}
}
}Option B: from source (for development / local changes)
{
"mcpServers": {
"membrian": {
"command": "node",
"args": ["<path-to-repo>/dist/index.js"],
"env": {
"MEMBRIAN_API_URL": "https://membrian.ai",
"MEMBRIAN_API_KEY": "<your-api-key>",
"PORT_WEB": "0"
}
}
}
}Legacy env vars KLONER_OS_API_URL and KLONER_OS_API_KEY are still supported as fallbacks.
MCP metadata (for Cursor and other hosts)
After initialize, compliant clients receive extra server metadata (Model Context Protocol):
| Field | Purpose |
|-------|---------|
| serverInfo.title | Human-friendly label (e.g. "Membrian — project & company memory"). |
| serverInfo.description | Outcome-focused summary: what the bridge does, when to use it, env vars, pointer to the Cursor rule. Defined in src/mcp-metadata.ts. |
| instructions | Markdown guide for agents: when to use context vs search vs snapshots vs knowledge vs infra tools; non-blocking errors; pointer to membrian://docs/usage. Source: src/mcp-metadata.ts. |
| Resource membrian://docs/usage | Same guide as markdown; use resources/read if the host exposes resources. Listed as usage_guide. |
Edit src/mcp-metadata.ts to change what models see at connection time.
Tools (37) + usage resource
Knowledge & Search (3)
search_knowledge— hybrid (default, RRF fusion scores), keyword, or semantic search; output emphasizes rank/relevance, not raw score magnitudecreate_knowledge_item— create a pattern, playbook, standard, etc.update_knowledge_item— update, archive, supersede, or adjust confidence of existing items
Projects & Memory (7)
get_project_context— full context pack;taskDescriptiondrives API intent detection (debugging/feature/deployment/refactoring/general) and knowledge mix;maxTokenstrims soft context to fit a token budget; response text includes Detected task intent when presentlist_projects— list all registered projectscreate_project— register a new projectupdate_project— rename, change slug, update stack tags, or assign to a clientdraft_decision— record a project decisionget_project_decisions— view decision logupdate_project_snapshot— create/update brief, architecture, runbook, etc.
Import (2)
import_project— bulk import project + snapshots + decisionsextract_patterns— bulk-create knowledge items from a project
Analytics & Maintenance (5)
record_knowledge_feedback— ACCEPTED/REJECTED/FLAGGED feedback with reason + comment (drives nightly tier recompute)report_context_issue— report problems with a project's context pack (too long, stale, irrelevant, missing)get_system_health— overall health reportlist_stale_knowledge— find potentially outdated itemsrun_staleness_check— run staleness detection
Knowledge Graph (5)
graph_add_triple— add a temporal fact (subject → predicate → object) with optional validity dates and confidencegraph_invalidate_triple— mark a fact as no longer valid (retained for history)graph_query— query entity relations with optional temporalasOffilteringgraph_timeline— chronological timeline of facts, optionally filtered by entitygraph_stats— entity count, triple count, and predicate distribution
Cross-Project Tunnels (2)
discover_tunnels— find shared stack tags across projects and overlapping knowledgeget_project_tunnels— sibling projects, shared knowledge, and decisions for a specific project
Deduplication & History (2)
check_knowledge_duplicates— pre-flight duplicate check before creating a knowledge itemget_snapshot_history— version history for a project snapshot type
Agent Diary (2)
write_diary— append a diary entry for session continuity (what happened, what remains)read_diary— retrieve past entries to resume where a previous session left off
Infrastructure (9)
list_servers— list/filter serverscreate_server— register a new server for SSH operationsupdate_server— change name, hostname, port, environment, notes, or clientdelete_server— remove a server and its associated dataget_server_connection— look up a server and get a ready-to-usessh …command prefix (the default path for interactive SSH)log_ssh_operation— record an SSH operation executed locally (command, exit code, stdout/stderr) for audit trailssh_exec— execute ad-hoc SSH command via Membrian backend (rare — for unattended ops only)run_operation— logged multi-step SSH operation via backendget_operation_status— check operation progress
Homepage
The MCP server starts a lightweight HTTP homepage at http://localhost:4216 showing live stats, features, and a contact form. Override the port with the PORT_WEB env var (default 4216; set to 0 to disable). The web server logs to stderr (stdout is reserved for MCP stdio transport).
Development
npm run dev # run from source via tsx
npm run build # compile TypeScript to dist/
npm start # run compiled dist/index.js
npm run type-check # type-check without emittingPublishing / Releasing
Users install via npx -y membrian-mcp which pulls from npm (not git). Pushing to GitLab alone does not ship changes to users.
# 1. Bump version (patch/minor/major)
npm version patch # commits + tags automatically
# 2. Publish to npm
npm publish # runs `prepublishOnly` (build) first
# 3. Push commit + tag to git
git push && git push --tagsPre-flight checklist:
npm whoami— must be logged in (npm loginif not)npm run buildsucceeds with no errors- Version in
package.jsonis higher thannpm view membrian-mcp version
npx caching note: npx -y membrian-mcp may serve a cached version. Users can force a fresh pull with npx -y membrian-mcp@latest, or clear the npx cache (rm -rf ~/.npm/_npx). The -y flag skips the install prompt but does not guarantee the latest version is fetched.
After Pulling Changes
After pulling source changes, rebuild:
npm run build