TxtAi Memory Vector Server

by rmtech1
Verified

Integrations

  • Supports configuration through environment variables in .env files, allowing customization of server settings, CORS configurations, and memory parameters

  • Includes specific integration instructions for macOS, detailing configuration file locations for Claude's MCP settings

  • Built on Python with txtai, providing semantic search functionality, neural search with transformers, and text extraction capabilities

TxtAIアシスタントMCP

txtaiを用いたセマンティック検索とメモリ管理のためのモデルコンテキストプロトコル(MCP)サーバー実装。このサーバーは、セマンティック検索機能を備えたテキストベースのメモリを保存、取得、管理するための堅牢なAPIを提供します。

txtaiについて

このプロジェクトは、 NeuMLによって作成された優れたオープンソースの AI 搭載検索エンジンであるtxtai上に構築されています。txtai は以下を提供します。

  • 🔍 オールインワンのセマンティック検索ソリューション
  • 🧠 トランスフォーマーを使ったニューラルサーチ
  • 💡ゼロショットテキスト分類
  • 🔄 テキスト抽出と埋め込み
  • 🌐 多言語サポート
  • 🚀 高いパフォーマンスとスケーラビリティ

txtaiの機能を拡張するために、モデルコンテキストプロトコル(MCP)を統合しました。これにより、ClaudeやClineといったAIアシスタントが強力なセマンティック検索機能を活用できるようになります。このような強力で柔軟なツールを開発してくださったtxtaiチームに深く感謝いたします。

特徴

  • 🔍 保存された記憶を横断する意味検索
  • 💾 ファイルベースのバックエンドを備えた永続ストレージ
  • 🏷️ タグベースの記憶の整理と検索
  • 📊 メモリ統計とヘルスモニタリング
  • 🔄自動データ永続化
  • 📝 包括的なログ記録
  • 🔒 構成可能な CORS 設定
  • 🤖 Claude および Cline AI との統合

前提条件

  • Python 3.8以上
  • pip (Python パッケージインストーラー)
  • virtualenv(推奨)

インストール

  1. このリポジトリをクローンします:
git clone https://github.com/yourusername/txtai-assistant-mcp.git cd txtai-assistant-mcp
  1. 起動スクリプトを実行します。
./scripts/start.sh

スクリプトは次のようになります。

  • 仮想環境を作成する
  • 必要な依存関係をインストールする
  • 必要なディレクトリを設定する
  • テンプレートから設定ファイルを作成する
  • サーバーを起動する

構成

サーバーは.envファイル内の環境変数を使用して設定できます。テンプレートは.env.templateに提供されています。

# Server Configuration HOST=0.0.0.0 PORT=8000 # CORS Configuration CORS_ORIGINS=* # Logging Configuration LOG_LEVEL=DEBUG # Memory Configuration MAX_MEMORIES=0

ClaudeおよびCline AIとの統合

この TxtAI アシスタントは、Claude および Cline AI と共に MCP サーバーとして使用して、セマンティック メモリと検索機能を強化することができます。

クロードの設定

このサーバーを Claude で使用するには、Claude の MCP 構成ファイル (通常、macOS では~/Library/Application Support/Claude/claude_desktop_config.jsonにあります) に追加します。

{ "mcpServers": { "txtai-assistant": { "command": "path/to/txtai-assistant-mcp/scripts/start.sh", "env": {} } } }

Cline の構成

Cline で使用するには、Cline の MCP 設定ファイル (通常は~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonにあります) にサーバー構成を追加します。

{ "mcpServers": { "txtai-assistant": { "command": "path/to/txtai-assistant-mcp/scripts/start.sh", "env": {} } } }

利用可能なMCPツール

設定が完了すると、Claude と Cline は次のツールを使用できるようになります。

  1. store_memory : メタデータとタグを含む新しいメモリコンテンツを保存する
{ "content": "Memory content to store", "metadata": { "source": "conversation", "timestamp": "2023-01-01T00:00:00Z" }, "tags": ["important", "context"], "type": "conversation" }
  1. retrieve_memory : セマンティック検索に基づいて記憶を取得する
{ "query": "search query", "n_results": 5 }
  1. search_by_tag : タグで思い出を検索
{ "tags": ["important", "context"] }
  1. delete_memory : コンテンツハッシュで特定のメモリを削除する
{ "content_hash": "hash_value" }
  1. get_stats : データベースの統計情報を取得する
{}
  1. check_health : データベースと埋め込みモデルの健全性をチェックする
{}

使用例

Claude または Cline では、MCP プロトコルを通じて次のツールを使用できます。

# Store a memory <use_mcp_tool> <server_name>txtai-assistant</server_name> <tool_name>store_memory</tool_name> <arguments> { "content": "Important information to remember", "tags": ["important"] } </arguments> </use_mcp_tool> # Retrieve memories <use_mcp_tool> <server_name>txtai-assistant</server_name> <tool_name>retrieve_memory</tool_name> <arguments> { "query": "what was the important information?", "n_results": 5 } </arguments> </use_mcp_tool>

AI はこれらのツールを自動的に使用して、会話中にコンテキストを維持し、関連情報を取得します。

APIエンドポイント

ストアメモリ

POST /store

オプションのメタデータとタグを使用して新しいメモリを保存します。

リクエスト本文:

{ "content": "Memory content to store", "metadata": { "source": "example", "timestamp": "2023-01-01T00:00:00Z" }, "tags": ["example", "memory"], "type": "general" }

思い出を探す

POST /search

セマンティック検索を使用してメモリを検索します。

リクエスト本文:

{ "query": "search query", "n_results": 5, "similarity_threshold": 0.7 }

タグで検索

POST /search_tags

タグで思い出を検索します。

リクエスト本文:

{ "tags": ["example", "memory"] }

メモリを削除

DELETE /memory/{content_hash}

コンテンツ ハッシュによって特定のメモリを削除します。

統計情報を取得する

GET /stats

メモリ数やタグ分布などのシステム統計を取得します。

健康チェック

GET /health

サーバーの健全性状態を確認します。

ディレクトリ構造

txtai-assistant-mcp/ ├── server/ │ ├── main.py # Main server implementation │ └── requirements.txt # Python dependencies ├── scripts/ │ └── start.sh # Server startup script ├── data/ # Data storage directory ├── logs/ # Log files directory ├── .env.template # Environment configuration template └── README.md # This file

データストレージ

メモリとタグは、 dataディレクトリ内の JSON ファイルに保存されます。

  • memories.json : 保存されているすべてのメモリが含まれます
  • tags.json : タグインデックスが含まれます

ログ記録

ログはlogsディレクトリに保存されます。デフォルトのログファイルはserver.logです。

発達

このプロジェクトに貢献するには:

  1. リポジトリをフォークする
  2. 機能ブランチを作成する
  3. 変更を加える
  4. プルリクエストを送信する

エラー処理

サーバーは包括的なエラー処理を実装します。

  • 無効なリクエストは適切なHTTPステータスコードを返します
  • エラーはスタックトレースとともに記録されます
  • ユーザーフレンドリーなエラーメッセージがレスポンスで返されます

セキュリティに関する考慮事項

  • CORS設定は環境変数で設定可能
  • ファイルパスはディレクトリトラバーサルを防ぐためにサニタイズされます
  • 入力検証はすべてのエンドポイントで実行されます

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細については LICENSE ファイルを参照してください。

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

サポート

問題が発生した場合や質問がある場合は、GitHub リポジトリに問題を報告してください。

-
security - not tested
F
license - not found
-
quality - not tested

TxtAIを用いたセマンティック検索とメモリ管理のためのモデルコンテキストプロトコル(MCP)サーバー実装。このサーバーは、セマンティック検索機能を備えたテキストベースのメモリを保存、取得、管理するための堅牢なAPIを提供します。ClaudeとCline AIもご利用いただけます。

  1. About txtai
    1. Features
      1. Prerequisites
        1. Installation
          1. Configuration
            1. Integration with Claude and Cline AI
              1. Configuration for Claude
              2. Configuration for Cline
              3. Available MCP Tools
              4. Usage Examples
            2. API Endpoints
              1. Store Memory
              2. Search Memories
              3. Search by Tags
              4. Delete Memory
              5. Get Statistics
              6. Health Check
            3. Directory Structure
              1. Data Storage
                1. Logging
                  1. Development
                    1. Error Handling
                      1. Security Considerations
                        1. License
                          1. Contributing
                            1. Support
                              ID: eyslv880qg