Memvid MCP Server

Memvid MCP Server

A Model Context Protocol server that encodes text, PDFs, and other content into video memory format, enabling efficient semantic search and chat interactions with the encoded knowledge base.

Category
访问服务器

README

Memvid MCP Server 🎥

A Model Context Protocol (MCP) server that exposes Memvid video memory functionalities to AI clients. This server allows you to encode text, PDFs, and other content into video memory format for efficient semantic search and chat interactions.

🌟 Features

  • Text Encoding: Add text chunks or full text documents to video memory
  • PDF Processing: Extract and encode content from PDF files
  • Video Memory Building: Generate compressed video representations of your data
  • Semantic Search: Query your encoded data using natural language
  • Chat Interface: Have conversations with your encoded knowledge base
  • Multi-Connection Support: Handle multiple concurrent client connections
  • Comprehensive Logging: Detailed logging to stderr for debugging
  • Graceful Shutdown: Proper resource cleanup and signal handling

📋 Requirements

  • Python 3.10 or higher
  • uv package manager
  • memvid package
  • MCP-compatible client (e.g., Claude Desktop)

🚀 Installation

1. Set up the environment

cd /memvid_mcp_server
uv venv --python 3.12 --seed
source .venv/bin/activate

2. Install dependencies

uv add -e .

H.265 Encoding with Docker

To enable H.265 video compression, you need to build the memvid-h265 Docker container. This container provides the necessary FFmpeg environment for H.265 encoding.

  1. Navigate to the memvid repository root:
    cd /memvid
    
  2. Build the Docker image:
    docker build -f docker/Dockerfile -t memvid-h265 docker/
    
    This command builds the Docker image named memvid-h265 using the Dockerfile located in the docker/ directory.

Once the Docker image is built, memvid will automatically detect and use it when video_codec='h265' is specified in build_video.

3. Test the server (optional)

uv run python memvid_mcp_server/main.py

⚙️ Configuration

Claude Desktop Setup

  1. Copy the example configuration:
cp example_mcp_config.json ~/.config/claude-desktop/config.json
  1. Or manually add to your Claude Desktop config:
{
  "mcpServers": {
    "memvid-mcp-server": {
      "command": "uv",
      "args": [
        "--directory",
        "/home/ty/Repositories/memvid_mcp_server",
        "run",
        "python",
        "memvid_mcp_server/main.py"
      ],
      "env": {
        "PYTHONPATH": "/home/ty/Repositories/memvid_mcp_server",
        "PYTHONWARNINGS": "ignore"
      }
    }
  }
}
  1. Restart Claude Desktop to load the server.

🛠️ Available Tools

get_server_status

Check the current status of the memvid server including version information.

add_chunks

Add a list of text chunks to the encoder.

  • chunks: List of text strings to add

add_text

Add a single text document to the encoder.

  • text: Text content to add
  • metadata: Optional metadata dictionary

add_pdf

Process and add a PDF file to the encoder.

  • pdf_path: Path to the PDF file

build_video

Build the video memory from all added content.

  • video_path: Output path for the video file
  • index_path: Output path for the index file
  • codec: Video codec to use ('h265' or 'h264', default: 'h265')
  • show_progress: Whether to show progress during build (default: True)
  • auto_build_docker: Whether to auto-build docker if needed (default: True)
  • allow_fallback: Whether to allow fallback options (default: True)

search_memory

Perform semantic search on the built video memory.

  • query: Natural language search query
  • top_k: Number of results to return (default: 5)

chat_with_memvid

Have a conversation with your encoded knowledge base.

  • message: Message to send to the chat system

📖 Usage Workflow

  1. Add Content: Use add_text, add_chunks, or add_pdf to add your data
  2. Build Video: Use build_video to create the video memory representation
  3. Search or Chat: Use search_memory for queries or chat_with_memvid for conversations

🔧 Development

Testing

# Install development dependencies
uv add --dev pytest pytest-asyncio black ruff mypy

# Run tests
uv run pytest

# Format code
uv run black memvid_mcp_server/
uv run ruff check memvid_mcp_server/

Debugging

  • Check logs in Claude Desktop: ~/Library/Logs/Claude/mcp*.log (macOS) or equivalent
  • Enable debug logging by setting LOG_LEVEL=DEBUG in environment
  • Use get_server_status tool to check server state

🔧 Troubleshooting

Common Issues

  1. JSON Parsing Errors: All output is properly redirected to stderr to prevent protocol interference
  2. Import Errors: The server gracefully handles missing memvid package with clear error messages
  3. Connection Issues: Check Claude Desktop logs and use get_server_status to diagnose issues
  4. Video Build Failures: Ensure sufficient disk space and valid paths

Logging Configuration

The server implements comprehensive stdout redirection to prevent any library output from interfering with the MCP JSON-RPC protocol:

  • All memvid operations are wrapped with stdout redirection
  • Progress bars, warnings, and model loading messages are captured
  • Only structured JSON responses are sent to Claude Desktop
  • All diagnostic information is logged to stderr

Error Messages

  • "Memvid not available": Install the memvid package: uv add memvid
  • "Video memory not built": Run build_video before searching or chatting
  • "LLM not available": Expected warning - memvid will work without external LLM providers

📄 License

MIT License - see the LICENSE file for details.

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📚 Related Projects


Generated with improvements for production reliability and MCP best practices.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选