botirk38/memcp
If you are the rightful owner of memcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Memories.ai MCP Server is a Model Context Protocol server that facilitates interaction between AI agents and the Memories.ai API, enabling video management and interaction capabilities.
Memories.ai MCP Server
A type-safe Model Context Protocol (MCP) server that enables AI agents to interact with the Memories.ai API, providing comprehensive video upload, search, chat, and management capabilities for AI applications.
Overview
This MCP server bridges AI agents with the Memories.ai platform using a modular, type-safe architecture. It provides seamless integration with video upload from files or URLs, semantic search, AI-powered video chat, and comprehensive video library management through the standardized MCP interface.
Features
- š„ Video Upload - Upload videos from local files or URLs with MIME type detection
- š Semantic Search - Advanced semantic search with multiple search types (BY_VIDEO, BY_AUDIO, BY_CLIP)
- š¬ AI Video Chat - Streaming conversations about video content with session management
- š Video Management - List, delete, and check video status with pagination and filtering
- š MCP Compatible - Full MCP specification compliance with tools, resources, and prompts
- š Secure Authentication - Flexible API key authentication (environment or query parameter)
- ā” Type-Safe Architecture - Built with TypeScript, Zod validation, and better-fetch
- š Streaming Responses - Real-time Server-Sent Events for chat functionality
- šÆ Intelligent Prompts - Pre-built prompt templates for video analysis workflows
Prerequisites
- Node.js 18+ or Bun runtime (recommended)
- TypeScript 4.5+ for development
- A Memories.ai API key (Get one here)
- Claude Code or another MCP-compatible client
Installation
Quick Start
# Clone the repository
git clone https://github.com/yourusername/memories-ai-mcp.git
cd memcp
# Install dependencies (Bun recommended)
bun install
# Build the project
bun run build
Environment Setup
Create a .env
file:
# Get your API key from: https://memories.ai/app/login (API Settings page)
MEMORIES_API_KEY=your_memories_ai_api_key_here
# Optional: Override the default API base URL
# MEMORIES_API_BASE_URL=https://api.memories.ai
# Optional: Set log level for debugging
# LOG_LEVEL=info
API Key Configuration
API keys can be provided in two ways:
- Environment Variable (Recommended): Set
MEMORIES_API_KEY
in your.env
file - Per-Tool Parameter: Include
api_key
as an optional parameter in individual tool calls
The per-tool parameter takes precedence over the environment variable, allowing for flexible multi-user scenarios.
Usage
Adding to Claude Code
Add the MCP server to Claude Code:
claude mcp add memories-ai --env MEMORIES_API_KEY=your_key_here -- node /path/to/memories-ai-mcp/dist/index.js
Or with the built executable:
claude mcp add memories-ai --env MEMORIES_API_KEY=your_key_here -- /path/to/memories-ai-mcp/dist/index.js
Available MCP Tools
The server exposes 8 comprehensive tools for AI agents:
upload-video-file
Upload a video file from local storage to Memories.ai
{
"file_path": "/path/to/video.mp4",
"unique_id": "user123",
"callback": "https://callback.url/webhook",
"video_name": "My Video"
}
Note: API key can be provided as optional api_key
parameter or via environment variable
upload-video-url
Upload a video from a URL to Memories.ai
{
"url": "https://example.com/video.mp4",
"unique_id": "user123",
"callback": "https://callback.url/webhook",
"video_name": "My Video"
}
Note: API key can be provided as optional api_key
parameter or via environment variable
search-videos
Search through uploaded videos using natural language with advanced options
{
"query": "people talking about AI",
"unique_id": "user123",
"search_type": "BY_VIDEO",
"folder_id": -1
}
Note: API key can be provided as optional api_key
parameter or via environment variable
chat-with-videos
Have streaming AI conversations about one or more videos
{
"video_nos": ["vid123", "vid456"],
"prompt": "Summarize the main points discussed",
"unique_id": "user123",
"session_id": "session123"
}
Note: API key can be provided as optional api_key
parameter or via environment variable
list-videos
Get a paginated list of uploaded videos with filtering options
{
"unique_id": "user123",
"page": 1,
"size": 20,
"video_name": "optional_filter",
"video_no": "optional_id_filter",
"status": "PARSE"
}
Note: API key can be provided as optional api_key
parameter or via environment variable
delete-videos
Delete one or more videos from Memories.ai
{
"video_nos": ["vid123", "vid456"],
"unique_id": "user123"
}
Note: API key can be provided as optional api_key
parameter or via environment variable
check-video-status
Check the processing status of uploaded videos
{
"video_nos": ["vid123"],
"unique_id": "user123"
}
Note: API key can be provided as optional api_key
parameter or via environment variable
MCP Resources
memories://docs
Comprehensive API documentation and platform capabilities
- Complete endpoint reference
- Authentication methods
- Rate limits and best practices
- Troubleshooting guides
memories://video/{videoNo}
Detailed information about specific videos
- Video metadata and status
- Processing information
- Usage examples
MCP Prompts
analyze-video-content
Generate specialized prompts for video content analysis
- Analysis types: summary, emotions, objects, activities, transcript, technical, educational
- Detail levels: brief, detailed, comprehensive
- Focus areas: Customizable attention to specific aspects
- Context instructions: Specialized guidance per analysis type
build-search-query
Intelligent search query construction assistance
- Search approaches: visual, audio, combined content targeting
- Specificity levels: broad, specific, precise query scoping
- Context integration: Incorporates additional search parameters
- Query optimization: Balanced precision and recall strategies
video-workflow-helper
Step-by-step workflow guidance for common tasks
- Workflow types: upload, search, analyze, manage, integrate, troubleshoot
- Experience levels: beginner, intermediate, advanced guidance
- Best practices: Actionable recommendations and pitfall avoidance
- Tool integration: Specific MCP tool usage recommendations
Development
Project Structure
memcp/
āāā src/
ā āāā index.ts # Main MCP server entry point
ā āāā types/
ā ā āāā memories.ts # TypeScript types and Zod schemas
ā āāā clients/
ā ā āāā memories.ts # Type-safe Memories.ai API client
ā āāā tools/
ā ā āāā upload.ts # Video upload tools
ā ā āāā search.ts # Video search tools
ā ā āāā chat.ts # Video chat tools
ā ā āāā utils.ts # Video management tools
ā āāā resources/
ā ā āāā index.ts # MCP resources (docs, video details)
ā āāā prompts/
ā ā āāā index.ts # MCP prompts for workflows
ā āāā utils/
ā āāā api-key.ts # API key management
ā āāā mime-types.ts # MIME type utilities
āāā dist/ # Built JavaScript files
āāā memories-ai-docs/ # Local API documentation
āāā package.json # Project configuration
āāā tsdown.config.ts # Build configuration
āāā tsconfig.json # TypeScript configuration
āāā biome.jsonc # Code formatting configuration
āāā .env # Environment variables
Available Scripts
bun run dev
- Start development server with watch modebun run build
- Build the project using tsdownbun run typecheck
- Run TypeScript type checkingbun run check
- Run Biome linter and formatterbun run check:fix
- Run Biome with auto-fixbun run start
- Start the built server
Building
bun run build
This creates an executable dist/index.js
file with proper shebang for direct execution.
API Reference
Memories.ai API Integration
The server integrates with Memories.ai API v1.2:
- Base URL:
https://api.memories.ai
- Authentication: API key in Authorization header
- Supported Formats: h264, h265, vp9, hevc
- Languages: English (prompts and chat)
Error Handling
The server returns standardized MCP error responses:
- Authentication failures
- API rate limits
- Invalid parameters
- Network errors
Examples
Basic Video Upload
// AI agent can use this tool automatically
await upload_video_url({
url: "https://example.com/presentation.mp4",
unique_id: "user123",
video_name: "Team Presentation"
});
Semantic Video Search
// Search for specific content in videos
const results = await search_videos({
query: "discussion about quarterly goals",
unique_id: "user123",
search_type: "BY_VIDEO"
});
AI Video Chat
// Chat about video content
const response = await chat_with_videos({
video_nos: ["vid123"],
prompt: "What are the key action items mentioned?",
unique_id: "user123"
});
Troubleshooting
Common Issues
MCP server fails to connect:
- Ensure the server builds successfully with
bun run build
- Check that the API key is set correctly in environment variables
- Verify Node.js version compatibility
API authentication errors:
- Verify your Memories.ai API key is valid
- Check that the key is properly set in the MCP configuration
Video upload failures:
- Ensure video URLs are publicly accessible
- Check supported video formats (h264, h265, vp9, hevc)
- Verify rate limits aren't exceeded
Debug Mode
Run with debug logging:
claude --debug
Check MCP server logs in:
/Users/[username]/Library/Caches/claude-cli-nodejs/[project-path]/
Dependencies
Runtime Dependencies
@modelcontextprotocol/sdk
- MCP SDK for TypeScript@better-fetch/fetch
- Type-safe HTTP client with schema validationzod
- Runtime type validation and schema parsing
Development Dependencies
@biomejs/biome
- Fast formatter and lintertsdown
- Modern TypeScript bundlertypescript
- TypeScript compiler
Architecture
Type Safety
- Comprehensive Types: Full TypeScript coverage with Zod runtime validation
- Schema-Based Client: Better-fetch integration with predefined API schemas
- Request/Response Validation: Automatic validation of all API interactions
Error Handling
- Graceful Degradation: Comprehensive error messages with troubleshooting guidance
- Retry Logic: Exponential backoff for transient failures
- Validation Errors: Clear feedback for invalid parameters
Performance
- Streaming Support: Server-Sent Events for real-time chat responses
- Efficient Uploads: Optimized file handling with MIME type detection
- Connection Pooling: Reusable HTTP connections with timeout management
License
MIT License - see file for details
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request