๐ง Advanced MCP server that gives Claude Desktop project-aware capabilities. Features include auto-discovery, Git integration, hierarchical memory, file watching, and CLAUDE.md instruction support.
MCP Project Context Manager
A powerful Model Context Protocol (MCP) server that provides Claude Desktop with Claude Code-like project context management, file-based persistent memory, and comprehensive search capabilities.
๐ Key Features
๐ง File-Based Memory System (Claude Code-like)
- Hierarchical CLAUDE.md files for persistent memory storage
- Always in context - no search required, memories are immediately available
- @import system for including external files
- Memory hierarchy: Enterprise > Project > User > Local
๐ Enhanced Search Capabilities
- Search ALL text files - not just code files
- Includes:
.md
,.json
,.yaml
,.xml
,.env
,.txt
,.log
,.csv
,.html
,.css
,.svg
- Advanced pattern matching with regex support
- Context lines for better understanding
- Symbol search across multiple languages
- TODO/FIXME comment tracking
๐ Smart Working Directory Detection
- Automatic project root detection - handles Claude Desktop's exe folder issue
- Environment variable support (
PROJECT_ROOT
) - Git repository detection
- Automatic
process.chdir()
to correct directory
๐ Comprehensive Tool Set
- File Operations: read, write, edit, delete, move, create directories
- Multi-file Operations: read multiple files simultaneously
- Git Integration: status, diff, add, commit
- Search Tools: code search, symbol search, TODO search
- Memory Management: add memories, list recent memories, reload memories
๐ฆ Installation
- Clone the repository:
cd C:\
git clone <repository-url> mcp-project-context
cd mcp-project-context
- Install dependencies:
npm install
- Build the project:
npm run build
โ๏ธ Configuration
Add to your Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/claude/claude_desktop_config.json
{
"mcpServers": {
"project-context": {
"command": "node",
"args": ["C:\\mcp-project-context\\dist\\enhancedIndex.js"],
"env": {
"PROJECT_ROOT": "C:\\your-project-directory",
"NODE_ENV": "production"
}
}
}
}
Configuration Notes:
- PROJECT_ROOT: Specify your project directory (tool auto-detects if not set)
- enhancedIndex.js: The enhanced version with all new features
- Tool automatically handles working directory issues
๐ CLAUDE.md Memory System
Create CLAUDE.md
files in your project for persistent memory:
Root CLAUDE.md Example
# Project Memory
## Project Standards
- Use TypeScript with strict mode
- Follow ESLint configuration
- Write tests for all features
## Architecture Notes
- Frontend: React + TypeScript
- Backend: Node.js + Express
- Database: PostgreSQL
## Recent Decisions
- 2025-01-07: Migrated to file-based memory system
- 2025-01-06: Added WebRTC for video chat
@import ./docs/API.md
@import ./docs/DATABASE.md
Memory Hierarchy
- Enterprise:
C:\CLAUDE.md
- Organization-wide knowledge - Project:
C:\project\CLAUDE.md
- Project-specific information - User:
%USERPROFILE%\CLAUDE.md
- Personal preferences - Local:
.\CLAUDE.md
- Current directory context
๐ง Available Tools
File Operations
read_file
- Read single fileread_multiple_files
- Read multiple files at oncewrite_file
- Write content to fileedit_file
- ENHANCED Smart text replacement with 5 strategies- EXACT: Traditional exact match (default)
- FUZZY: Handles whitespace/formatting differences
- SECTION: Edit between headers (perfect for markdown/docs)
- LINES: Edit specific line ranges
- PATTERN: Regex-based replacements
- BETWEEN: Edit content between markers
delete_file
- Delete filesmove_file
- Move or rename filescreate_directory
- Create new directorieslist_directory
- List directory contents
Search Tools (Enhanced)
search_code
- Search in ALL text files (not just code)- Pattern matching (text or regex)
- File type filtering
- Context lines
- Gitignore respect
search_symbols
- Find function/class definitionssearch_todos
- Find TODO/FIXME/NOTE comments
Git Operations
git_status
- Check repository statusgit_diff
- View changesgit_add
- Stage filesgit_commit
- Create commits
Memory & Context
get_context
- Get project context with memoryadd_memory
- Add to CLAUDE.mdadd_quick_memory
- Quick note (like # in Claude Code)list_recent_memories
- Show recent memory entriesget_memory_status
- Check memory file statusreload_memories
- Reload if edited externally
๐ก Usage Examples
Adding Memory
// Add important project decision
add_memory("Decided to use WebSockets for real-time updates", ["architecture", "websocket"])
Enhanced Search
// Search in ALL files including configs, docs, etc.
search_code({
pattern: "API_KEY",
contextLines: 2
})
// Now finds matches in .env, .json, .yaml, etc.!
Smart Edit Examples
// 1. FUZZY - Handles whitespace differences
edit_file("README.md", "## Configuration", "## Setup", {
strategy: "fuzzy"
})
// 2. SECTION - Edit markdown sections
edit_file("README.md",
{ sectionStart: "## Configuration", sectionEnd: "## Usage" },
"New configuration content...",
{ strategy: "section" }
)
// 3. LINES - Edit specific lines
edit_file("app.js",
{ startLine: 10, endLine: 15 },
"// New code here",
{ strategy: "lines" }
)
// 4. PATTERN - Regex replacements
edit_file("*.js",
{ pattern: /console\.log\(/g },
"logger.debug(",
{ strategy: "pattern" }
)
// 5. BETWEEN - Edit between markers
edit_file("template.html",
{
startMarker: "<!-- BEGIN CONTENT -->",
endMarker: "<!-- END CONTENT -->"
},
"<div>New content</div>",
{ strategy: "between" }
)
Reading Multiple Files
read_multiple_files({
paths: ["package.json", "README.md", ".env"]
})
๐ Performance
- Working Directory Detection: <100ms
- Memory Loading: Instant (always in context)
- Search Operations: <500ms for typical projects
- Multi-file Read: Parallel processing
- Context Generation: <1 second with caching
๐ Project Structure
mcp-project-context/
โโโ src/
โ โโโ enhancedIndex.ts # Main enhanced server
โ โโโ discovery/ # Project analysis
โ โโโ storage/
โ โ โโโ fileBasedMemoryManager.ts # File-based memory
โ โโโ context/
โ โ โโโ enhancedContextManager.ts # Enhanced context
โ โโโ search/
โ โ โโโ codeSearcher.ts # Enhanced search (all files)
โ โโโ handlers/ # MCP handlers
โ โโโ utils/
โ โโโ workingDirectoryFix.js # Auto directory detection
โโโ dist/ # Compiled output
โโโ CLAUDE.md # Project memory
โโโ README.md
๐ Security & Privacy
- All data stored locally (no cloud sync)
- Sensitive file filtering
- Binary file exclusion
- Gitignore respect
- Safe file operations
๐ Troubleshooting
Working Directory Issues
If the tool starts in wrong directory:
- Set
PROJECT_ROOT
environment variable in config - Tool auto-detects git repositories
- Check logs for directory detection
Memory Not Loading
- Ensure CLAUDE.md exists in project root
- Check file permissions
- Use
reload_memories
tool
Search Not Finding Files
- Check if file type is in binary exclusion list
- Verify file is not gitignored
- Use specific file patterns
๐ Recent Improvements
Version 2.1.0 (January 2025)
- โ
Smart Edit System: 5 powerful editing strategies
- Fuzzy matching for whitespace tolerance
- Section-based editing for documentation
- Line range editing for precise changes
- Pattern/regex support for bulk replacements
- Between markers for template editing
- โ Enhanced error messages with similarity detection
- โ Backup support for safe editing
- โ Diff statistics for change tracking
Version 2.0.0 (January 2025)
- โ File-based memory system (replaced database)
- โ Enhanced search for ALL text files
- โ Working directory auto-detection
- โ Multi-file read operations
- โ Surgical file editing
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
MIT
๐ Support
For issues and questions, please open an issue on GitHub.