JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 44
  • Score
    100M100P100Q75818F
  • License MIT

Verifiable Memory-as-a-Service for AI Agents — MCP server with local SQLite or cloud mode

Package Exports

  • @brain-protocol/mcp
  • @brain-protocol/mcp/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@brain-protocol/mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@brain-protocol/mcp

Verifiable Memory-as-a-Service for AI Agents. An MCP server that gives any AI agent persistent knowledge with full-text search, a knowledge graph, and optional on-chain verification via Starknet.

Dual-mode: SQLite local (zero config) or cloud (HTTP to your Brain Protocol API).

Quick Start

npx @brain-protocol/mcp

That's it. The server starts in local mode with a SQLite database at the XDG-compliant default path.

Installation

npm install -g @brain-protocol/mcp
# or
pnpm add -g @brain-protocol/mcp

Configuration

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "brain": {
      "command": "npx",
      "args": ["@brain-protocol/mcp"]
    }
  }
}

Claude Code

Add to ~/.claude.json:

{
  "mcpServers": {
    "brain": {
      "command": "npx",
      "args": ["@brain-protocol/mcp"]
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "brain": {
      "command": "npx",
      "args": ["@brain-protocol/mcp"]
    }
  }
}

Cloud Mode

To connect to a Brain Protocol API instead of local SQLite:

{
  "mcpServers": {
    "brain": {
      "command": "npx",
      "args": ["@brain-protocol/mcp"],
      "env": {
        "BRAIN_API_URL": "https://brain.api.vauban.tech",
        "BRAIN_API_KEY": "your-api-key"
      }
    }
  }
}

Environment Variables

Variable Default Description
BRAIN_API_URL (unset = local mode) Cloud API URL. When set, uses HTTP instead of SQLite
BRAIN_API_KEY (unset) Bearer token for cloud API authentication
BRAIN_DB_PATH XDG default Custom path for the SQLite database file

Default Database Paths

Platform Path
Linux ~/.local/share/brain-protocol/brain.db
macOS ~/Library/Application Support/brain-protocol/brain.db
Windows %APPDATA%/brain-protocol/brain.db

Override with XDG_DATA_HOME (Linux) or BRAIN_DB_PATH (any platform).

Tools Reference

query_knowledge

Search the knowledge base using full-text search with filters.

Parameter Type Description
q string Search query
category string Filter by category
author string Filter by author
tags string Filter by tags (comma-separated)
limit number Max results (default 10, max 100)
offset number Pagination offset

archive_knowledge

Store a new knowledge entry.

Parameter Type Required Description
content string Yes Knowledge content
content_type string No markdown, code, decision, pattern, documentation, git_commit, json, structured_data
author string No Author name (default: user)
category string No Category (default: documentation)
tags string[] No Tags array
confidence number No Confidence 0-1 (default: 0.8)

create_edge

Create a relationship between two knowledge entries.

Parameter Type Required Description
source_id string Yes Source entry UUID
target_id string Yes Target entry UUID
edge_type string Yes derives_from, conflicts_with, validates, extends, implements, supersedes, tested_by, documented_by, optimizes, related_to
confidence number No Edge confidence 0-1

get_graph

Traverse the knowledge graph from an entry.

Parameter Type Required Description
entry_id string Yes Starting entry UUID
depth number No Max depth (default 3, max 5)

get_stats

Get knowledge base statistics. No parameters.

prove (cloud only)

Anchor a knowledge entry on Starknet for verifiable proof.

Parameter Type Required Description
entry_id string Yes Entry UUID to anchor

verify (cloud only)

Verify a knowledge entry's on-chain proof.

Parameter Type Required Description
entry_id string Yes Entry UUID to verify

export

Export all knowledge entries and edges.

Parameter Type Description
format string Export format (json)

Architecture

@brain-protocol/mcp
├── index.ts          # Entry point: env detection, store init
├── server.ts         # MCP Server factory
├── store/
│   ├── adapter.ts    # StoreAdapter interface
│   ├── sqlite.ts     # SQLiteStore (better-sqlite3 + FTS5)
│   ├── cloud.ts      # CloudStore (HTTP client)
│   └── paths.ts      # XDG-compliant path resolution
└── tools/            # 8 MCP tool handlers

3 production dependencies: @modelcontextprotocol/sdk, better-sqlite3, zod.

Local Mode Features

  • SQLite with WAL mode for concurrent reads
  • FTS5 full-text search with ranking
  • Knowledge graph with recursive CTE traversal
  • Cycle detection in graph traversal
  • Automatic schema creation on first run

Cloud Mode Features

  • All local features via HTTP API
  • prove: Anchor knowledge hashes on Starknet (Poseidon hash + L2)
  • verify: Verify on-chain proofs
  • Bearer token authentication

License

MIT