local-os-brain
ローカルOSアシスタント&セカンドブレイン(MCP & OpenAI)
Model Context Protocol (MCP) と OpenAI(gpt-4o) を搭載した、自律型・クロスプラットフォーム対応のローカルデスクトップアシスタントです。ローカルシステムコマンドを安全に実行し、ファイルの読み書きを行い、ハードウェア診断を監視し、ローカルのSQLiteデータベース(brain.db)を使用してセッションをまたいだプロジェクトコンテキストを記憶します。
機能
MCP FastMCPサーバー(
server.py):read_local_file: ローカルファイルのテキスト内容を安全に読み取ります。write_local_file: ローカルファイルにコンテンツを書き込み、不足しているディレクトリを自動的に作成します。list_directory: サイズとファイルタイプの詳細を含む、フォーマット済みのディレクトリ情報を表示します。execute_terminal_command: 破壊的なキーワード(rm、del、rmdir、format、drop)に対する安全プロンプトのガードレール付きでシェルコマンドを実行します。open_application_or_url: デスクトップアプリケーションを起動するか、デフォルトのWebブラウザでURLを開きます(Windows、macOS、Linuxに対応)。get_system_metrics:psutilを使用して、CPU、RAM、ディスク、バッテリーのリアルタイム診断情報を取得します。save_memory: ユーザーノート、プロジェクトスタックコンテキスト、設定をSQLiteのbrain.dbに永続化します。search_memory: 保存されたメモリ全体を全文検索・パターン検索します。
対話型ターミナルアシスタント(
client.py):MCP stdioトランスポートによる動的なツール検出。
brain.dbからの起動時メモリハイドレーション。永続的なCLI REPLプロンプト(
You >/Brain >)。
Claude Desktop対応(
claude_desktop_config.json):Claude Desktopとの統合にすぐ使える設定ファイル。
Related MCP server: notion-local-ops-mcp
インストールとセットアップ
前提条件
Python 3.10以上。
OpenAI APIキー(
OPENAI_API_KEY)。
1. 仮想環境のセットアップ
プロジェクトのルートディレクトリに移動し、仮想環境を作成します:
# Windows
python -m venv venv
venv\Scripts\activate
# macOS / Linux
python3 -m venv venv
source venv/bin/activate2. 依存関係のインストール
requirements.txt から固定された依存関係をインストールします:
pip install -r requirements.txt3. 環境設定
プロジェクトのルートディレクトリに .env ファイルを作成するか、環境変数を設定します:
OPENAI_API_KEY=your_openai_api_key_hereアシスタントの実行
オプションA: 対話型CLIクライアント
対話型アシスタントターミナルを起動します:
python client.pyセッション例:
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.オプションB: Claude Desktopとの統合
このローカルMCPサーバーを Claude Desktop で使用するには、claude_desktop_config.json の設定をClaude Desktopの設定ファイルに追加します:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
サーバー定義を追加します:
{
"mcpServers": {
"local-os-brain": {
"command": "python",
"args": [
"C:/Users/acer/.gemini/antigravity-ide/scratch/mcp_local_brain/server.py"
]
}
}
}注: venvを使用する場合は、"python" を仮想環境のPython実行ファイルの絶対パスに置き換えてください。
プロジェクト構造
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ライセンス
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Connect AI assistants to explicitly paired computers, servers, and VMs for permitted remote actions.
Securely control computers you explicitly pair through files, terminals, processes, screenshots, desktop UI/input, clipboard, browser automation, diagnostics, and document tools.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to safely perform actions on your computer including file system management, command execution, clipboard access, application launching, and local search with license-based monetization built in.-
- AlicenseNot gradedqualityCmaintenanceEnables Notion AI to interact with local files, execute shell commands, and delegate complex tasks to local AI agents. Provides file operations, command execution, and task delegation capabilities for local workspace management.111MIT
- AlicenseAqualityDmaintenanceExposes local file I/O, a restricted shell whitelist, and SQLite helpers for safe integration with AI clients like Cursor and Claude Desktop.7MIT
- AlicenseNot gradedqualityBmaintenanceEnables compatible AI clients to operate a local computer by accessing files, applications, processes, shells, and, on Windows/macOS, graphical desktop controls such as windows, screens, mouse, and keyboard. It runs locally with user permissions and confirmation previews for operations that change the machine.3MIT