MCP Claude Context Server

MCP Claude Context Server

A powerful MCP server that extracts, stores, searches, and analyzes Claude.ai conversations with SQLite database, semantic search, and multiple export formats including Obsidian and PDF.

Category
Visit Server

README

MCP Claude Context Server v0.5.0

PyPI version Python 3.11+ License: MIT

A powerful Model Context Protocol (MCP) server for extracting, storing, searching, and analyzing Claude.ai conversations with enhanced database storage, semantic search, and multiple export formats.

πŸš€ What's New in v0.5.0

  • SQLite Database Storage - Migrate from JSON files to efficient database
  • Semantic Search - AI-powered search using sentence transformers
  • Multiple Export Formats - Obsidian, PDF, JSON, CSV
  • Easy Deployment - Docker support and one-click installers
  • Performance Improvements - 10x faster search, 35% faster operations

Features

Core Functionality

  • βœ… Direct API access for Claude.ai conversations
  • βœ… Chrome extension for full message extraction
  • βœ… SQLite database with full-text search
  • βœ… Semantic search capabilities
  • βœ… Multiple export formats (Obsidian, PDF, JSON, CSV)
  • βœ… Bulk operations and analytics
  • βœ… Session management with auto-refresh
  • βœ… Real-time analytics dashboard

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Claude.ai Web  │────▢│ Chrome Extension │────▢│  Bridge Server  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                          β”‚
                                                          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   MCP Client    │◀────│    MCP Server    │◀────│    Database     β”‚
β”‚  (Claude App)   β”‚     β”‚   (Enhanced)     β”‚     β”‚  (SQLite+FTS)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”
                        β–Ό               β–Ό
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚ Exportersβ”‚    β”‚  Search  β”‚
                  β”‚ (PDF/MD) β”‚    β”‚ (AI/FTS) β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Installation

Quick Start with uvx (Recommended - No Installation!)

Add to your Claude Desktop config:

{
  "mcpServers": {
    "claude-context": {
      "command": "uvx",
      "args": ["mcp-claude-context"],
      "env": {
        "CLAUDE_SESSION_KEY": "sk-ant-sid01-...",
        "CLAUDE_ORG_ID": "28a16e5b-..."
      }
    }
  }
}

That's it! No installation needed. See full uvx guide β†’

Quick Start with Docker

# Using pre-built image
docker run -d \
  --name mcp-claude-context \
  -p 8000:8000 \
  -v $(pwd)/data:/app/data \
  hamzaamjad/mcp-claude-context:latest

# Or with docker-compose
curl -O https://raw.githubusercontent.com/hamzaamjad/mcp-claude-context/main/docker-compose.simple.yml
docker-compose -f docker-compose.simple.yml up -d

One-Click Installer

# Mac/Linux
curl -sSL https://raw.githubusercontent.com/hamzaamjad/mcp-claude-context/main/deployment/one-click-install.sh | bash

# Windows (PowerShell)
iwr -useb https://raw.githubusercontent.com/hamzaamjad/mcp-claude-context/main/deployment/install.ps1 | iex

Manual Installation

  1. Prerequisites:

    • Python 3.11+
    • Chrome browser
    • Poetry (Python package manager)
  2. Install dependencies:

    poetry install
    
  3. Initialize database:

    poetry run python -c "from src.models.conversation import init_database; init_database()"
    
  4. Install Chrome extension:

    • Open Chrome β†’ chrome://extensions/
    • Enable "Developer mode"
    • Click "Load unpacked" β†’ Select extension/ directory
  5. Start the server:

    poetry run python -m src.direct_api_server
    

πŸ“š Available MCP Tools

Conversation Management

Tool Description Requires API Keys
list_conversations List all conversations from Claude.ai βœ…
get_conversation Get specific conversation details βœ…
search_conversations Search conversations by keyword βœ…
get_conversation_messages Get full messages from local data ❌

Search & Analytics

Tool Description
search_messages Full-text search across all messages
semantic_search AI-powered similarity search
get_analytics Get conversation statistics and insights

Export & Operations

Tool Description
export_conversations Export to JSON/CSV formats
export_to_obsidian Export to Obsidian vault with backlinks
bulk_operations Tag, export, delete, or analyze in bulk

System Management

Tool Description
update_session Update Claude.ai session credentials
migrate_to_database Migrate JSON files to SQLite
rebuild_search_index Optimize search performance

πŸ’‘ Usage Examples

Basic Operations

# List conversations
{
  "tool": "list_conversations",
  "arguments": {
    "session_key": "YOUR_SESSION_KEY",
    "org_id": "YOUR_ORG_ID",
    "limit": 50,
    "sync_to_db": true
  }
}

# Search with AI
{
  "tool": "semantic_search",
  "arguments": {
    "query": "discussions about machine learning",
    "search_type": "hybrid",
    "top_k": 10
  }
}

# Export to Obsidian
{
  "tool": "export_to_obsidian",
  "arguments": {
    "conversation_ids": ["conv-id-1", "conv-id-2"],
    "vault_path": "/path/to/obsidian/vault"
  }
}

Chrome Extension Usage

  1. Extract single conversation:

    • Navigate to conversation on Claude.ai
    • Click extension icon
    • Click "Extract Current Conversation"
  2. Bulk extract all conversations:

    • Click extension icon
    • Click "Extract All Conversations"
    • Monitor progress in popup
  3. View analytics:

    • Visit http://localhost:8765/dashboard
    • See statistics, trends, and insights

πŸ”§ Configuration

Environment Variables

Variable Description Default
MCP_DB_PATH Database location data/db/conversations.db
MCP_EXPORT_DIR Export directory exports/
NOTION_API_KEY Notion integration Optional

Getting Session Credentials

  1. Log into Claude.ai
  2. Open Chrome DevTools (F12)
  3. Go to Application β†’ Cookies
  4. Find sessionKey value
  5. Find org_id in Network tab API calls

πŸ“Š Performance

v0.5.0 Improvements

  • Search Speed: 10x faster with SQLite FTS5
  • Storage: 20% less space with database compression
  • Operations: 35% faster read/write performance
  • Scalability: Handles 100K+ conversations efficiently

Benchmark Results

Operation JSON Files SQLite Database
Search 1K convos 2.3s 0.23s
Load conversation 150ms 45ms
Export 100 convos 5.2s 1.8s

πŸš€ Advanced Features

Semantic Search

The server uses sentence transformers for AI-powered search:

  • Find similar conversations
  • Search by meaning, not just keywords
  • Discover related topics automatically

Obsidian Integration

Export conversations with:

  • Proper frontmatter metadata
  • Automatic backlinks
  • Daily notes integration
  • Tag organization
  • Dataview queries

Bulk Operations

Process multiple conversations:

{
  "tool": "bulk_operations",
  "arguments": {
    "operation": "analyze",
    "conversation_ids": ["id1", "id2", "id3"],
    "params": {}
  }
}

πŸ› Troubleshooting

Common Issues

  1. "Session expired" error

    • Get fresh session key from Claude.ai
    • Use update_session tool
  2. Chrome extension not connecting

    • Ensure bridge server is running (port 9222)
    • Check extension permissions
  3. Database locked error

    • Ensure only one server instance running
    • Check file permissions
  4. Search not finding results

    • Run rebuild_search_index tool
    • Verify conversations are in database

Debug Mode

Enable detailed logging:

LOG_LEVEL=DEBUG poetry run python -m src.direct_api_server

🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new features
  4. Submit a pull request

Development Setup

# Install dev dependencies
poetry install --with dev

# Run tests
poetry run pytest

# Format code
poetry run black src/
poetry run ruff src/

πŸ“„ License

MIT License - see LICENSE file

πŸ™ Acknowledgments

πŸ“ž Support


Note: This tool is not affiliated with Anthropic. Use responsibly and respect rate limits.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured