Repeated context is expensive
Large prompts, full repositories, tool schemas, and growing chat history consume the context window before the agent can make real progress.
OCP is an open protocol for sharing retrievable context, persistent state, and invalidation events across AI agents, models, frameworks, and organisations. It layers on top of MCP — every OCP server is an MCP server, every OCP client is an MCP client.
Most agent workflows repeatedly rediscover the same project knowledge. They scan files again, ask for rules again, and lose useful state when the session ends.
Large prompts, full repositories, tool schemas, and growing chat history consume the context window before the agent can make real progress.
Checkpoints, agent handoffs, and session restores should be protocol-level primitives — not something each framework reinvents from scratch.
Teams should not recreate the same context layer separately for every IDE, model, agent, or workflow tool. One open protocol serves all of them.
MCP provides transport and tool-call mechanics. OCP adds the context layer on top — workspaces, scoped state, session coordination, and invalidation events. Every OCP server is a valid MCP server.
Standard tool-call and server-discovery mechanics. OCP exposes itself as an MCP server so any compatible client works out of the box.
Workspaces with k-NN search, typed scoped state (agent / session / global), session coordination with checkpoints, and real-time invalidation events.
Agent A and Agent B can connect to the same OCP server — same or different process — and share context safely through scoped namespaces.
If you already run an MCP-compatible IDE or runtime, you already have everything you need to connect to an OCP server.
OCP is not a replacement for MCP. It is a protocol layer that sits above transport to give agents durable, retrievable, multi-agent-safe context — and now automatic model routing.
Index repos, docs, and ticket archives. Query by intent with k-NN search across pluggable embedding backends.
Store and retrieve typed values at agent, session, or global scope. Namespaced, not a global blob.
Agent handoff, checkpoints, and restore. Pick up exactly where another agent left off — across processes.
Real-time notifications when files change or state updates, so agents never work from stale context.
Routes simple tasks to a local model. Complex reasoning escalates to your paid provider. Works in any MCP-compatible IDE.
Index project knowledge, chunk it by meaning, retrieve what matters, and keep useful state available for future agent steps.
Detect file and document changes without repeatedly reprocessing everything.
Understand code structure at the level of symbols, modules, and useful boundaries.
Create small context blocks that can be reused across agent steps.
Represent meaning so agents can search by task intent, not just keywords.
Keep vectors, metadata, permissions, and freshness state together.
Return the smallest useful context for the current question.
Run directly from PyPI with uvx, or install permanently. Requires Python 3.11+.
OCP_DATABASE_URL. A Docker Compose file is included in the repo.
ghcr.io/rajesh1213/ocp:latest
RFC draft at spec/OCP-0001.md in the repo · CC-BY 4.0
Copy-paste config snippets exist for the most common runtimes. Full guide in docs/integrations.md.
Add to .mcp.json in the project root.
Add to claude_desktop_config.json.
Add to .cursor/mcp.json — Cursor picks it up automatically.
Remote agents connect via Docker over SSE. Pass env vars in the container.
Swap backends without changing your application code.
pip install fastembed
Semantic
OCP_EMBEDDER=openai + OPENAI_API_KEY
Semantic
OCP_DATABASE_URL · Docker Compose included
Production
The numbers below illustrate the shape of the savings using a worked scenario, not a measured benchmark. They show why a retrieval layer matters structurally.
Agents retrieve focused context instead of receiving the full codebase every step.
Reducing repeated input leaves more room for multi-step planning and execution.
The indexing cost is amortised across many future sessions and agents.
A medium codebase, one agent step. Output tokens not included.
| Component | Without OCP | With OCP | Notes |
|---|---|---|---|
| Codebase dump | 65,000 | 0 | Replaced by retrieved chunks |
| Retrieved chunks | 0 | ~2,200 | Fetched on demand per step |
| Tool schemas | 12,000 | 600 | Only called tools included |
| System prompt | 2,000 | 400 | No code context needed in prompt |
| Session summary | 0 | 300 | Replaces growing history |
| Conversation history | 3,000 | 600 | Offloaded to session state |
| Total per step | 82,000 | 3,700 | −95.5% |
| Cost per 100 steps | $24.60 | $1.11 | $23.49 saved |
| Steps before 200k limit | 2 | 54 | 27× more |
OCP is designed to be a practical open context layer — not a closed memory silo tied to any model provider, agent framework, or cloud vendor.
RFC draft at spec/OCP-0001.md. CC-BY 4.0. Any team can implement or extend it.
Self-hosted, single-binary install. Apache-2.0. Inspect, run, and adapt it freely — no cloud dependency for the core server.
Works across hosted models, local models, IDEs, and any MCP-compatible client — today and with future clients you haven't tried yet.
Because OCP sits in the retrieval path, every chunk of context an agent used can be logged, attributed, and audited. That makes it a natural foundation for AI Act compliance work — which is where a paid governance layer comes in later.
Minimal, vendor-neutral surface — endpoints, scopes, session state. RFC draft at spec/OCP-0001.md.
Free, self-hosted, single-binary install. Inspect and adapt freely. 44/44 conformance tests passing.
Plugs into any MCP-compatible IDE or agent runtime. Config snippets for Claude Code, Claude Desktop, and Cursor.
Paid layer for compliance trails, risk flags, and regional checks. Context first — compliance follows naturally.