MCP Server for Mem.ai

MCP Server for Mem.ai

Enables AI assistants to intelligently save, organize, and retrieve content through Mem.ai's knowledge management platform. Supports creating notes, collections, and AI-powered content processing with automatic organization.

Category
访问服务器

README

MCP Server for Mem.ai

A production-ready Model Context Protocol (MCP) server that provides AI assistants with intelligent access to Mem.ai's knowledge management platform.

Python 3.10+ License: MIT

✨ Features

  • 🧠 Intelligent Memory: Save and process content with Mem It's AI-powered organization
  • 📝 Note Management: Create, read, and delete structured markdown notes
  • 📁 Collections: Organize notes into searchable collections
  • 🔒 Type-Safe: Full type hints and Pydantic validation
  • Async/Await: High-performance async I/O throughout
  • 🎯 Clean API: Simple, intuitive interface for AI assistants
  • 🛡️ Production-Ready: Comprehensive error handling and logging
  • 🧪 Well-Tested: Full test suite with pytest

📋 Prerequisites

🚀 Quick Start

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/mcp-mem.ai.git
cd mcp-mem.ai
  1. Install dependencies:
pip install -e .
  1. Set up your environment:
cp .env.example .env
# Edit .env and add your MEM_API_KEY

Running the Server

Local Development

fastmcp run src/mcp_mem/server.py

Using with Claude Desktop

Add to your Claude Desktop configuration (claude_desktop_config.json):

{
  "mcpServers": {
    "mem": {
      "command": "python",
      "args": ["-m", "mcp_mem.server"],
      "env": {
        "MEM_API_KEY": "your_api_key_here"
      }
    }
  }
}

Using with Other MCP Clients

from mcp_mem import mcp

# Run the server
mcp.run()

🛠️ Available Tools

1. mem_it - Intelligent Content Processing

Save and automatically process any content type with AI-powered organization.

Parameters:

  • input (required): Content to save (text, HTML, markdown, etc.)
  • instructions (optional): Processing instructions
  • context (optional): Additional context for organization
  • timestamp (optional): ISO 8601 timestamp

Example:

mem_it(
    input="Just had a great meeting with the product team about Q1 roadmap...",
    instructions="Extract key action items and decisions",
    context="Product Planning"
)

2. create_note - Create Structured Note

Create a markdown-formatted note with explicit control over content and organization.

Parameters:

  • content (required): Markdown-formatted content
  • collection_ids (optional): List of collection UUIDs
  • collection_titles (optional): List of collection titles

Example:

create_note(
    content="""# Team Standup - Jan 15, 2024

    ## Completed
    - Feature X shipped to production
    - Bug fixes for issue #123

    ## In Progress
    - Working on Feature Y
    - Code review for PR #456

    ## Blockers
    - Waiting for API access
    """,
    collection_titles=["Team Meetings", "Engineering"]
)

3. read_note - Read Note

Retrieve a note's full content and metadata by ID.

Parameters:

  • note_id (required): UUID of the note

Example:

read_note("01961d40-7a67-7049-a8a6-d5638cbaaeb9")

4. delete_note - Delete Note

Permanently delete a note by ID.

Parameters:

  • note_id (required): UUID of the note

Example:

delete_note("01961d40-7a67-7049-a8a6-d5638cbaaeb9")

5. create_collection - Create Collection

Create a new collection to organize related notes.

Parameters:

  • title (required): Collection title
  • description (optional): Markdown-formatted description

Example:

create_collection(
    title="Project Apollo",
    description="""# Project Apollo

    All notes related to the Apollo project including:
    - Meeting notes
    - Technical specifications
    - Customer feedback
    """
)

6. delete_collection - Delete Collection

Delete a collection (notes remain, just unassociated).

Parameters:

  • collection_id (required): UUID of the collection

Example:

delete_collection("5e29c8a2-c73b-476b-9311-e2579712d4b1")

⚙️ Configuration

Configuration is done via environment variables. Copy .env.example to .env and customize:

# Required: Your Mem.ai API key
MEM_API_KEY=your_api_key_here

# Optional: Custom API endpoint (default: https://api.mem.ai/v2)
MEM_API_BASE_URL=https://api.mem.ai/v2

# Optional: Request timeout in seconds (default: 30)
MEM_REQUEST_TIMEOUT=30

# Optional: Enable debug logging (default: false)
MEM_DEBUG=false

🏗️ Architecture

src/mcp_mem/
├── __init__.py      # Package initialization
├── models.py        # Pydantic data models
├── client.py        # Mem.ai API client
└── server.py        # MCP server implementation

Key Components

  • models.py: Pydantic models for request/response validation
  • client.py: Async HTTP client wrapper for Mem.ai API
  • server.py: FastMCP server with tool implementations

🧪 Testing

Run the test suite:

# Install dev dependencies
pip install -e ".[dev]"

# Run all tests
pytest

# Run with coverage
pytest --cov=mcp_mem --cov-report=html

# Run specific test file
pytest tests/test_client.py

🔍 Error Handling

The server provides clear, actionable error messages:

  • MemAuthenticationError: Invalid or missing API key
  • MemNotFoundError: Resource (note/collection) not found
  • MemValidationError: Invalid request parameters
  • MemAPIError: General API errors

All errors are logged and returned with helpful context to the AI assistant.

📚 Examples

See the examples/ directory for complete usage examples:

  • basic_usage.py: Simple examples of each tool
  • advanced_usage.py: Complex workflows and patterns

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Links

💡 Use Cases

  • Meeting Notes: Automatically process and organize meeting transcripts
  • Research: Save and categorize research papers, articles, and findings
  • Customer Feedback: Collect and organize customer conversations
  • Knowledge Base: Build a searchable knowledge repository
  • Personal Memory: Keep track of ideas, thoughts, and learnings

🐛 Troubleshooting

Authentication Error

MemAuthenticationError: MEM_API_KEY environment variable or api_key parameter is required

Solution: Set your MEM_API_KEY in the .env file or environment.

Connection Timeout

httpx.ReadTimeout: timeout

Solution: Increase MEM_REQUEST_TIMEOUT in your .env file.

Invalid UUID

MemValidationError: invalid UUID format

Solution: Ensure note/collection IDs are valid UUIDs from Mem.ai.


Built with ❤️ using FastMCP and Mem.ai

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选