TxtAi Memory Vector Server

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

文本人工智能助手 MCP

使用txtai实现的模型上下文协议 (MCP) 服务器实现,用于语义搜索和内存管理。该服务器提供了一个强大的 API,用于存储、检索和管理基于文本的内存,并具有语义搜索功能。

关于txtai

该项目建立在txtai之上,txtai 是由NeuML创建的优秀的开源 AI 搜索引擎。txtai 提供:

  • 🔍 一体化语义搜索解决方案
  • 🧠 使用 Transformer 进行神经搜索
  • 💡 零样本文本分类
  • 🔄 文本提取和嵌入
  • 🌐 多语言支持
  • 🚀 高性能和可扩展性

我们通过集成模型上下文协议 (MCP) 扩展了 txtai 的功能,使 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 一起使用,请将其添加到 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>

人工智能将自动使用这些工具在对话期间维持上下文并检索相关信息。

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 文件。

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

支持

如果您遇到任何问题或有疑问,请在 GitHub 存储库上提交问题。

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

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

使用 TxtAI 实现的模型上下文协议 (MCP) 服务器,用于语义搜索和内存管理。该服务器提供强大的 API,用于存储、检索和管理基于文本的内存,并具备语义搜索功能。您也可以使用 Claude 和 Cline AI

  1. 关于txtai
    1. 特征
      1. 先决条件
        1. 安装
          1. 配置
            1. 与 Claude 和 Cline AI 集成
              1. Claude 的配置
              2. Cline 的配置
              3. 可用的 MCP 工具
              4. 使用示例
            2. API 端点
              1. 存储内存
              2. 搜索记忆
              3. 按标签搜索
              4. 删除记忆
              5. 获取统计数据
              6. 健康检查
            3. 目录结构
              1. 数据存储
                1. 日志记录
                  1. 发展
                    1. 错误处理
                      1. 安全注意事项
                        1. 执照
                          1. 贡献
                            1. 支持

                              Related MCP Servers

                              • A
                                security
                                A
                                license
                                A
                                quality
                                A Model Context Protocol (MCP) server that provides search and crawl functionality using Search1API.
                                Last updated -
                                5
                                206
                                111
                                TypeScript
                                MIT License
                                • Apple
                              • -
                                security
                                A
                                license
                                -
                                quality
                                A Model Context Protocol (MCP) server that enables semantic search and retrieval of documentation using a vector database (Qdrant). This server allows you to add documentation from URLs or local files and then search through them using natural language queries.
                                Last updated -
                                14
                                74
                                JavaScript
                                Apache 2.0
                                • Apple
                              • -
                                security
                                F
                                license
                                -
                                quality
                                A Machine Control Protocol (MCP) server that enables storing and retrieving information from a Qdrant vector database with semantic search capabilities.
                                Last updated -
                                • Linux
                                • Apple
                              • -
                                security
                                F
                                license
                                -
                                quality
                                A Model Context Protocol server that enables Claude to persistently store, search, and manage text memories with tags in a local JSON file.
                                Last updated -
                                TypeScript
                                • Apple

                              View all related MCP servers

                              ID: eyslv880qg