Context Intelligence Layer

Context Intelligence Layer

Provides LLMs with persistent memory and reusable skills via MCP, enabling semantic storage and retrieval of user preferences, project context, and step-by-step procedures across conversations.

Category
访问服务器

README

Context Intelligence Layer

A model-agnostic middleware that gives LLMs persistent memory and reusable skills via the Model Context Protocol (MCP).

Why this exists

Every time you start a new conversation with an LLM, it forgets everything — your preferences, past decisions, project context, and workflows you've already explained. You end up repeating yourself across sessions.

This project solves that. It gives any MCP-compatible model a long-term memory and a skill library backed by a vector database. Memories are stored semantically, so the model retrieves them by meaning — not exact keywords. Skills let you save multi-step procedures once and have the model follow them automatically in future sessions.

The key design choice: model-agnostic. This isn't locked to Claude or GPT. Any client that speaks MCP (Claude Desktop, Claude Code, Codex, LiteLLM, or anything built tomorrow) can plug in and instantly get persistent context. Switch models, keep your memory.

What it can do

  • Remember who you are, what you're working on, and how you like things done
  • Recall decisions from weeks-old conversations without you repeating them
  • Store deployment checklists, debugging workflows, or review processes as reusable skills
  • Work across multiple AI clients simultaneously — same memory, different models

Features

  • Persistent memory — store facts, preferences, decisions, and goals across conversations
  • Semantic search — retrieve memories by meaning, not just keywords
  • Reusable skills — save step-by-step instructions that any LLM can find and follow
  • Domain-scoped storage — memories organized into identity, projects, code, general
  • Bearer token auth — API key protection on every tool call
  • Model-agnostic — works with any MCP client (Claude Desktop, Claude Code, Codex, etc.)

Architecture

MCP Client (Claude / Codex / etc.)
        │
        │  MCP (Streamable HTTP)
        ▼
 context-mcp server  ←─── FastMCP 3.x + Python
        │
        │  Qdrant client
        ▼
   Qdrant (vector DB)

Project Structure

context-intelligence/
│
├── server/                        # ── Core Server ──
│   ├── main.py                    # MCP server entry point, tool definitions, auth setup
│   ├── qdrant_store.py            # Qdrant CRUD — store, search, delete operations
│   ├── schemas.py                 # Pydantic models (MemoryEntry, SkillEntry)
│   └── embeddings.py              # FastEmbed wrapper (all-MiniLM-L6-v2, 384 dims)
│
├── setup/                         # ── Setup & Config ──
│   └── init_collections.py        # One-time script to create Qdrant collections
│
├── docs/                          # ── Documentation ──
│   └── SYSTEM_PROMPT.md           # Drop-in system prompt for LLM clients
│
├── Dockerfile                     # Container build for the MCP server
├── requirements.txt               # Python dependencies
├── README.md                      # You are here
├── LICENSE                        # MIT
└── .gitignore

MCP Tools

Tool Description
store_memory_tool Store a memory in a domain collection
search_memory_tool Semantic search across memories
delete_memory_tool Delete a memory by ID
store_skill_tool Save a reusable skill with instructions
find_skill_tool Find relevant skills by intent
list_skills_tool List all stored skills

Quick Start

Prerequisites

  • Docker + Docker Compose

1. Clone and build the image

git clone https://github.com/myselfvivek17/context-intelligence.git
cd context-intelligence
docker build -t context-mcp:latest .

2. Create docker-compose.yml

services:
  qdrant:
    image: qdrant/qdrant
    network_mode: host
    volumes:
      - /data/qdrant:/qdrant/storage
    environment:
      - QDRANT__SERVICE__API_KEY=your-qdrant-key
    restart: unless-stopped

  context-mcp:
    image: context-mcp:latest
    network_mode: host
    environment:
      - QDRANT_URL=http://localhost:6333
      - QDRANT_API_KEY=your-qdrant-key
      - FASTMCP_HOST=0.0.0.0
      - FASTMCP_PORT=8083
      - MCP_API_KEY=your-mcp-api-key
      - MAX_SEARCH_LIMIT=50
    restart: unless-stopped

Note: Replace your-qdrant-key and your-mcp-api-key with your own random strings — these are secrets you create, not values you get from anywhere. Use a password generator or something like openssl rand -base64 24.

3. Start the stack

docker compose up -d

4. Initialize Qdrant collections (run once)

Wait a few seconds for Qdrant to start, then:

With Docker:

docker run --rm --network host \
  -e QDRANT_URL=http://localhost:6333 \
  -e QDRANT_API_KEY=your-qdrant-key \
  context-mcp:latest \
  python setup/init_collections.py

With Python (if installed locally):

pip install qdrant-client
QDRANT_URL=http://your-server:6333 QDRANT_API_KEY=your-qdrant-key python init_collections.py

This creates the 5 required Qdrant collections:

Collection Purpose
memory_identity User preferences, personal facts, who the user is
memory_projects Ongoing work, goals, decisions, project context
memory_code Languages, frameworks, coding patterns, conventions
memory_general Everything else that doesn't fit above
skills Reusable step-by-step instructions for the LLM to follow

Configuration

Environment Variable Default Description
QDRANT_URL http://localhost:6333 Qdrant server URL
QDRANT_API_KEY (none) Qdrant API key
MCP_API_KEY (none) Bearer token for MCP auth
FASTMCP_HOST 0.0.0.0 Server bind host
FASTMCP_PORT 8083 Server port
MAX_SEARCH_LIMIT 50 Max results per search query

Connecting MCP Clients

Claude Code (.mcp.json)

{
  "mcpServers": {
    "context-intelligence": {
      "command": "npx",
      "args": [
        "--yes", "mcp-remote",
        "http://your-server:8083/mcp",
        "--allow-http",
        "--header", "Authorization: Bearer your-mcp-api-key"
      ]
    }
  }
}

Claude Desktop — Windows (claude_desktop_config.json)

{
  "mcpServers": {
    "context-intelligence": {
      "command": "cmd",
      "args": [
        "/c", "npx", "--yes", "mcp-remote",
        "http://your-server:8083/mcp",
        "--allow-http",
        "--header", "Authorization: Bearer your-mcp-api-key"
      ]
    }
  }
}

Codex (~/.codex/config.toml)

[[mcp_servers]]
name = "context-intelligence"
command = "npx"
args = ["--yes", "mcp-remote", "http://your-server:8083/mcp", "--allow-http", "--header", "Authorization: Bearer your-mcp-api-key"]

System Prompt

To enable automatic memory behavior in your AI client, see SYSTEM_PROMPT.md. It instructs the model to proactively search and store memories without being asked.


Memory Domains

Domain Use for
identity User preferences, personal facts
projects Ongoing work, goals, decisions
code Languages, patterns, tools, conventions
general Everything else

Tech Stack

  • FastMCP — MCP server framework
  • Qdrant — Vector database
  • FastEmbed — Local embeddings (all-MiniLM-L6-v2, 384 dims)
  • mcp-remote — stdio-to-HTTP bridge for MCP clients

License

MIT

推荐服务器

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

官方
精选