MCP Context Provider
Status: beta — feature-complete, API stabilizing. See CHANGELOG.md for the latest release.
https://github.com/user-attachments/assets/d9c6c325-00f1-44d9-a805-b1d6588c0acf
Persistent context and learned instincts for Claude Desktop and Claude Code — surviving across sessions.
A TypeScript MCP server that gives Claude persistent Contexts (static tool rules) and Instincts (learned, confidence-scored rules distilled from sessions). No more re-establishing context in every new chat.
Architecture
Two core concepts:
| Concept | Description | Size | Lifetime |
|---|
| Context | Static tool rules, syntax preferences, auto-corrections | 200–1000 tokens | Permanent, manually authored |
| Instinct | Learned rule extracted from sessions, confidence-scored | 20–80 tokens | Inactive until approved, evolves over time |
Four subsystems:
- Engine — loads, matches, and merges contexts + instincts into injection payloads
- MCP Server (
src/server/index.ts) — stdio + HTTP transport
- CLI (
mcp-cp) — approval registry for instinct lifecycle management
- Memory Bridge — optional sync of instincts and contexts to mcp-memory-service
Quick Start
git clone https://github.com/doobidoo/MCP-Context-Provider.git
cd MCP-Context-Provider
npm install
npm run build
npm link # optional: puts mcp-cp and mcp-context-provider on your PATH
Without npm link, run the CLI as node dist/cli/index.js wherever this
README says mcp-cp.
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"context-provider": {
"command": "node",
"args": ["/path/to/mcp-context-provider/dist/server/index.js"],
"env": {
"CONTEXTS_PATH": "/path/to/mcp-context-provider/contexts",
"INSTINCTS_PATH": "/path/to/mcp-context-provider/instincts"
}
}
}
}
Claude Code (global)
Add to ~/.claude.json under mcpServers:
{
"mcpServers": {
"context-provider": {
"command": "node",
"args": ["/path/to/mcp-context-provider/dist/server/index.js"],
"env": {
"CONTEXTS_PATH": "/path/to/mcp-context-provider/contexts",
"INSTINCTS_PATH": "/path/to/mcp-context-provider/instincts"
}
}
}
}
Important: Use absolute paths for both args and env values. Claude Code does not support the cwd field in MCP server configs — relative paths will resolve from the wrong directory and the server will fail to connect.
Claude Code Plugin (Marketplace)
Install directly from the marketplace:
/plugin marketplace add doobidoo/MCP-Context-Provider
/plugin install context-provider@mcp-context-provider
The plugin registers the MCP server with paths inside the plugin directory, so
there is no config file to edit. Two things to know:
- Build it once. The repository does not ship the compiled server
(
dist/ is not checked in), and the plugin starts
dist/server/index.js. Run npm install && npm run build in the installed
plugin directory, below ~/.claude/plugins/, then restart Claude Code.
Repeat after a plugin update.
- The store is in the plugin directory. The plugin sets
INSTINCTS_PATH to
its own instincts/ folder instead of the user-level default described under
Store Location. list_instincts reports the path in use.
/instill Skill (Claude Code)
Install the skill globally (stays current with git pull):
mkdir -p ~/.claude/skills/instill
ln -s /path/to/mcp-context-provider/.claude/skills/instill.md ~/.claude/skills/instill/SKILL.md
Then use /instill at the end of productive sessions to distill learned patterns into instinct candidates.
Auto-Trigger Hook (Optional)
The instill-trigger hook automatically detects mistakes during a session and nudges Claude to suggest /instill when a threshold is reached. It monitors:
- User corrections (UserPromptSubmit) — "no not that", "that's wrong", "still broken", etc.
- Tool failures (PostToolUse) — non-zero exit codes, tracebacks, permission errors
Install the hook:
cp hooks/instill-trigger.js ~/.claude/hooks/core/instill-trigger.js
Register in ~/.claude/settings.json under both UserPromptSubmit and PostToolUse:
{
"type": "command",
"command": "node --no-warnings \"~/.claude/hooks/core/instill-trigger.js\"",
"timeout": 3
}
Scoring: Corrections weighted 1.5x, tool failures 0.5x. Combined threshold: 3.0. Max 1 nudge per session. All tunable via CONFIG object in the hook file.
MCP Tools