Skip to content

Repository files navigation

image

InContext

InContext is a project-native memory and execution layer for coding agents. It gives Codex, Claude, Cursor, or any MCP-compatible client a shared project registry, portable summaries, architecture context, local resume hashes, local git-backed execution, and auditable commit history.

What is implemented

  • Google OAuth with Auth.js and Prisma
  • GitHub OAuth support for browser and CLI login
  • Multi-project registry with per-project ownership and memberships
  • Prisma-backed dashboards for project context, infrastructure, and access scopes
  • Project APIs for listing projects, reading context, creating summaries, and queueing commit intents
  • MCP stdio server with project/context tools
  • Direct local git commit execution for queued intents, gated by env flags and per-project settings
  • Local incontext CLI with browser login, project linking, handoff save, resume hashes, and local MCP mode
  • Per-project shared workspace board with multiple agent nodes, one notebook, and activity logs
  • Project CRUD with unique-safe slug renaming

Stack

  • Next.js 16
  • React 19
  • Prisma 7 + PostgreSQL
  • Auth.js / NextAuth v5 beta
  • shadcn/ui
  • MCP TypeScript SDK

Local setup

  1. Install dependencies
npm install
  1. Copy envs
Copy-Item .env.example .env
  1. Run Prisma migration if needed
npm run db:migrate
  1. Start the app
npm run dev
  1. Start the MCP server in another terminal when needed
npm run mcp:server
  1. Or use the local CLI-first workflow
npm run cli -- help
  1. For a global developer install of the command from this repo
npm run cli:link
incontext help
  1. Or run the deployable MCP HTTP server
npm run mcp:http

Required envs

Put these in .env:

DATABASE_URL="postgresql://app_user:app_password@your-pooled-host/incontext?schema=public"
DIRECT_URL="postgresql://app_user:app_password@your-direct-host/incontext?schema=public"
AUTH_SECRET="replace-with-a-long-random-secret"
AUTH_GITHUB_ID="your-github-oauth-client-id"
AUTH_GITHUB_SECRET="your-github-oauth-client-secret"
AUTH_GOOGLE_ID="your-google-oauth-client-id"
AUTH_GOOGLE_SECRET="your-google-oauth-client-secret"
AUTH_TRUST_HOST="true"
DIRECT_GIT_COMMITS_ENABLED="false"
GIT_PROJECTS_ROOT="E:\\context-git"
MCP_PORT="8787"
MCP_AUTH_TOKEN=""
MCP_ALLOWED_ORIGINS=""

Use:

  • DATABASE_URL for the app runtime connection
  • DIRECT_URL for Prisma CLI and migrations when your provider gives you a separate direct connection

If your provider only gives you one PostgreSQL URL, you can set both values to the same connection string.

OAuth setup

Use a GitHub or Google OAuth app.

Google callback:

http://localhost:3000/api/auth/callback/google

GitHub callback:

http://localhost:3000/api/auth/callback/github

If you deploy this, use the deployed host with the same callback paths.

CLI workflow

The preferred individual-user workflow is:

  1. Login from terminal:
npx incontext-cli install --ide codex
npm run cli -- login --app-url https://your-vercel-domain
  1. Link the current repo:
incontext project link your-project-slug
  1. Save a handoff:
incontext handoff save --title "Session handoff" --content "..."
  1. Resume later:
incontext resume <hash>
  1. Capture an observation or inspect the current project:
incontext capture --title "Session observation" --content "What changed, what is blocked, what should be promoted later."
incontext view
  1. Start the local MCP bridge for agents:
incontext mcp serve

Only add --allow-project-create if that agent session should be able to create a missing project.

Optional health and install checks:

incontext status
incontext doctor
  1. Export or import a snapshot when you need portability:
incontext export --project your-project-slug --output ./your-project.json
incontext import --file ./your-project.json --mode new
  1. Open the shared workspace for a project:
/dashboard/projects/<project-slug>

That workspace gives you:

  • multiple agent nodes on a React Flow canvas
  • one shared notebook per project
  • activity logs showing who updated the project context
  • edit/delete controls for the project itself

See CLI.md for the full local workflow.

The CLI source and package metadata live in packages/cli. That package is shaped for future npx incontext-cli ... usage, while repo-local development uses npm run cli -- ... or npm run cli:link.

The package is now published on npm as incontext-cli.

Copyable MCP config for Codex, Claude Code, or Cursor:

{
  "mcpServers": {
    "incontext": {
      "command": "npx",
      "args": ["incontext-cli", "mcp", "serve"]
    }
  }
}

MCP server

The local stdio MCP entrypoint is:

src/mcp/server.ts

The deployable HTTP MCP entrypoint is:

src/mcp/http-server.ts

Available MCP capabilities:

  • list_projects
  • get_project_detail
  • get_project_context
  • create_project
  • add_project_summary
  • queue_commit_intent
  • execute_commit_intent

The local incontext mcp serve command also exposes:

  • create_project
  • get_current_project
  • get_project_workspace
  • search_project_memory
  • timeline_project_activity
  • get_context_entries
  • capture_project_observation
  • list_project_observations
  • promote_project_observation
  • register_project_agent
  • update_shared_notebook
  • resume_project
  • add_handoff
  • update_progress
  • record_decision
  • commit_and_push

It also exposes:

  • resource: incontext://projects
  • prompt: project-handoff

For public or semi-public HTTP deployment, set:

  • MCP_AUTH_TOKEN to require Authorization: Bearer <token>
  • MCP_ALLOWED_ORIGINS to a comma-separated allowlist such as https://your-app.vercel.app,https://your-domain.com

Project APIs

  • GET /api/projects
  • POST /api/projects
  • GET /api/projects/[slug]
  • GET /api/projects/[slug]/context
  • POST /api/projects/[slug]/summaries
  • POST /api/projects/[slug]/commits
  • POST /api/projects/[slug]/commits/[commitId]/execute

All project APIs now require an authenticated session.

Direct commit bridge

Queued commit intents can be executed against a local repository only when all of these are true:

  • DIRECT_GIT_COMMITS_ENABLED="true"
  • GIT_PROJECTS_ROOT is set
  • the project has repoLocalPath
  • the project has directCommitEnabled = true
  • the queued intent targets the branch currently checked out in that repo
  • the queued intent includes explicit relative file paths

This is intentionally strict. It is designed to be auditable and harder to misuse.

Deployment

Recommended production split:

  1. Vercel for the frontend app
  2. Railway for the optional hosted MCP HTTP server
  3. Neon for PostgreSQL

Both deployments should share the same PostgreSQL database.

Deploy both services from the repository root. Do not configure either platform to use a frontend/ subdirectory.

See DEPLOY.md for the full Vercel + Railway setup.

Vercel build

This repo includes:

postinstall = prisma generate
vercel-build = prisma generate && node ./src/scripts/prisma-migrate-deploy-safe.mjs && next build

Current limitations

  • Token storage is scaffold-level, not production-grade secret vaulting
  • Direct commit execution is local-repo only, not remote GitHub push/PR automation
  • Password auth is still placeholder-only
  • Approval UI for queued commit execution is not built yet

Useful commands

npm run dev
npm run build
npm run db:migrate
npm run db:generate
npm run db:studio
npm run mcp:server

About

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages