{"id":30812722,"url":"https://github.com/doobidoo/mcp-context-provider","last_synced_at":"2026-03-08T23:02:11.006Z","repository":{"id":310987064,"uuid":"1041954162","full_name":"doobidoo/MCP-Context-Provider","owner":"doobidoo","description":"A static MCP server that provides AI models with persistent tool context, preventing context loss between chats.","archived":false,"fork":false,"pushed_at":"2026-02-23T21:14:53.000Z","size":26022,"stargazers_count":24,"open_issues_count":0,"forks_count":6,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-24T02:53:58.913Z","etag":null,"topics":["anthropic","automation","configuration","desktop-extension","developer-tools","devops","dxt","llm","mcp-servers","memory","productivity","workflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doobidoo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-21T09:04:20.000Z","updated_at":"2026-02-23T21:14:57.000Z","dependencies_parsed_at":"2025-09-17T03:14:41.190Z","dependency_job_id":"1849340a-d65a-40e4-8d00-36dd33001b7b","html_url":"https://github.com/doobidoo/MCP-Context-Provider","commit_stats":null,"previous_names":["doobidoo/mcp-context-provider"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/doobidoo/MCP-Context-Provider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doobidoo%2FMCP-Context-Provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doobidoo%2FMCP-Context-Provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doobidoo%2FMCP-Context-Provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doobidoo%2FMCP-Context-Provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doobidoo","download_url":"https://codeload.github.com/doobidoo/MCP-Context-Provider/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doobidoo%2FMCP-Context-Provider/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30276606,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T20:45:49.896Z","status":"ssl_error","status_checked_at":"2026-03-08T20:45:49.525Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anthropic","automation","configuration","desktop-extension","developer-tools","devops","dxt","llm","mcp-servers","memory","productivity","workflow"],"created_at":"2025-09-06T07:08:45.583Z","updated_at":"2026-03-08T23:02:10.999Z","avatar_url":"https://github.com/doobidoo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCP Context Provider v2\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"assets/MCP-CONTEXT-PROVIDER.png\" alt=\"MCP Context Provider Architecture\" width=\"600\"/\u003e\n\n  *Persistent context that survives across sessions. Static rules flow alongside learned instincts, creating an ever-improving knowledge core for your AI interactions.*\n\u003c/div\u003e\n\nA TypeScript engine that provides AI models with **persistent context** and **learned instincts** across sessions. Two core concepts work together:\n\n- **Contexts** (static) - Manually authored tool-specific rules (200-1000 tokens), always injected at full confidence\n- **Instincts** (learned) - Distilled from sessions, confidence-scored (0.0-1.0), human-approved before activation\n\n## Quick Start\n\n### Prerequisites\n\n- Node.js \u003e= 20\n- npm\n\n### Installation\n\n```bash\ngit clone https://github.com/doobidoo/MCP-Context-Provider.git\ncd MCP-Context-Provider\n\nnpm install\nnpm run build\n```\n\n### Verify\n\n```bash\nnpm run lint    # Type-check\nnpm test        # 61 tests across 5 suites\n```\n\n## Architecture\n\n```mermaid\ngraph TD\n    E[Engine] --\u003e C[Contexts\u003cbr/\u003e\u003ci\u003estatic\u003c/i\u003e]\n    E --\u003e I[Instincts\u003cbr/\u003e\u003ci\u003elearned\u003c/i\u003e]\n\n    C --\u003e CL[\"JSON *_context.json\u003cbr/\u003eglob tool matching\u003cbr/\u003epriority-sorted\"]\n    I --\u003e IL[\"YAML *.instincts.yaml\u003cbr/\u003eregex trigger patterns\u003cbr/\u003econfidence-scored\"]\n\n    CL --\u003e IP[InjectionPayload\u003cbr/\u003e\u003ccode\u003econtext_rules + instinct_rules\u003c/code\u003e]\n    IL --\u003e IP\n\n    IP --\u003e MB[\"Memory Bridge\u003cbr/\u003e\u003ci\u003eoptional\u003c/i\u003e\u003cbr/\u003emcp-memory-service sync\"]\n\n    style E fill:#4f46e5,stroke:#3730a3,color:#fff,font-weight:bold\n    style C fill:#0891b2,stroke:#0e7490,color:#fff\n    style I fill:#d97706,stroke:#b45309,color:#fff\n    style CL fill:#e0f2fe,stroke:#0ea5e9\n    style IL fill:#fef3c7,stroke:#f59e0b\n    style IP fill:#10b981,stroke:#059669,color:#fff,font-weight:bold\n    style MB fill:#6366f1,stroke:#4f46e5,color:#fff\n```\n\n```mermaid\ngraph LR\n    subgraph CLI[\"CLI (mcp-cp)\"]\n        A[approve] --\u003e R[Registry]\n        RJ[reject] --\u003e R\n        T[tune] --\u003e R\n        O[outcome] --\u003e R\n    end\n\n    R --\u003e YML[\"*.instincts.yaml\"]\n    YML --\u003e ENG[Engine]\n    ENG --\u003e INJ[Injection]\n\n    subgraph Bridge[\"Memory Bridge\"]\n        SYNC[\"sync ↔ memory\"]\n        DISC[\"discover related\"]\n    end\n\n    YML --\u003e SYNC\n    SYNC --\u003e MEM[(mcp-memory-service)]\n\n    style CLI fill:#f8fafc,stroke:#94a3b8\n    style Bridge fill:#f8fafc,stroke:#94a3b8\n    style ENG fill:#4f46e5,stroke:#3730a3,color:#fff\n    style MEM fill:#6366f1,stroke:#4f46e5,color:#fff\n    style INJ fill:#10b981,stroke:#059669,color:#fff\n```\n\n### Three Subsystems\n\n| Subsystem | Purpose |\n|-----------|---------|\n| **Engine** | Loads, matches, and merges contexts + instincts into injection payloads |\n| **CLI** (`mcp-cp`) | Approval registry for instinct lifecycle management |\n| **Memory Bridge** | Syncs instincts to mcp-memory-service via HTTP API |\n\n## Contexts\n\nStatic tool-specific rules stored as JSON in `/contexts`. The engine discovers all `*_context.json` files automatically.\n\n### Tool Pattern Matching\n\nContexts are matched to tools using glob-style patterns:\n\n| Pattern | Matches |\n|---------|---------|\n| `*` | All tools |\n| `git:*` | All git tools (`git:commit`, `git:push`, ...) |\n| `bash:git` | Only `bash:git` (exact) |\n| `git` | Category-level: matches `git:commit`, `git:push`, etc. |\n\n### Context Structure\n\n```json\n{\n  \"tool_category\": \"git\",\n  \"description\": \"Git commit conventions and workflow patterns\",\n  \"metadata\": {\n    \"version\": \"1.0.0\",\n    \"priority\": \"high\",\n    \"applies_to_tools\": [\"git:*\", \"bash:git\"]\n  },\n  \"syntax_rules\": { ... },\n  \"preferences\": { ... },\n  \"auto_corrections\": { ... }\n}\n```\n\nContexts are sorted by priority (`high` \u003e `medium` \u003e `low`) when multiple match.\n\n## Instincts\n\nLearned rules distilled from sessions, stored as YAML in `/instincts`.\n\n### Instinct Structure\n\n```yaml\nversion: \"1.0\"\ninstincts:\n  - id: git-conventional-commits\n    rule: \"Use conventional commit format: type(scope): description\"\n    domain: git\n    tags: [commit, convention]\n    trigger_patterns:\n      - \"git commit\"\n      - \"commit message\"\n    confidence: 0.85\n    min_confidence: 0.5\n    active: true\n    approved_by: human\n    outcome_log:\n      - timestamp: \"2026-03-08T10:00:00Z\"\n        event: approved\n        delta_confidence: 0.1\n```\n\n### Key Properties\n\n- **Confidence** (0.0-1.0): How reliable this instinct is, adjusted by outcomes\n- **min_confidence**: Threshold below which the instinct won't fire\n- **approved_by**: Must be `human` for activation (or `auto` for draft)\n- **outcome_log**: Tracks every approval, rejection, and outcome event with confidence deltas\n\n### The `/instill` Skill\n\nUse the `/instill` Claude Code skill to extract instincts from your current session:\n\n1. Analyzes session for recurring patterns\n2. Extracts candidate instincts with quality gates (20-80 tokens, non-trivial)\n3. Presents candidates for your approval\n4. Persists approved instincts to YAML\n\n## CLI: Approval Registry (`mcp-cp`)\n\nZero-dependency ANSI-formatted CLI for managing the instinct lifecycle.\n\n```bash\n# List all instincts with confidence bars\nmcp-cp list\n\n# Show detailed view of an instinct\nmcp-cp show git-conventional-commits\n\n# Human approval (activates the instinct)\nmcp-cp approve git-conventional-commits\n\n# Reject (deactivates, lowers confidence by 0.3)\nmcp-cp reject git-conventional-commits\n\n# Tune parameters\nmcp-cp tune git-conventional-commits --confidence 0.9\nmcp-cp tune git-conventional-commits --min-confidence 0.6\nmcp-cp tune git-conventional-commits --tags \"commit,git,convention\"\n\n# Record outcomes (adjusts confidence)\nmcp-cp outcome git-conventional-commits + \"Worked well in PR review\"\nmcp-cp outcome git-conventional-commits - \"Too strict for hotfix commits\"\n\n# Remove an instinct entirely\nmcp-cp remove git-conventional-commits\n```\n\n## Engine API\n\n```typescript\nimport { Engine } from 'mcp-context-provider';\n\nconst engine = new Engine({\n  contextsPath: './contexts',\n  instinctsPath: './instincts',\n});\n\nawait engine.initialize();\n\n// Build injection payload for a specific tool + input\nconst payload = engine.buildInjection('git:commit', 'writing a commit message');\n// → { context_rules: [...], instinct_rules: [...] }\n```\n\n## Memory Bridge (Optional)\n\nSyncs instincts bidirectionally with [mcp-memory-service](https://github.com/doobidoo/mcp-memory-service) for persistent storage, semantic discovery, and cross-session learning.\n\n```typescript\nconst engine = new Engine({\n  contextsPath: './contexts',\n  instinctsPath: './instincts',\n  memoryBridge: {\n    baseUrl: 'http://127.0.0.1:8000/api',\n    apiKey: process.env.MCP_API_KEY,\n    enabled: true,\n  },\n});\n\nawait engine.initialize();\nawait engine.connectMemory();   // Health check + connect\nawait engine.syncToMemory();    // Push instincts to memory service\nawait engine.discoverInstincts('typescript patterns'); // Semantic search\n```\n\n### Bridge Capabilities\n\n- **Push/Pull Sync**: Upsert instincts from YAML to memory and back\n- **Orphan Detection**: Find memories without corresponding YAML files\n- **Semantic Discovery**: Search for related instincts by meaning, not just keywords\n- **Tagged Storage**: Instincts stored with `instinct`, `instinct-id:\u003cid\u003e`, domain, and custom tags\n\n## Project Structure\n\n```\nsrc/\n  types/              TypeScript type definitions\n    instinct.ts       Instinct, OutcomeEntry, InstinctCandidate, InstinctQuery\n    context.ts        Context, StoreTrigger, RetrieveTrigger, ContextMetadata\n    index.ts          Re-exports\n  schema/             Zod validation schemas\n    instinct.schema.ts\n    context.schema.ts\n  engine/             Core engines\n    engine.ts         Unified Engine (contexts + instincts + memory bridge)\n    context-loader.ts JSON context discovery + validation\n    context-matcher.ts Tool-pattern matching with glob support\n    instinct-loader.ts YAML load/save with Zod validation\n    instinct-matcher.ts Regex trigger-pattern matching\n  bridge/             Memory Bridge (mcp-memory-service integration)\n    types.ts          IMemoryBridge interface, config, response types\n    http-bridge.ts    HTTP implementation (fetch-based, zero deps)\n    sync.ts           Bidirectional YAML \u003c-\u003e Memory sync\n  cli/                Approval Registry CLI (mcp-cp)\n    index.ts          CLI entry point + argument parser\n    registry.ts       approve/reject/tune/outcome/remove operations\n    formatter.ts      ANSI terminal formatting\n\ninstincts/            YAML instinct files (*.instincts.yaml)\ncontexts/             JSON context files (*_context.json)\n.claude/skills/       Claude Code skills\n  instill.md          /instill - distill instincts from session\n```\n\n## Development\n\n```bash\nnpm run build       # Compile TypeScript\nnpm run dev         # Watch mode\nnpm run lint        # Type-check (tsc --noEmit)\nnpm test            # Run tests (vitest)\nnpm run test:watch  # Watch mode tests\n```\n\n### Tech Stack\n\n- **TypeScript** (strict mode, ES2022, Node16 modules)\n- **Zod** for runtime schema validation\n- **yaml** for YAML parsing\n- **vitest** for testing\n- Zero runtime dependencies beyond `yaml` and `zod`\n\n## Migration from v1.x\n\nv2 is a complete rewrite from Python to TypeScript. Key changes:\n\n| v1.x (Python) | v2.x (TypeScript) |\n|---|---|\n| Python MCP server | TypeScript engine library |\n| JSON context files only | JSON contexts + YAML instincts |\n| Static rules | Learned rules with confidence scoring |\n| Phase 1/2/3 learning system | Instinct Engine with Memory Bridge |\n| DXT packaging | npm package |\n| `pip install` | `npm install` |\n\n**Context files from v1.x** (`*_context.json`) are fully compatible with v2 - just copy them to the `contexts/` directory.\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature/new-context`\n3. Make your changes with tests\n4. Run `npm test` and `npm run lint`\n5. Submit a pull request\n\n## License\n\nApache License 2.0 - see [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoobidoo%2Fmcp-context-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoobidoo%2Fmcp-context-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoobidoo%2Fmcp-context-provider/lists"}