Skip to main content

A policy-aware MCP server for an org-wide knowledge brain that lives in a git repo.

Project description

brein

brein

a brain that lives in your company.

brein is a local MCP server for a company memory that lives in git: markdown docs in your repo, readable and writable by AI agents. Works with Claude Code, Cursor, Codex, Hermes, and any stdio MCP client.

Website: https://brein.sh

Quickstart

npx brein init

Walks you through the brain repo, paths, eval, and MCP client config. Then restart your client and verify with brein doctor.

Requirements: Node, Python 3.11+, git, an MCP-capable client.

From source
git clone https://github.com/brein-sh/brein && cd brein
uv sync
brein setup
brein mcp claude

CLI

brein setup [section]   # all sections, or one of: repo paths vector eval mcp
brein doctor            # ok/warn/fail health checks
brein mcp <client>      # claude | cursor | codex | generic
brein config            # show resolved config
brain-eval --limit 20   # local retrieval evals against $BRAIN_REPO

Tools exposed over MCP

Tool Purpose
brain_search(query, mode="hybrid") Keyword / vector / hybrid retrieval with optional rerank.
brain_evidence(question) Ranked docs + snippets + excerpts + citations in one round-trip. The client agent writes the final answer.
brain_update(file_path, content, commit_message, mode) Write to an allowed path, validate, commit, push.
brain_audit() Repo cleanliness, doc/frontmatter counts, log + index health.
brain_retrieval_log(...) Telemetry; search auto-logs.

For plain reads / listings, agents use their normal file tools (Read, Glob, Grep) against the brain repo directly — the MCP only mediates what plain tools can't do: semantic search and policy-gated writes.

Write policy: paths under docs/, skills/, templates/, plus AGENTS.md / README.md / CONTRIBUTING.md at the root. Secrets are pattern-blocked.

Configuration

brein setup writes ~/.brein/config.json. Environment variables override the file and are documented in src/brain_mcp/config.py. The big ones:

  • BRAIN_REPO — path to your brain git repo (required)
  • BRAIN_RETRIEVAL_LOG — JSONL telemetry path
  • BRAIN_VECTOR_INDEX — vector index cache path
  • BRAIN_EMBEDDING_MODEL — fastembed model (default BAAI/bge-small-en-v1.5)

Project layout

src/brain_mcp/          MCP server + `brein` CLI
src/brain_mcp/_scripts/ bundled helpers (eval, index, validate)

Contributing

Issues and PRs welcome. See CONTRIBUTING.md.

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brein_mcp-0.5.17.tar.gz (5.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brein_mcp-0.5.17-py3-none-any.whl (79.4 kB view details)

Uploaded Python 3

File details

Details for the file brein_mcp-0.5.17.tar.gz.

File metadata

  • Download URL: brein_mcp-0.5.17.tar.gz
  • Upload date:
  • Size: 5.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for brein_mcp-0.5.17.tar.gz
Algorithm Hash digest
SHA256 d47a8b9d57678ba3bded739ebd62821239c3d97f0f12f77d97a6316fb55bbb5f
MD5 5eec6195717ba771279b3599d4e8d2de
BLAKE2b-256 c4863b94cd709d1f76bb6810cbab62026dfdd98d65a4f033df7c1f302b61cce6

See more details on using hashes here.

File details

Details for the file brein_mcp-0.5.17-py3-none-any.whl.

File metadata

  • Download URL: brein_mcp-0.5.17-py3-none-any.whl
  • Upload date:
  • Size: 79.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for brein_mcp-0.5.17-py3-none-any.whl
Algorithm Hash digest
SHA256 c47615a9e62c0c2f95448a69bf21ad5f11fa3d5084b3dc45c85d1f1c5170238e
MD5 d4ba592d18c4e64773e83505aec0063f
BLAKE2b-256 10c362302c863e89d3b1c44ac97241d8b59bc37d45a72c21443e34901f52b019

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page