@楽曲作りまくりおじさん 楽曲作りまくりおじさん authored 6 days ago
.github Add MCP server with llama.cpp integration and docs 8 days ago
.vscode chore: migrate to Tauri/Rust backend with SeaORM and add unit/integration tests 7 days ago
document refactor: modernize source code with improved structure and logging 8 days ago
scripts feat: integrate llama-server sidecar with Gemma 3 300M support 7 days ago
src feat: add datetime fields to MCP search results and include unit tests 6 days ago
src-tauri feat: add datetime fields to MCP search results and include unit tests 6 days ago
test feat: add local datetime support and automated updated_at trigger for items table 6 days ago
.gitignore build: update dependencies and gitignore for Sidecar integration 7 days ago
README.md feat: enhance logging with rotation and environment-aware output targets 6 days ago
analyze_nesting.js feat: add rust support to nesting/line scripts and fix app.exe startup dll path 7 days ago
bun.lock chore: migrate to Tauri/Rust backend with SeaORM and add unit/integration tests 7 days ago
count_lines.js feat: add rust support to nesting/line scripts and fix app.exe startup dll path 7 days ago
generate-icon.js Add MCP server with llama.cpp integration and docs 8 days ago
jsconfig.json Add MCP server with llama.cpp integration and docs 8 days ago
launch.cmd chore: migrate to Tauri/Rust backend with SeaORM and add unit/integration tests 7 days ago
mcp.json.sample Add MCP server with llama.cpp integration and docs 8 days ago
package-lock.json Add MCP server with llama.cpp integration and docs 8 days ago
package.json chore: migrate to Tauri/Rust backend with SeaORM and add unit/integration tests 7 days ago
README.md

SQLite Vector MCP Server (Tauri + Rust)

🦀 Tauri 2 + Rust + SeaORM を使用した、極めて軽量で高速な常駐型 MCP サーバー。
SQLite + sqlite-vec によるベクトル検索機能と、llama.cpp による LLM 連携を統合。

概要

このプロジェクトは、元々 Electron + Bun で構成されていた sqlitevector アプリケーションを、パフォーマンスとリソース効率を最大化するために Tauri + Rust へ完全に移植したものです。バックエンドには型安全な SeaORM を採用し、データベース操作の堅牢性を高めています。
さらに、Gemma 3 300M Embedding モデルのフルサポートと、llama-serverSidecar 統合 により、別途サーバーを立てることなくスタンドアロンで動作するようになりました。

特徴

  • 🎯 常駐型デザイン: システムトレイに格納され、最小限のメモリで MCP サーバーとして動作。
  • 🔍 ベクトル検索: sqlite-vec を Rust からネイティブ操作し、高速な近傍検索(MATCH 句)を実現。
  • 📅 日時型・自動更新対応: created_at / updated_at を日時型として管理し、SQLite トリガーにより自動的に時刻を更新。ローカルタイムを標準採用。
  • 📝 ロギング・ローテーション: tauri-plugin-log による詳細なログ出力と、ファイルサイズベース(10MB/ファイル)の自動ローテーションを実装。デバッグ時はプロジェクトルートの logs フォルダにも出力。
  • 🤖 内蔵 LLM サーバー (Sidecar): アプリ起動時に llama-server を自動起動。Gemma 3 300M モデルを標準サポート。
  • 🧠 高度な Embedding: Gemma 3 による高精度なベクトル変換をローカル環境で完結。
  • 🛠 SeaORM: 型安全なクエリビルダにより、複雑なデータベース操作を確実に実行。
  • 🚀 ワンバイナリ体験: DLL やバイナリ、モデルを含んだポータブルな配布が可能。

システムアーキテクチャ

graph TD
    subgraph "Frontend (Webview2)"
        UI[User Interface / React]
    end
    
    subgraph "Tauri Backend (Rust / v2)"
        CMD[Tauri Commands]
        MCP[MCP SSE Server: Axum]
        DB[(SQLite + SeaORM)]
        VEC[sqlite-vec Extension]
        LLM[Llama Client: reqwest]
        SC[Manage Sidecar Process]
    end
    
    subgraph "Sidecar"
        llama[llama-server.exe]
        Model[Gemma 3 300M GGUF]
    end
    
    UI <--> CMD
    MCP <--> DB
    DB <--> VEC
    DB <--> LLM
    LLM <--> llama
    SC -->|Spawn| llama
    llama -->|Load| Model

フォルダ構成

sqlitevector/
├── src/
│   └── frontend/       # UI 資産 (HTML/JS/CSS)
├── src-tauri/
│   ├── bin/            # Sidecar バイナリ (llama-server)
│   ├── resources/      # 依存 DLL 等
│   ├── src/
│   │   ├── entities/   # SeaORM エンティティ定義
│   │   ├── db.rs       # データベース接続・初期化
│   │   ├── llama.rs    # LLM (llama.cpp) クライアント
│   │   ├── mcp.rs      # MCP SSE ハンドラー実装
│   │   └── lib.rs      # エントリーポイント・Sidecar 制御ロジック
│   ├── tests/          # 統合テスト
│   └── Cargo.toml      # Rust 依存関係
├── models/             # LLM モデル (Gemma 3 等)
├── scripts/            # セットアップスクリプト
├── journals/           # 開発記録
└── package.json        # Node.js/Bun 設定

セットアップ

プリリクエスト

1. 依存バイナリとモデルのセットアップ

以下のスクリプトを実行して、llama-server バイナリと Gemma 3 モデルを自動ダウンロードします。

# llama-server (Vulkan 1.3サポート) のダウンロード
pwsh -File scripts/setup-llama-server-vulkan.ps1

# Gemma 3 300M モデルのダウンロード
pwsh -File scripts/setup-model.ps1

2. 開発・起動

# パッケージのインストール
bun install

# 開発サーバーの起動 (Sidecar も自動起動します)
bun tauri dev

統合テスト

cd src-tauri
cargo test --lib

ビルド

リリース用バイナリ (EXE/MSI) を生成します。DLL や Sidecar バイナリも自動的にバンドルされます。

bun tauri build

ライセンス

ISC License