Skip to main content

Unified Context Layer MCP - A Memory System for AI assistants that goes beyond traditional RAG

Project description

Unified Context Layer MCP

A Memory System for AI assistants that goes beyond traditional RAG. Store conversations, build knowledge graphs, extract facts, and maintain user profiles—all searchable with semantic understanding.Use across your apps and LLMs.

Features

Core Memory

  • Infinite Context - Automatically compress long conversations while preserving important information
  • Vector Search - Semantic search across all saved conversations using Pinecone
  • Full Content Storage - Store up to ~5,000 words per chunk with formatting preserved
  • Smart Compression - LLM-powered intelligent summarization

Memory System

  • User Profiles - Automatically learns your interests, projects, and preferences
  • Entity Graphs - Build knowledge graphs connecting people, projects, concepts
  • Fact Extraction - Extract and chain atomic facts from conversations
  • Temporal Awareness - Understand recency and relevance over time
  • Hybrid Scoring - Combine semantic similarity with temporal and entity signals

Query Understanding

  • Query Classification - Understand intent (search, save, question, etc.)
  • Query Rewrites - Generate synonyms, broader terms, and expansions
  • Enhanced Search - Guardrails, auto-refinement, and follow-up recommendations

Indexing

  • GitHub Repositories - Index entire repos for code search
  • Documentation Sites - Crawl and index docs
  • Websites - Full website crawling
  • Local Filesystems - Index local directories
  • Single URLs - Index individual pages (blogs, ChatGPT conversations, tweets)

🚀 Quick Start

1. Clone the Repository

git clone https://github.com/yourusername/infinite-context-mcp.git
cd infinite-context-mcp

2. Create Virtual Environment

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure API Keys

cp env_example.txt .env

Edit .env with your API keys:

ANTHROPIC_API_KEY=your_anthropic_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
PINECONE_API_KEY=your_pinecone_api_key_here
PINECONE_INDEX_NAME=infinite-context-index  # Optional, this is the default

Get your API keys:

5. Update the Run Script

Edit run_mcp.sh to point to your installation:

#!/bin/bash
cd /path/to/your/infinite-context-mcp
source venv/bin/activate
exec python main.py

Make it executable:

chmod +x run_mcp.sh

6. Connect to Your AI Tool

For Cursor

Add to your Cursor MCP settings (~/.cursor/mcp.json or via Settings > MCP):

{
  "mcpServers": {
    "infinite-context": {
      "command": "/path/to/your/infinite-context-mcp/run_mcp.sh",
      "args": [],
      "env": {
        "PYTHONPATH": "/path/to/your/infinite-context-mcp"
      }
    }
  }
}

For Claude Desktop

Add the same configuration to Claude Desktop's MCP settings.

For Claude Code (CLI)

claude mcp add --transport stdio infinite-context -- /path/to/your/infinite-context-mcp/run_mcp.sh

7. Restart Your AI Tool

Fully quit and restart Cursor/Claude Desktop to load the MCP server.


📖 Usage

Smart Action (Recommended)

The easiest way to use the MCP—just describe what you want:

"Save this conversation about setting up the MCP server"
"Find past discussions about API integration"
"What have I been working on lately?"
"Show me my user profile"

Quick Reference

What You Want Example Request
Save context "Save this conversation about X"
Search context "Find information about Y"
Ask a question "What do I know about Z?"
Get profile "Show my user profile"
Memory stats "Show memory statistics"
Index a repo "Index https://github.com/owner/repo"

🛠️ Available Tools

Core Tools

Tool Description
smart_action Intelligent orchestration—just describe what you want
save_context Save conversation context with summary, topics, and full content
search_context Semantic search across saved conversations
enhanced_search Advanced search with query understanding and auto-refinement
ask_question RAG Q&A—ask questions about your saved data
auto_compress Compress and save long conversations
get_memory_stats View memory statistics

Memory System Tools

Tool Description
get_user_profile View your learned profile (interests, focus, stats)
update_user_profile Manually update profile preferences and focus
query_knowledge_graph Find entity relationships and connections
get_graph_summary Overview of your knowledge graph
query_facts Search extracted facts by entity or type
get_fact_summary Summary of all extracted facts

Query Understanding Tools

Tool Description
classify_query Classify query intent and categories
rewrite_query Generate query variations for better recall

Indexing Tools

Tool Description
index_repository Index a GitHub repository
index_documentation Index a documentation site
index_website Crawl and index a full website
index_local_filesystem Index a local directory
index_url Index a single URL (any type)
check_indexing_status Check status of indexing job
list_indexed_sources List all indexed sources
delete_indexed_source Remove an indexed source

🧠 How the Memory System Works

1. Context Storage

When you save context, the system stores:

  • Summary - Brief overview (up to 2,000 chars)
  • Full Content - Raw content preserving formatting (up to 25,000 chars)
  • Topics - Tags for categorization
  • Key Findings - Important points extracted
  • Entities - People, projects, concepts mentioned
  • Facts - Atomic facts for precise retrieval

2. User Profile Learning

The system automatically learns:

  • Interests - Topics you frequently discuss
  • Current Focus - What you're actively working on
  • Entity Connections - How concepts in your work relate

3. Knowledge Graph

As you save contexts, entities are extracted and connected:

  • Find relationships between projects, people, and concepts
  • Discover paths between entities
  • Get summaries of your knowledge domain

4. Fact Extraction

Atomic facts are extracted with:

  • Type - Statement, decision, preference, problem, solution, etc.
  • Confidence - How certain the extraction is
  • Temporal Ordering - Newer facts can supersede older ones

5. Hybrid Search

Search combines multiple signals:

  • Semantic Similarity - Meaning-based matching
  • Temporal Relevance - Recent content weighted higher
  • Entity Matching - Boost results with matching entities
  • Profile Context - Personalized based on your interests

📁 Project Structure

infinite-context-mcp/
├── main.py                 # MCP server with all tools
├── run_mcp.sh              # Startup script
├── requirements.txt        # Python dependencies
├── env_example.txt         # Environment variable template
├── query_understanding.py  # Query classification & rewriting
├── user_profile.py         # User profile management
├── entity_graph.py         # Knowledge graph implementation
├── fact_chain.py           # Fact extraction & chaining
├── memory_scorer.py        # Hybrid scoring system
├── lib/
│   └── indexing_service.py # External indexing service
└── api/
    └── api_server.py       # Optional REST API

🔧 Troubleshooting

MCP Server Not Appearing

  1. Check the script path - Verify run_mcp.sh path in your MCP config
  2. Test the script - Run ./run_mcp.sh directly to see errors
  3. Check Python environment - Ensure venv has all dependencies
  4. Restart completely - Fully quit and restart your AI tool

API Errors

  1. Verify API keys - Check all keys in .env are valid
  2. Pinecone index - Will be auto-created on first run
  3. OpenAI access - Ensure your key has embedding API access

Permission Errors

chmod +x run_mcp.sh

Tools Not Working

  1. Check MCP connection status in your AI tool's settings
  2. Look for error messages in the terminal running the MCP
  3. Verify the Pinecone index exists and is accessible

🔐 Security

  • Never commit .env - It's in .gitignore by default
  • API keys in environment - All secrets loaded from env vars
  • Unique index names - Use different PINECONE_INDEX_NAME for different projects
  • Local storage - User profiles stored locally in ~/.infinite-context/

📚 Additional Documentation


🤝 Contributing

Contributions welcome!


📄 License

MIT License

Contact

Reach out to me on x!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_kayacancode_infinite_context_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_kayacancode_infinite_context_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 56.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_kayacancode_infinite_context_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 af77be40e32656a81fb7dcc635fab835b5fdff9140ca5cc58288f8703113809b
MD5 45217248fddbbbb53a72de142d45b5d2
BLAKE2b-256 e3f712943ca68ff2b4b2fb6df50ebb40eab0ef3a46034c70367f271ec371c0ed

See more details on using hashes here.

File details

Details for the file iflow_mcp_kayacancode_infinite_context_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_kayacancode_infinite_context_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 73.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_kayacancode_infinite_context_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32dfc4cd58a7259669c2592c918e053c80c7989197a07a93d674d34d95ce1298
MD5 ce4cd650a53bcebda44345c2972a060f
BLAKE2b-256 81766ef48e1c819f772b7bfa1162ade65bbb2e6ade349b1947a0a5afe21e566b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page