Context Harness
Local-first context ingestion and retrieval for AI tools. SQLite + embeddings + MCP server for Cursor & Claude.
What is Context Harness?
Context Harness is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to local-first context ingestion and retrieval for ai tools. sqlite + embeddings + mcp server for cursor & claude.
Local-first context ingestion and retrieval for AI tools. SQLite + embeddings + MCP server for Cursor & Claude.
This server falls under the Knowledge & Memory category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Local-first context ingestion and retrieval for AI tools. SQ
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx context-harnessConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Context Harness
Context Harness is a local-first context ingestion and retrieval system that indexes your files, Git repositories, and S3 buckets into a SQLite database with vector embeddings, then exposes a Model Context Protocol server so Cursor and Claude can semantically search your stored context. It supports hybrid keyword/semantic search with configurable weighting and multiple embedding providers including OpenAI, Ollama, and local models. Developers use it to give AI assistants persistent, searchable knowledge of their codebases and documentation without sending data to a third-party cloud index.
Prerequisites
- A pre-built Context Harness binary for your OS (macOS, Linux, or Windows) or Rust toolchain to build from source
- OpenAI API key (if using OpenAI embeddings) set as OPENAI_API_KEY, or a local Ollama instance
- AWS credentials (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) if using the S3 connector
- An MCP-compatible client such as Claude Desktop or Cursor
Install the Context Harness binary
Download and install the pre-built binary for your platform. For macOS Apple Silicon run the curl command below. For other platforms, substitute the appropriate release artifact from the GitHub releases page.
curl -L https://github.com/parallax-labs/context-harness/releases/latest/download/ctx-macos-aarch64.tar.gz | tar xz
sudo mv ctx /usr/local/bin/Create a ctx.toml configuration file
In your project root, create a ctx.toml file that configures your embedding provider, retrieval settings, and connectors. The example below uses OpenAI embeddings and indexes the current directory.
[embedding]
provider = "openai"
model = "text-embedding-3-small"
dims = 1536
[retrieval]
hybrid_alpha = 0.5
[server]
bind = "127.0.0.1:7331"
[[connectors.filesystem]]
root = "."
include_globs = ["**/*.md", "**/*.ts", "**/*.py", "**/*.rs"]Set required environment variables
Export your OpenAI API key before running Context Harness. If you are using the S3 connector, also export your AWS credentials.
export OPENAI_API_KEY=sk-...Ingest and embed your content
Run sync to ingest documents from your configured connectors, then embed any pending documents to build the vector index.
ctx sync filesystem
ctx embed pendingStart the MCP server
Launch the MCP HTTP server so your AI client can connect to it and perform semantic search queries.
ctx serve mcpConfigure your MCP client
Add Context Harness to your Claude Desktop or Cursor configuration pointing at the running HTTP MCP endpoint.
Context Harness Examples
Client configuration
Add this to your claude_desktop_config.json to connect Claude Desktop to the running Context Harness MCP server.
{
"mcpServers": {
"context-harness": {
"command": "ctx",
"args": ["serve", "mcp"],
"env": {
"OPENAI_API_KEY": "sk-your-key-here"
}
}
}
}Prompts to try
Once connected, use these prompts to search your indexed context from Claude.
- "Search my codebase for all authentication-related functions and summarize how they work"
- "Find all markdown documentation about the API endpoints"
- "What files handle database migrations in this project?"
- "Show me code related to error handling patterns"Troubleshooting Context Harness
ctx serve mcp exits immediately or refuses connections
Check that the bind address in ctx.toml (default 127.0.0.1:7331) is not already in use. Also confirm that ctx embed pending has completed before starting the server.
Embedding fails with authentication error
Ensure OPENAI_API_KEY is exported in the same shell session where you run ctx commands, or set it in your shell profile. For Ollama, verify the Ollama daemon is running locally.
Search returns no results after sync
Run ctx embed pending to generate embeddings for newly synced documents. Sync only ingests the raw content; embeddings must be generated separately before search works.
Frequently Asked Questions about Context Harness
What is Context Harness?
Context Harness is a Model Context Protocol (MCP) server that local-first context ingestion and retrieval for ai tools. sqlite + embeddings + mcp server for cursor & claude. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Context Harness?
Follow the installation instructions on the Context Harness GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Context Harness?
Context Harness works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Context Harness free to use?
Yes, Context Harness is open source and available under the AGPL-3.0 license. You can use it freely in both personal and commercial projects.
Context Harness Alternatives — Similar Knowledge & Memory Servers
Looking for alternatives to Context Harness? Here are other popular knowledge & memory servers you can use with Claude, Cursor, and VS Code.
MemPalace
★ 52.6kA local AI memory system that stores all conversations verbatim and organizes them into navigable structures. It provides 19 MCP tools for AI assistants to search and retrieve past decisions, debugging sessions, and architecture debates automatically
Kratos
★ 25.7k🏛️ Memory System for AI Coding Tools - Never explain your codebase again. MCP server with perfect project isolation, 95.8% context accuracy, and the Four Pillars Framework.
Context Mode
★ 15.4kAn MCP server that preserves LLM context by intercepting large data outputs and returning only concise summaries or relevant sections. It enables efficient sandboxed code execution, file processing, and documentation indexing across multiple programm
Memu
★ 13.7kMemory for 24/7 proactive agents like OpenClaw.
MemOS
★ 9.3kMemOS (Memory Operating System) is a memory management operating system designed for AI applications. Its goal is: to enable your AI system to have long-term memory like a human, not only remembering what users have said but also actively invoking, u
Everos
★ 5.4kBuild, evaluate, and integrate long-term memory for self-evolving agents.
Browse More Knowledge & Memory MCP Servers
Explore all knowledge & memory servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Context Harness in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Context Harness?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.