MCP Context Provider
This server gives Claude persistent, cross-session context and learned instincts via MCP.
Manage static contexts: get tool-specific context, syntax rules, list available contexts, and apply auto-corrections.
Build combined injection payloads (contexts + instincts) for a given tool and input.
Manage instincts: list, store new candidates, approve, reject, and record outcomes with confidence changes.
Run as either stdio or HTTP MCP server, configurable via environment variables, with optional memory-bridge sync.
Use the
mcp-cpCLI for instinct lifecycle management: list, show, approve, reject, tune confidence, record outcomes, import, and print the resolved store path.Install as a Claude Code plugin or
/instillskill, and optionally use the auto-trigger hook to suggest distilling sessions into instincts.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Context Provider load my GitHub workflow preferences and Jira syntax rules"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 transportCLI (
mcp-cp) — approval registry for instinct lifecycle managementMemory Bridge — optional sync of instincts and contexts to mcp-memory-service
Related MCP server: Central Brain
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 PATHWithout 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
argsandenvvalues. Claude Code does not support thecwdfield 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-providerThe 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 startsdist/server/index.js. Runnpm install && npm run buildin 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_PATHto its owninstincts/folder instead of the user-level default described under Store Location.list_instinctsreports 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.mdThen 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.jsRegister 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
Tool | Description |
| Get complete context for a tool category |
| Get syntax-specific rules for a tool |
| List all loaded contexts |
| Apply correction patterns to text |
| Combined context + instinct injection payload |
| List all instincts with confidence scores, plus the resolved store path |
| Store a new instinct candidate (inactive until approved) |
| Approve an instinct for active use (sets |
| Deactivate an instinct and lower its confidence |
| Record a positive, negative, or neutral outcome for an instinct |
| Push all local instincts to the memory service (requires the memory bridge) |
| Push all loaded contexts to the memory service |
| Pull contexts from the memory service into |
Environment Variables
Variable | Default | Description |
| packaged | Path to |
|
| Directory holding |
| — | Memory service base URL (enables bridge) |
| — | API key for memory service |
|
| HTTP server port (only with |
|
| Write a repaired instinct file back to disk (a |
Store Location
The instincts store never depends on the directory the MCP host happened to launch the server from. It resolves in this order:
INSTINCTS_PATH— explicit override, always wins./instincts— only when the working directory is anmcp-context-providercheckout (the development case)$XDG_DATA_HOME/mcp-context-provider/instincts— whenXDG_DATA_HOMEis set~/.local/share/mcp-context-provider/instincts— the default
Contexts resolve the same way, except the fallback is the contexts/ directory
shipped with the package: contexts are authored and versioned with the code,
instincts are learned user data.
To see which store is active:
mcp-cp path # prints the resolved directory
node dist/server/index.js # logs both paths to stderr at startupThe resolved path is also part of the list_instincts response (store.path,
store.resolved_from) and of the /health payload in HTTP mode.
If the resolved store sits inside a git working tree that is not this repository's checkout, the server warns at startup — that is the signal it picked up a working directory by accident and that learned instincts are about to be committed somewhere they do not belong.
Merging a store from elsewhere:
mcp-cp import /path/to/learned.instincts.yaml --dry-run # preview
mcp-cp import /path/to/learned.instincts.yaml # mergeThe merge always targets the canonical learned.instincts.yaml.
Existing ids are never overwritten — a merge only adds. Legacy file shapes
(top-level array, or instincts: as a list) are normalized on read.
Context Sync
Contexts can be pushed to mcp-memory-service and written back on another
machine. Requires MEMORY_BRIDGE_URL.
sync_contexts— push every loaded context. One memory per context: a one-line summary as the searchable content, the exact file text inmetadata.payload.restore_contexts— pull them and write intoCONTEXTS_PATH. Files that already exist are left untouched and reported;force: trueoverwrites and keeps a.bak.
A context is not pushed if its metadata.sync is false. Contexts in
subdirectories of CONTEXTS_PATH are never loaded and therefore never pushed
— that is where private, machine-local contexts belong.
A push replaces the remote copy by deleting it and storing the same content
again. From 12.4.0 on, mcp-memory-service refuses to re-create content it has a
delete on record for unless the client asks for it; the bridge sends
restore_deleted: true with every store, so repeated syncs of unchanged
content keep exactly one memory per context. Verified against
mcp-memory-service 12.10.0.
If the service runs on HTTPS with a certificate from a private CA (mkcert, for
example), point Node at the CA file with NODE_EXTRA_CA_CERTS, and set
MEMORY_BRIDGE_API_KEY when the service requires a key.
A context whose serialized metadata exceeds mcp-memory-service's Cloudflare sync limit is refused at push time, with the size and limit named in the error, rather than being accepted locally and silently dropped before it reaches the durable tier.
Context Files
Contexts are JSON files in contexts/*_context.json. Each file matches one or more tools via glob patterns and injects static rules.
{
"tool_category": "git",
"description": "Git workflow rules",
"auto_convert": false,
"metadata": {
"version": "1.0.0",
"applies_to_tools": ["git:*", "Bash"],
"priority": "high"
},
"syntax_rules": { ... },
"auto_corrections": {
"fix-1": { "pattern": "...", "replacement": "..." }
}
}Add a new context by dropping a *_context.json file in contexts/ and restarting the server.
Instincts
Instincts live in exactly one file, learned.instincts.yaml, inside the
resolved store (see Store Location). They are distilled from
sessions via /instill. A candidate stored through store_instinct starts
inactive and is injected only after approve_instinct or mcp-cp approve.
Any other *.instincts.yaml in that directory is not read. It is reported
by name at startup and by mcp-cp list, together with the mcp-cp import
command that merges it — so a second file can never drift into the store
unnoticed, and no instinct is ever loaded from a file you did not intend.
version: "1.0"
instincts:
my-rule:
id: my-rule
rule: "Compact, actionable rule (20–80 tokens)."
domain: git
tags: [git, workflow]
trigger_patterns:
- "git commit"
confidence: 0.75
min_confidence: 0.5
approved_by: human
active: true
created_at: "2026-03-10T00:00:00Z"
outcome_log: []Manage instincts with the CLI:
mcp-cp list
mcp-cp show <id>
mcp-cp approve <id>
mcp-cp reject <id>
mcp-cp tune <id> --confidence 0.8
mcp-cp outcome <id> + "worked well"
mcp-cp remove <id>
mcp-cp path
mcp-cp import <file> [--dry-run]Development
npm run build # Compile TypeScript
npm run dev # Watch mode
npm run lint # Type-check only
npm test # Run tests (vitest)
npm start # stdio transport
npm run start:http # HTTP transport on port 3100FAQ
Can I use /instill in Claude Desktop?
Not as a slash command: /instill ships as a Claude Code skill
(.claude/skills/instill.md). The instinct lifecycle itself is available in
Claude Desktop, because it runs through the MCP server:
All MCP tools work in both clients.
store_instinctsaves a candidate as inactive,approve_instinctactivates it,reject_instinctandrecord_outcomemaintain it. No file editing is involved, and the server validates every entry.For the analysis step, create a Claude Desktop Project and paste the instructions from
instill.mdas Custom Instructions. Claude then proposes candidates from the conversation and stores the ones you accept withstore_instinct.
Do not let a client write learned.instincts.yaml directly when the MCP tools
are reachable. Hand-written YAML is where malformed store files have come from.
The analysis is a skill and not an MCP tool because it is an interactive, multi-step workflow (read the conversation, present candidates, wait for your decision). An MCP tool returns one response and cannot drive that exchange.
Do learned.instincts.yaml files contain sensitive data?
Potentially yes. Instincts distilled from work sessions may contain internal hostnames, customer names, infrastructure details, or operational procedures.
This is why the default store is a user-level directory outside any repository
(~/.local/share/mcp-context-provider/instincts) and why the server warns when
the resolved store sits inside an unrelated git working tree. If you do point
INSTINCTS_PATH at a checkout, add instincts/learned.instincts.yaml to that
repository's .gitignore and review its contents before pushing. The Quick
Start examples point it at this repository's instincts/ folder, where the
file is already ignored. Leaving INSTINCTS_PATH out selects the user-level
default, unless the server is started from inside this checkout, where
./instincts still wins (see Store Location).
The same applies to the Memory Bridge: sync_instincts sends the rule text,
trigger patterns and tags of every instinct to the configured
mcp-memory-service. Only sync to a service you trust with that content.
What is the difference between Contexts and Instincts?
Contexts | Instincts | |
Format | JSON ( | YAML ( |
Source | Manually authored | Distilled from sessions via |
Size | 200-1000 tokens | 20-80 tokens (target; 5-120 accepted) |
Matching | Tool-pattern globs | Regex trigger patterns |
Lifecycle | Static, versioned | Confidence-scored, evolves over time |
Approval | None needed | Candidates start inactive until approved |
What decides whether an instinct is injected is active and its confidence
against min_confidence. approved_by records who approved it (human or
auto) and is not checked at injection time. An entry added to the YAML by
hand without active: false is therefore live immediately; active defaults
to true.
Changelog
See CHANGELOG.md.
License
Apache-2.0 — see LICENSE.
Available Tools
13 toolsapply_auto_correctionsC
Apply auto-correction patterns from matching contexts to text
Inputs: text (required), tool_name (required).
approve_instinctA
Approve an instinct for active use (sets approved_by to human)
Inputs: id (required).
build_injectionB
Build a complete injection payload (contexts + instincts) for a tool/input combination
Inputs: tool (required), input (required).
get_syntax_rulesC
Get syntax-specific rules for a tool category
Inputs: tool_name (required).
get_tool_contextA
Get complete context (rules, syntax, preferences) for a specific tool
Inputs: tool_name (required).
list_available_contextsA
List all loaded context categories and their descriptions
Inputs: no named parameters.
list_instinctsA
List loaded instincts with filtering and pagination. Returns {total, matched, returned, offset, store, items} where store reports the resolved instincts directory and how it was resolved. Use include_rules=false for compact listings when many instincts are loaded (MCP client UIs may truncate large responses around 40-50KB).
Inputs: tag, limit, domain, offset, +2 more.
record_outcomeB
Record a positive, negative, or neutral outcome for an instinct
Inputs: id (required), delta (required), result (required), note.
reject_instinctA
Reject/deactivate an instinct and lower its confidence
Inputs: id (required).
restore_contextsB
Pull contexts from mcp-memory-service and write them into CONTEXTS_PATH. Existing files are left untouched unless force is true, which keeps a .bak of the previous file.
Inputs: force.
store_instinctA
Store a new instinct candidate. Created as inactive with auto approval — use approve_instinct for human approval.
Inputs: id (required), rule (required), tags (required), domain (required), +3 more.
sync_contextsA
Push all loaded contexts to mcp-memory-service. A context with metadata.sync false is skipped. Requires the memory bridge to be configured and connected.
Inputs: no named parameters.
sync_instinctsA
Push all local YAML instincts to mcp-memory-service. Requires memory bridge to be configured and connected.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Most tools target clearly distinct resources and actions, especially the instinct lifecycle versus context synchronization. Some overlap exists between get_tool_context, get_syntax_rules, and build_injection, since all retrieve or assemble context-related information, but the descriptions make their intended scopes reasonably separable.
All tool names use consistent snake_case with clear verb_noun or verb_adjective_noun patterns. The verbs and resource nouns are predictable and easy to parse across instincts, contexts, and rule operations.
With 13 tools, the server is well-scoped for context and instinct management without feeling bloated. Each tool maps to a distinct part of the workflow: listing, syncing, approving, rejecting, storing, recording outcomes, and building payloads.
The surface covers the main instinct lifecycle and context synchronization workflows, including approval, rejection, outcome recording, and injection building. Minor gaps exist, such as no obvious get_instinct or explicit instinct update/delete operation beyond approval/rejection, but core workflows are covered.
Maintenance
Related MCP Connectors
Persistent context for Claude. Your AI always knows your projects and next actions across sessions.
Bring your saved preferences, project decisions, and useful context into your next AI conversation.
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Shared work memory for Claude Code, Codex, Cursor and chat, scoped to each repository.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceAutomatically injects development framework context and workflows into Claude conversations, ensuring Claude follows your established patterns without manual context provision each time. Supports custom frameworks, keyword triggers, and Knowledge Graph integration.-
- AlicenseNot gradedqualityDmaintenanceProvides persistent memory for Claude Code, automatically extracting and surfacing relevant context from past sessions to avoid re-explaining issues and decisions.MIT
- AlicenseAqualityCmaintenancePersistent knowledge base tools for Claude Code that store project context, decisions, and patterns locally across sessions, eliminating cold starts.8182 PyPIMIT
- AlicenseAqualityCmaintenanceGives Claude persistent, local context about how you work, your weekly agenda, and shipped work, with automatic work logging and git integration—all stored privately on your machine.12MIT