mcp-brain

mcp-brain

A cognitive memory system for persistent knowledge graph storage across multiple Claude installations using Supabase, enabling shared memory and concurrent access.

Category
访问服务器

README

MCP Brain

A cognitive memory system implemented as an MCP server that stores data in Supabase. It provides persistent storage across different Claude installations for knowledge graphs with support for entities and relations.

Notice

This is very much a work in progress, so don't expect it to work flawlessly without some tweaking. I was using the MCP Memory Server but I wanted it to work on Claude installed on different computers at the same time. I hacked together a transfer process and decided that was stupid, so I moved it to Supabase. It works once you get it running, but the installation isn't as polished as it should be. I strongly recommend setting it up in VSC with Cline Dev or something similar first instead of trying to make it work in Claude Desktop first. I have been able to get Claude Desktop, VSC on 2 different laptops and on a VPS, all sharing the same Supabase db.

Features

  • Persistent storage using Supabase
  • Knowledge graph structure with entities and relations
  • Database-level locking for safe concurrent access
  • Cross-platform support (macOS, Linux, Windows)
  • Automatic table initialization
  • Debug logging support

Prerequisites

  • Node.js and npm
  • VSCode with Claude extension
  • One of the following:
    • A new Supabase account and project (for primary installation)
    • Supabase credentials from an existing installation (for secondary installations)

Installation Types

Choose the appropriate installation type:

  1. Primary Installation: Set up mcp-brain with a new Supabase project. This is for the first machine that will use the brain.

  2. Secondary Installation: Install mcp-brain on additional machines using the same Supabase database. This allows multiple machines to share the same knowledge graph.

Installation

The installation process involves building the project and configuring it with your Supabase credentials. You can do this either automatically using the provided script, or manually.

Primary Installation

For your first installation of mcp-brain:

  1. Create a new Supabase project at https://supabase.com
  2. Get your project URL and API key from Project Settings > API
  3. Follow either the automated or manual installation steps below
  4. Save your Supabase credentials for use in secondary installations

Secondary Installation

For installing mcp-brain on additional machines:

  1. Get the Supabase URL and API key from your primary installation
  2. Follow either the automated or manual installation steps below
  3. Use the same credentials to ensure all instances share the same knowledge graph

Option A: Automated Installation

  1. Clone and build the project:

    git clone https://github.com/gtrusler/mcp-brain.git
    cd mcp-brain
    npm install
    npm run build
    
  2. Run the configuration script:

    npm run configure
    

    You will be prompted to enter your Supabase URL and API key. The script will automatically:

    • Create or update the MCP settings file for your OS
    • Configure the correct paths to the built files
    • Preserve any existing MCP server configurations

Option B: Manual Installation

  1. Clone and build the project:

    git clone https://github.com/gtrusler/mcp-brain.git
    cd mcp-brain
    npm install
    npm run build
    
  2. Locate your MCP settings file:

    • macOS: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
    • Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
    • Windows: %APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
  3. Add or update the mcp-brain configuration in the settings file:

    {
      "mcpServers": {
        "mcp-brain": {
          "command": "node",
          "args": ["path/to/mcp-brain/dist/index.js"],
          "env": {
            "SUPABASE_URL": "your-project-url",
            "SUPABASE_KEY": "your-api-key",
            "DEBUG": "false"
          }
        }
      }
    }
    

    Replace:

    • path/to/mcp-brain with the absolute path to where you cloned and built the repository
    • your-project-url with your Supabase project URL
    • your-api-key with your Supabase API key

    Note: If the settings file already exists, make sure to preserve any existing MCP server configurations. Only add or update the mcp-brain section within the mcpServers object.

Your Supabase credentials can be found in your Supabase project settings under Project Settings > API.

Applying Changes

After installation or any configuration changes:

  1. If VSCode is open:

    • Close all Claude conversations
    • Run the "Developer: Reload Window" command (Cmd/Ctrl + Shift + P, then type "reload")
  2. If VSCode is closed:

    • Simply start VSCode and the new configuration will be loaded automatically

Verifying the Installation

After reloading VSCode, verify the setup by:

  1. Creating a new conversation with Claude
  2. Running a command like Can you use your brain? to test the connection
  3. The brain should respond with information about its capabilities

Usage

The brain provides three main tools through the MCP protocol:

  1. read_graph: Read the entire knowledge graph
  2. create_entities: Store new memories as entities
  3. create_relations: Create connections between memories

These tools can be used through Claude to store and recall information persistently.

Development

  • npm run build - Build the TypeScript project
  • npm run configure - Configure Supabase credentials
  • npm start - Start the MCP server directly (not typically needed)

Architecture

  • Uses TypeScript and @modelcontextprotocol/sdk
  • Stores data in Supabase tables:
    • entities: Nodes in the knowledge graph
    • relations: Edges connecting entities
    • locks: Database-level locking for concurrent access
  • Automatic table creation on first run
  • Platform-independent configuration

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选