Company Brain MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Company Brain MCPWhat is our policy on using AI for code generation?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Company Brain MCP
A local AI assistant that answers questions across a company's internal knowledge using the Model Context Protocol (MCP).
Overview
Company Brain MCP provides controlled access to internal company documents through MCP tools, enabling AI agents to query policies, product documentation, meeting notes, and engineering documentation with proper access control, grounded citations, and persistent search indexes.
Related MCP server: mcp-business-bot
Architecture
User (Streamlit / Slack / CLI / Claude Desktop)
↓
LLM Agent (ReAct tool loop, conversation memory)
↓
MCP Client (stdio or HTTP)
↓
MCP Server
↓
┌─────────────────┬─────────────────┬─────────────────┐
│ Connectors │ Chunker │ Permissions │
│ (filesystem, │ (markdown- │ (server-side │
│ GitHub, │ aware) │ role) │
│ Slack export) │ │ │
└─────────────────┴─────────────────┴─────────────────┘
↓
Persistent ChromaDB index + BM25 + optional reranker
↓
Grounded answer + section-aware citationsFeatures
MCP Tools:
search_documents,read_document,list_policies,find_meeting_notes,list_categoriesReal MCP transport: stdio subprocess for local use; Streamable HTTP + API-key auth for deployment
Access Control: Server-side role permissions enforced by the server, not the client
Hybrid Search: Vector embeddings (Ollama
nomic-embed-text) + BM25 over chunksReranker: Pluggable cross-encoder or keyword reranker to improve retrieval precision
Chunking: Markdown-aware chunking that preserves document and section context
Citations: Section-aware sources from actual MCP tool results
Multi-turn Memory: Conversation history fed into the LLM context
Persistent Vector Store: ChromaDB with content-hash incremental sync
Connectors: Filesystem, GitHub, and Slack export connectors with a sync manager
Agentic ReAct Loop: LLM chooses which MCP tools to call and iterates
Evaluation: Citation precision/recall + LLM-as-judge correctness
Installation
cd company-brain-mcp
pip install -r requirements.txtOptional for neural reranking:
pip install sentence-transformersPrerequisites
Ollama must be running with both models pulled:
ollama pull llama3.2
ollama pull nomic-embed-textConfiguration
Key environment variables:
Variable | Default | Description |
|
| Server role: |
| — | If set, agent connects over HTTP instead of stdio |
| — | API key for HTTP transport |
| — | Cross-encoder model name (e.g. |
| — | JSON list of extra connector configs |
Usage
Web UI (Streamlit)
COMPANY_BRAIN_ROLE=admin streamlit run ui/app.py --server.port 8502Then open http://localhost:8502.
Terminal
COMPANY_BRAIN_ROLE=admin python -m agent.assistantMCP Server (stdio)
Useful for connecting from Claude Desktop, MCP Inspector, etc.:
COMPANY_BRAIN_ROLE=admin python server/mcp_server.py
# or, with the Inspector UI:
COMPANY_BRAIN_ROLE=admin npx @modelcontextprotocol/inspector python server/mcp_server.pyMCP Server (HTTP)
Run the server over Streamable HTTP with optional API-key auth:
COMPANY_BRAIN_ROLE=admin \
COMPANY_BRAIN_API_KEY=secret \
python server/http_server.pyConnect the agent over HTTP:
export COMPANY_BRAIN_MCP_URL=http://127.0.0.1:8000/mcp
export COMPANY_BRAIN_API_KEY=secret
python -m agent.assistantEvaluation
COMPANY_BRAIN_ROLE=admin python -m evals.evaluatorThis produces evals/results.json with citation precision/recall/F1 and LLM-as-judge correctness scores.
Connectors
The SyncManager (connectors/sync_manager.py) loads documents from configured connectors, hashes their content, and only re-indexes changed or new documents.
Filesystem (default)
Loads knowledge/ subdirectories (policies, product, engineering, meetings, internal).
GitHub
export COMPANY_BRAIN_CONNECTORS='[
{"name": "eng-wiki", "type": "github", "config": {"owner": "myorg", "repo": "wiki", "path": "docs", "category": "engineering"}}
]'
COMPANY_BRAIN_ROLE=admin python server/mcp_server.pyFor private repos, add a GitHub token to the connector config:
{"token": "ghp_..."}Slack Export
export COMPANY_BRAIN_CONNECTORS='[
{"name": "slack-export", "type": "slack", "config": {"export_path": "/path/to/slack_export.zip", "category": "meetings"}}
]'Permissions
The role is enforced on the server. Clients cannot pass a role argument to tools.
Role | Policies | Product | Engineering | Meetings | Internal |
Admin | ✓ | ✓ | ✓ | ✓ | ✓ |
Engineer | ✗ | ✓ | ✓ | ✓ | ✗ |
Product | ✓ | ✓ | ✗ | ✓ | ✗ |
HR | ✓ | ✗ | ✗ | ✓ | ✓ |
Guest | ✗ | ✓ | ✗ | ✗ | ✗ |
Project Structure
company-brain-mcp/
├── agent/
│ ├── assistant.py # ReAct agent + LLM loop
│ ├── conversation_history.py
│ ├── ollama_client.py
│ ├── prompt_templates.py
│ └── citation_formatter.py
├── server/
│ ├── mcp_server.py # stdio MCP server entrypoint
│ ├── http_server.py # HTTP MCP server entrypoint
│ ├── auth.py # API-key middleware
│ ├── tools.py # MCP tool implementations
│ ├── permissions.py # Role-based access control
│ ├── chunker.py # Markdown-aware chunking
│ ├── document_loader.py # Document model
│ ├── embeddings.py # ChromaDB + BM25 + reranker
│ ├── reranker.py # Pluggable reranker
│ └── config.py # Configuration
├── connectors/
│ ├── base.py
│ ├── filesystem.py
│ ├── github.py
│ ├── slack.py
│ └── sync_manager.py
├── knowledge/
│ ├── policies/
│ ├── product/
│ ├── engineering/
│ ├── meetings/
│ └── internal/
├── ui/
│ └── app.py # Streamlit interface
├── evals/
│ ├── evaluator.py
│ ├── metrics.py
│ └── questions.json
├── data/ # ChromaDB + sync state (created at runtime)
├── logs/
└── README.mdDevelopment
Adding Documents
Add markdown, text, or JSON files to knowledge/<category>/. The server indexes them automatically on startup, and only changed documents are re-embedded.
Adding Tools
Implement the tool logic in
server/tools.py.Register it in
server/mcp_server.pywith a@mcp.tool()-decorated wrapper.Describe it in
agent/prompt_templates.pyif the agent should use it.
Running Tests
# Run evaluation
COMPANY_BRAIN_ROLE=admin python -m evals.evaluator
# Run unit tests (when added)
python -m pytest tests/License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
The CustomGPT.ai MCP server is a fully managed, RAG-powered endpoint that connects large language models with private knowledge bases and external data sources. It provides tools for retrieval-augmented generation queries (send_message), data ingestion (upload_file), and source listing, enabling AI agents to query private documents like PDFs with high accuracy and real-time citations.
- docs2mcpOAuthcom.docs2mcp
Query your own PDFs and documents from any MCP client. Every answer cites the page it came from.
- LensHubOAuthai.lenshub
Team knowledge from 20 connectors, served to any MCP agent — classified, scored, access-controlled.
Hybrid human + AI expertise for faster, trusted answers and decisions via MCP Server.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enables AI assistants to perform semantic searches over local document collections using multi-context organization and automatic OCR. It supports various file formats including PDF, DOCX, and images, ensuring all data processing remains local and private.8MIT
- FlicenseNot gradedqualityCmaintenanceEnables querying company knowledge base using RAG, providing accurate answers from internal documents via MCP.-
- AlicenseNot gradedqualityCmaintenanceA secure MCP server that connects AI assistants to Google Workspace, enabling permission-aware retrieval-augmented generation for grounded answers.MIT
- AlicenseNot gradedqualityAmaintenanceProvides a self-hosted knowledge index with document-level permissions, enabling AI agents to retrieve exactly the documents they are authorized to see via MCP. Supports OAuth 2.1, custom embedding models, and runs inside your network.15 npmApache 2.0