contextsliver

contextsliver

An MCP server that indexes codebases into a local graph and provides on-demand context retrieval for AI coding agents, reducing token usage by tracking session history and delivering only relevant code subgraphs.

Category
Visit Server

README

ContextSliver

On-demand context management for AI coding agents. Stop reading whole files — ask for the connected subgraph instead.

<p align="center"> <img src="assets/hero-banner.jpg" alt="ContextSliver — from chaos to clarity: on-demand code context for AI agents" width="800"> </p>

CI License: MIT npm version

The problem

When you ask an AI coding agent (Claude Code, Cursor, Cline) to "fix the bug in AuthService," it repeatedly reads entire files to find the 5% that's relevant — burning 40,000–80,000 tokens on a question that needed ~3,000.

find . -name "*.ts"   → 2,000 tokens (a file listing)
cat AuthService.ts    → 3,000 tokens (whole file)
grep -r "AuthService" → 5,000 tokens (40 matches)
cat AuthMiddleware.ts → 2,500 tokens (whole file, again)
... × 10 more ...

Existing tools don't fully fix it: Graphify dumps one enormous whole-repo map into context up front; Repomix packs the entire repo into one file; Aider's repo-map sends a whole-repo summary with every message. None of them track what the agent has already seen this session.

What ContextSliver does

ContextSliver runs as a background MCP server on your machine. It indexes your codebase into a local SQLite graph of every function, class, and import. When the agent needs context, it calls an MCP tool instead of reading files:

Agent:   "What connects to AuthService? Budget: 2,000 tokens."

ContextSliver:
  symbol:        AuthService  (src/auth/AuthService.ts)
  callers:       [AuthMiddleware, LoginController]      ← who uses it
  dependencies:  [UserRepository, TokenService]         ← what it uses
  already_in_context: [UserRepository]                  ← skipped, agent already has it
  // ~380 tokens

Three things make it different:

  1. On-demand pruning — never sends the whole graph, only the connected subgraph for the task.
  2. Session ledger — tracks what the agent has already seen and skips re-sending it.
  3. One-command setupnpx contextsliver init. No database server, no API key.

Quickstart

# In your project root:
npx contextsliver init      # creates .sliver/, .mcp.json, CLAUDE.md, indexes the repo
npx contextsliver start     # runs the MCP server + file watcher (stdio)

Then restart Claude Code / Cursor / Cline — they'll pick up the five tools automatically. See the templates for client-specific config.

The five MCP tools

Tool What it does Typical tokens
cs_index_repo Trigger a full re-index ~50
cs_get_context Symbol definition + immediate connections ~300–800
cs_blast_radius All callers + dependents up to N hops ~500–2,000
cs_search_symbols Full-text search across indexed symbols ~200–600
cs_index_status Index health, file count, last-updated ~100

Pass the session_id from your first cs_get_context call to every subsequent call to enable deduplication.

Supported languages

  • TypeScript / JavaScript / TSX (v0.1)
  • Python (v0.1)
  • Go, Rust, Java — planned (see roadmap)

Adding a language = add a grammar package + a grammars/<lang>/tags.scm query + a fixture. See CONTRIBUTING.md.

How it works

Your codebase  ──chokidar──▶  Parser (Tree-sitter)  ──▶  SQLite graph (.sliver/index.db)
                                                                    │
                              MCP server (stdio) ◀──────────────────┘
                                    │   session ledger (.sliver/sessions.db)
                                    ▼
                          Claude Code / Cursor / Cline
  • Parser: Tree-sitter extracts symbols + imports per file.
  • Graph engine: stores symbol→symbol edges; bidirectional BFS (blastRadius) for blast radius with cycle detection.
  • Session manager: per-session ledger computes deltas so already-sent context is skipped.
  • MCP server: exposes the five tools over stdio.

Token counting

Counts use gpt-tokenizer (cl100k_base) and are labeled ~approximate — close enough for budget guidance, not billing.

Development

npm install
npm test            # unit + integration tests
npm run test:bench  # indexing benchmarks
npm run build       # tsc → dist/
npm run lint        # eslint

Requires Node ≥ 20.

Roadmap

  • v0.1 ✅ TS/JS + Python, SQLite graph, session ledger, 5 tools, CLI, watcher
  • v0.2 — incremental indexing polish, Cursor integration, CI benchmarks
  • v0.3 — Go + Rust, monorepo workspace resolution, language-plugin docs
  • v0.4 — PreToolUse hook, Java, published token-reduction benchmarks
  • v0.5 — Streamable HTTP transport, DuckDB backend for 50k-file repos, PageRank ranking
  • v1.0 — frozen API, optional native (napi-rs) engine, SCIP/LSP precision backend

See contextsliver-spec.md for the full specification.

License

MIT © Muneeb Ur Rehman

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured