Open-source core for Context Engine. This package contains the database schema, session/project management logic, and MCP tool handlers that power the private deployment. Authentication, environment configuration, and deployment scripts live in the private repository.
src/business: Session and project context managerssrc/database: Schema definition, migrations, and pooled connection helpersrc/tools: MCPcontext.save,context.resume, andcontext.listhandlerssrc/types: Shared type definitionssrc/utils: Validation and logging helpers
- Token generation and validation services
- Fastify server, CLI utilities, or deployment scripts
- Environment configuration or secrets
The code compiles to a reusable library, but distribution is still constrained by MCP host policies:
- Warp is the only client confirmed to load Context Engine today.
- Claude Code, Codex, Kilocode, and similar IDE MCP integrations appear to block third-party endpoints in their sandboxes, so this server never receives their requests.
- Resume queries still need a SQL fix to handle legacy rows that lack
file_idvalues (seeSessionManager.retrieveFullSession).
For the full set of blockers and suggested next steps, see docs/known-limitations.md.
# install dependencies
yarn install # or npm install
# type checking
npm run typecheck
# build the library (outputs to dist/)
npm run buildConsumers can then import the managers and tool handlers:
import { SessionManager, ProjectManager } from 'context-engine-core';
import { DatabaseConnection } from 'context-engine-core';
const db = new DatabaseConnection({
url: process.env.DATABASE_URL!,
poolSize: 20,
timeout: 30000,
});
const sessionManager = new SessionManager(db);context-engine-core/
src/
business/
database/
migrations/
tools/
types/
utils/
demo/
package.json
tsconfig.json
The public package ships with a minimal Fastify server so contributors can exercise the core logic without the private authentication layer. The demo server uses a single demo token and user account.
-
Copy the environment template and adjust as needed:
cp .env.example .env
DEMO_AUTH_TOKENdefaults todemo-token. All requests must includeAuthorization: Bearer demo-tokenunless you setDEMO_AUTH_MODE=none.DATABASE_URLpoints to a local PostgreSQL instance by default.
-
Run the migrations:
npm run demo:migrate
-
Start the demo server:
npm run demo:server
The server listens on
http://127.0.0.1:8085by default. -
Try the endpoints:
curl -X POST http://127.0.0.1:8085/context/save \ -H "Content-Type: application/json" \ -H "Authorization: Bearer demo-token" \ -d '{ "session_name": "demo-session", "project_name": "demo-project", "files": [{"path": "README.md", "content": "# Demo"}], "conversation": [{"role": "user", "content": "Initial instructions"}], "metadata": {"tags": ["demo"]} }'
Issues and pull requests are welcome for the open-core logic. Please do not submit changes that require deployment secrets or internal infrastructure; those belong in the private repository.
Released under the MIT license.