Context-MCP

Context-MCP

Intelligent context manager for AI coding assistants that uses a three-level memory system (core, active, archive) to remember project context across conversations.

Category
访问服务器

README

Context-MCP

<div align="center">

Version License Node Tests

Intelligent Context Manager for AI Coding Assistants

Hierarchical semantic compression that remembers what matters

Installation • Quick Start • Features • CLI • API

</div>


The Problem

AI coding assistants forget your project context with every new conversation. You waste time re-explaining architecture, decisions, and patterns.

The Solution

Context-MCP provides a 3-level memory system that intelligently manages what the AI remembers:

┌─────────────────────────────────────────┐
│  CORE (~500 tokens)                     │
│  Always loaded • Key decisions          │
│  Architecture • Critical patterns       │
├─────────────────────────────────────────┤
│  ACTIVE (~2000 tokens)                  │
│  Current work context                   │
│  Related modules • Recent changes       │
├─────────────────────────────────────────┤
│  ARCHIVE (unlimited)                    │
│  Full history • Searchable              │
│  Auto-retrieved when relevant           │
└─────────────────────────────────────────┘

Installation

# Clone the repository
git clone https://github.com/vshavlidze/context-mcp.git
cd context-mcp

# Install dependencies
npm install

# Build
npm run build

# Run tests (optional)
npm test

Quick Start

1. Add to your MCP configuration

Create or edit .mcp.json in your project:

{
  "mcpServers": {
    "context": {
      "command": "node",
      "args": ["/path/to/context-mcp/dist/index.js"]
    }
  }
}

2. Start using context tools

In your AI assistant, use these tools:

context_get     → Load project context at conversation start
context_add     → Save important decisions/patterns
context_search  → Find specific information
context_focus   → Set current work area

3. Or use the CLI

# Interactive terminal interface
npm run cli
# or after npm link:
ctx

Features

Intelligent Compression

  • Automatic summarization of large contexts
  • Token-aware storage (~500 tokens for core)
  • Semantic relevance scoring

Auto-Management

  • Auto-archive: Old, low-relevance entries move to archive
  • Auto-promote: Frequently accessed entries rise to active
  • Smart caching: LRU cache with TTL for fast retrieval

Multi-language Support

  • English and Russian interfaces
  • Language selection on startup
  • Localized prompts and messages

Prompt Templates

  • Store reusable prompts in prompts/ folder
  • Variable substitution ({code}, {problem})
  • Categorized templates (coding, review, debug, docs)

Full-Text Search

  • SQLite FTS5 powered search
  • Search across all context levels
  • Relevance-ranked results

CLI Commands

Command Description
/get Load project context
/add Add new context entry
/search Search context
/list List entries by level
/delete Delete an entry
/focus Set current work focus
/import Import from file
/prompts Browse prompt templates
/stats Show statistics
/health System health check
/export Export to JSON/Markdown
/lang Change language
/help Show all commands

API (MCP Tools)

context_get

Load project context. Use at conversation start.

{
  include_active?: boolean  // Include ACTIVE level (default: true)
  focus_categories?: string[] // Filter by categories
}

context_add

Add new context entry.

{
  title: string
  content: string
  category: 'architecture' | 'pattern' | 'decision' | 'api' |
            'dependency' | 'bug' | 'feature' | 'config' |
            'security' | 'performance'
  level?: 'core' | 'active' | 'archive'  // default: 'active'
  priority?: 'critical' | 'high' | 'medium' | 'low'
  tags?: string[]
}

context_search

Search for specific context.

{
  query: string
  categories?: string[]
  tags?: string[]
  limit?: number  // default: 10
}

context_focus

Set current work focus to optimize context loading.

{
  task: string      // What you're working on
  modules?: string[] // Related module names
}

Project Structure

context-mcp/
├── src/
│   ├── core/           # Core logic
│   │   ├── compressor.ts    # Semantic compression
│   │   ├── relevance.ts     # Scoring algorithms
│   │   ├── telemetry.ts     # Performance monitoring
│   │   └── types.ts         # TypeScript types
│   ├── storage/
│   │   └── database.ts      # SQLite + FTS5 storage
│   ├── mcp/
│   │   └── server.ts        # MCP server implementation
│   └── cli/
│       ├── index.ts         # CLI entry point
│       ├── commands.ts      # Command handlers
│       ├── interface.ts     # Terminal UI
│       └── i18n.ts          # Translations
├── prompts/            # Prompt templates
├── tests/              # Test suites (306 tests)
└── dist/               # Compiled output

Configuration

Environment variables:

Variable Description Default
CONTEXT_MCP_DATA Data directory path ~/.context-mcp

Performance

  • Bulk insert: ~0.8ms per entry
  • Search: <2ms for 100 results
  • Core snapshot: <5ms generation
  • Cache hit rate: >90% typical usage

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

License

MIT License - see LICENSE for details.

推荐服务器

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

官方
精选