local-os-brain

local-os-brain

Enables safe local system command execution, file operations, hardware diagnostics, and persistent cross-session memory storage via SQLite.

Category
Visit Server

README

Local OS Assistant & Second Brain (MCP & OpenAI)

An autonomous, cross-platform local desktop assistant powered by the Model Context Protocol (MCP) and OpenAI (gpt-4o). It executes local system commands safely, reads and writes files, monitors hardware diagnostics, and remembers cross-session project context using a local SQLite database (brain.db).


Features

  • MCP FastMCP Server (server.py):
    • read_local_file: Reads text contents of local files safely.
    • write_local_file: Writes content to local files, creating missing directories automatically.
    • list_directory: Formatted directory inspection with size and file type details.
    • execute_terminal_command: Runs shell commands with safety prompt guardrails for destructive keywords (rm, del, rmdir, format, drop).
    • open_application_or_url: Launches desktop applications or opens URLs in default web browser cross-platform (Windows, macOS, Linux).
    • get_system_metrics: Retrieves real-time CPU, RAM, Disk, and Battery diagnostics using psutil.
    • save_memory: Persists user notes, project stack context, and preferences into SQLite brain.db.
    • search_memory: Full-text/pattern searching across stored memories.
  • Interactive Terminal Assistant (client.py):
    • Dynamic tool discovery via MCP stdio transport.
    • Startup memory hydration from brain.db.
    • Persistent CLI REPL prompt (You > / Brain > ).
  • Claude Desktop Ready (claude_desktop_config.json):
    • Ready-to-use configuration file for integration with Claude Desktop.

Installation & Setup

Prerequisites

  • Python 3.10 or higher.
  • An OpenAI API Key (OPENAI_API_KEY).

1. Set Up Virtual Environment

Navigate to the project root directory and create a virtual environment:

# Windows
python -m venv venv
venv\Scripts\activate

# macOS / Linux
python3 -m venv venv
source venv/bin/activate

2. Install Dependencies

Install pinned dependencies from requirements.txt:

pip install -r requirements.txt

3. Environment Configuration

Create a .env file in the project root directory or set the environment variable:

OPENAI_API_KEY=your_openai_api_key_here

Running the Assistant

Option A: Interactive CLI Client

Start the interactive assistant terminal:

python client.py

Example session:

You > Save a memory under key 'favorite_editor' value 'VS Code with Vim binding' tags ['preference', 'tools']
Brain > I've stored your preference for VS Code with Vim binding in the brain database.

You > What are my current system metrics?
Brain > Your system is running at 15.4% CPU usage with 12.2 GB / 32 GB RAM used and 78% battery remaining.

Option B: Integrate with Claude Desktop

To use this local MCP server with Claude Desktop, add the configuration from claude_desktop_config.json to your Claude Desktop configuration file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Add the server definition:

{
  "mcpServers": {
    "local-os-brain": {
      "command": "python",
      "args": [
        "C:/Users/acer/.gemini/antigravity-ide/scratch/mcp_local_brain/server.py"
      ]
    }
  }
}

Note: Replace "python" with the absolute path to your virtual environment Python executable if using a venv.


Project Structure

mcp_local_brain/
├── brain.db                      # SQLite database auto-generated on first run
├── server.py                    # FastMCP Server with OS & Brain Tools
├── client.py                    # Interactive Terminal AI Assistant
├── claude_desktop_config.json   # Claude Desktop configuration snippet
├── requirements.txt             # Pinned python dependencies
└── README.md                    # Documentation & Setup Guide

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured