mcp-context-manager
Version:
Simple AI Context for Better Code Generation - Persistent context system for AI coding assistants
222 lines (161 loc) • 6.2 kB
Markdown
# MCP Context Manager
[](https://www.npmjs.com/package/mcp-context-manager)
**Version 7.5.0** - Simple AI Context for Better Code Generation
Give your AI coding assistants persistent memory of your project. Works with Claude Code, Cursor, GitHub Copilot, and more.
## What It Does
MCP Context Manager solves the "context amnesia" problem of AI coding assistants by creating persistent context files that automatically load in every session.
**Before**: AI forgets your project structure, patterns, and conventions between chats
**After**: AI always knows your tech stack, coding standards, and project specifics
## Quick Start
```bash
# Install globally
npm install -g mcp-context-manager
# Or use directly with npx
npx mcp-context-manager setup_context .
```
## How It Works
### 1. Creates Smart Context Files
- **AI-CONTEXT.md**: Project overview, tech stack, guidelines
- **AI-PATTERNS.md**: Code examples and patterns to follow
### 2. Enables Auto-Loading
- **Cursor**: Creates `.cursorrules` with full context
- **Claude Code**: Creates `CLAUDE.md` with references to context files
- **GitHub Copilot**: Creates `.github/copilot-instructions.md`
- **Continue**: Creates `.continue/context.md`
### 3. Keeps Context Fresh
- Git hooks remind you when context is outdated
- Simple update command refreshes everything
- File watchers keep all tools in sync
## Available Tools (4 Total)
### 1. `setup_context`
Creates AI context files with smart defaults for your project.
```bash
# In Claude Code or via MCP
Use setup_context for the current directory
# Via CLI
npx mcp-context-manager setup_context .
```
**Features:**
- Auto-detects framework, language, and patterns
- Creates AI-CONTEXT.md and AI-PATTERNS.md
- Generates practical templates with real examples
### 2. `update_context`
Provides a comprehensive checklist for AI agents to analyze your codebase and update context files.
```bash
# Update everything with checklist
Use update_context for the current directory
# Update specific sections
Use update_context with sections: ["tech-stack", "patterns"]
```
**Features:**
- Generates detailed checklists for AI agents to complete
- Auto-detection mode analyzes entire codebase systematically
- Section-specific updates for targeted changes
- Validation steps ensure accuracy and completeness
### 3. `persist_context`
Enables automatic context loading in AI tools.
```bash
# Auto-detect and setup all tools
Use persist_context for the current directory
# Setup specific tools
Use persist_context with tools: ["cursor", "claude-code", "copilot"]
```
**Features:**
- Creates tool-specific config files
- For Claude Code: Creates CLAUDE.md with references to context files
- Sets up file watching for sync
- Installs git hooks for freshness checks
### 4. `figma_to_code`
Converts Figma designs to production-ready code.
```bash
# Quick mode (recommended)
Use figma_to_code with mode: "quick"
# Detailed mode for comprehensive guide
Use figma_to_code with mode: "detailed"
```
**Features:**
- Essential Figma MCP integration instructions
- Framework-specific code generation
- Accessibility and responsive design guidelines
- 95%+ visual fidelity methodology
## Installation for Claude Desktop
Add to your Claude Desktop config:
```json
{
"mcpServers": {
"mcp-context-manager": {
"command": "npx",
"args": ["mcp-context-manager"]
}
}
}
```
## Common Workflows
### New Project Setup
```bash
# 1. Create context files
npx mcp-context-manager setup_context .
# 2. Review and customize the generated files
# 3. Enable auto-loading
npx mcp-context-manager persist_context .
```
### After Major Changes
```bash
# Update context
npx mcp-context-manager update_context .
# Git will remind you automatically
git commit -m "Add new feature"
# ⚠️ AI Context files are over 7 days old!
```
### Figma to Code Conversion
```bash
# Get quick instructions
npx mcp-context-manager figma_to_code --mode quick
# Get detailed guide
npx mcp-context-manager figma_to_code --mode detailed
```
## What Gets Created
```
your-project/
├── AI-CONTEXT.md # Main context file
├── AI-PATTERNS.md # Code patterns and examples
├── CLAUDE.md # References to context files (by persist_context)
├── .cursorrules # Cursor config (if enabled)
├── .github/
│ └── copilot-instructions.md # Copilot config (if enabled)
└── .git/hooks/
└── pre-commit # Context freshness check (if enabled)
```
## Benefits
✅ **Consistent AI Responses**: Every session starts with full context
✅ **No More Repetition**: Stop explaining your project repeatedly
✅ **Better Code Suggestions**: AI follows your patterns and conventions
✅ **Team Alignment**: Everyone's AI uses the same context
✅ **Time Saving**: No context switching or explanation overhead
## FAQ
**Q: How is this different from just using a README?**
A: It automatically loads in AI tools, maintains consistency across different assistants, and provides structured templates optimized for AI understanding.
**Q: Does it work with all AI tools?**
A: Yes! It has specific integrations for Claude Code, Cursor, Copilot, and Continue, but the context files can be read by any AI assistant.
**Q: How often should I update context?**
A: Update when you add major features, change architecture, or modify coding standards. Git hooks will remind you if context gets stale.
**Q: Is my code sent anywhere?**
A: No. Everything stays local. This tool only creates and manages markdown files in your project.
## Example Usage in Claude Code
Once installed, you can use natural language:
```
"Set up AI context for this project"
"Update the context files with recent changes"
"Make context persist across all my AI tools"
"Help me convert this Figma design to React code"
```
## Requirements
- Node.js 16+
- Git (for hooks feature)
- An AI coding assistant
## Contributing
Contributions welcome! Please read our contributing guidelines first.
## License
MIT
**Making AI assistants actually understand your codebase.**