ContextPrism
Enriches git diffs with structural signatures of modified files, providing context-aware code change analysis.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ContextPrismGenerate a skeleton context of my project's src folder"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ContextPrism (prism)
ContextPrism distills codebases into high-density AST skeletons for AI coding agents (Claude Code, Cursor, Codex, OpenCode, Antigravity).
Instead of sending full implementation bodies, loop iterations, and boilerplate to LLM context windows, ContextPrism extracts interfaces, type definitions, class schemas, exported function signatures, and docstrings.
┌─────────────────────────┐
│ Raw Codebase │
│ (100,000+ tokens) │
└───────────┬─────────────┘
│
[ ContextPrism ]
(AST Distillation)
│
┌───────────▼─────────────┐
│ Distilled Context │
│ (~15,000 tokens) │
│ - 70% to 85% Savings │
│ - 100% Type Contracts │
└─────────────────────────┘Key Features
Multi-Language AST Distillation: Native parsers for TypeScript, JavaScript, Python, Go, Rust, and generic C-family languages.
Token Budget Allocator: Specify
--budget 8000to dynamically compress non-target files while keeping focused files at full fidelity.Multi-Format Context: Generate Anthropic/Gemini XML
<codebase>, standard Markdown, compact plain text, or structured JSON.Built-in Model Context Protocol (MCP): Run
prism mcpto connect directly with Cursor, Claude Desktop, and Antigravity.AST-Enriched Git Diffs: Run
prism diffto pair git diffs with structural signatures of modified files.Local Web Visualizer: Run
prism uito launch an interactive dashboard with live code comparison and token metrics.
Related MCP server: CodeXRay
Installation
Run directly with npx or install globally:
# Direct execution without install
npx contextprism pack
# Global install
npm install -g contextprismQuick Start
1. Pack Codebase into an AI Context Prompt
# Default XML format for Claude or Gemini
prism pack
# Save to file
prism pack -o context.xml
# Set a strict 10,000 token budget
prism pack --budget 10000 -o prompt.xml
# Focus on specific files while skeletonizing the rest
prism pack --focus src/auth/login.ts -o prompt.xml
# Export as Markdown
prism pack -f markdown -o context.md2. View Token Footprint Tree
prism treeOutput:
├── src/
│ ├── ast/
│ │ ├── extractor.ts [222 tokens] (skeleton)
│ │ └── ts-parser.ts [163 tokens] (skeleton)
│ ├── core/
│ │ ├── budgeter.ts [408 tokens] (skeleton)
│ │ └── scanner.ts [720 tokens] (skeleton)
Total: 34 files, 15.0k distilled tokens (33.6k raw)3. Inspect a Single File Skeleton
prism ast src/ast/ts-parser.tsOutput:
// ContextPrism AST Skeleton: src/ast/ts-parser.ts
// Tokens: 163 tokens (was 1.8k tokens, -91%)
import ts from 'typescript';
export interface TsSkeletonOptions {
preserveDocstrings?: boolean;
preserveImports?: boolean;
preservePrivateMembers?: boolean;
}
export function extractTsSkeleton(code: string, fileName = 'source.ts', options: TsSkeletonOptions = {}): string { /* ... */ }4. Benchmark Token Savings
prism benchOutput:
┌────────────────────────┬─────────────┬─────────────┬──────────────┬─────────────┐
│ Compression Mode │ Total Size │ Est. Tokens │ Token Saving │ Claude Cost │
├────────────────────────┼─────────────┼─────────────┼──────────────┼─────────────┤
│ 1. Raw Source Code │ 101.7 KB │ 33.6k tokens │ 0% │ $0.100668 │
│ 2. Light (No Comments) │ 101.6 KB │ 33.5k tokens │ 0% │ $0.100542 │
│ 3. AST Skeleton │ 45.0 KB │ 15.0k tokens │ 55% │ $0.045045 │
│ 4. Types & Interfaces │ 26.4 KB │ 9.1k tokens │ 73% │ $0.027291 │
└────────────────────────┴─────────────┴─────────────┴──────────────┴─────────────┘5. Launch Interactive Web Dashboard
prism uiOpens a local web interface at http://localhost:4100 with real-time token gauges, side-by-side AST comparison, and one-click context generation.
MCP Server Configuration
Add ContextPrism as a tool server in your claude_desktop_config.json, Cursor, or Antigravity MCP settings:
{
"mcpServers": {
"context-prism": {
"command": "npx",
"args": ["-y", "contextprism", "mcp"]
}
}
}Exposed MCP Tools
Tool | Parameters | Description |
|
| Returns AST-distilled codebase context |
|
| Returns structural skeleton of a single file |
|
| Returns token-annotated project directory tree |
Programmatic API
You can use ContextPrism directly in your own scripts:
import { scanDirectory, applyTokenBudget, packageCodebase, extractTsSkeleton } from 'contextprism';
// 1. Scan directory
const files = scanDirectory('./src');
// 2. Distill with token budget
const budgetResult = applyTokenBudget(files, {
budgetTokens: 8000,
defaultLevel: 'skeleton',
focusFiles: ['src/index.ts']
});
// 3. Format as XML prompt
const xmlPrompt = packageCodebase(budgetResult, { format: 'xml' });
console.log(xmlPrompt);Supported File Types
Language | Extracted AST Elements |
TypeScript / JS | Interfaces, type aliases, enums, class structures, method signatures, exports, JSDoc |
Python | Classes, method signatures, decorators, type hints, docstrings, top-level constants |
Go | Package headers, struct definitions, interfaces, function signatures |
Rust | Structs, enums, traits, impl blocks, method signatures |
JSON | Structure schemas, compacted large arrays, key maps |
Generic (C/C++, Java, PHP, C#) | Class headers, method signatures, public declarations |
Development
# Clone repository
git clone https://github.com/mewsyy/context-prism.git
cd context-prism
# Install dependencies
npm install
# Run tests
npm test
# Build package
npm run buildLicense
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceEnables AI agents to efficiently read Python code by first providing file skeletons then fetching only needed implementations, reducing noise and cost.3MIT
- Alicense-qualityCmaintenanceEnables AI coding agents to query a pre-built semantic knowledge graph of code, reducing token usage and tool calls. Supports 16 tools for code exploration, analysis, and context building.167MIT
- AlicenseBqualityAmaintenanceEnables LLMs to efficiently read, write, and refactor code using precise AST-based operations, reducing token usage and context window waste.25573MIT
- Alicense-qualityAmaintenanceEnables AI coding agents to efficiently query code context via a symbol graph, reducing token usage by up to 20x.1,303467Inno Setup
Related MCP Connectors
Provide your AI coding tools with token-efficient access to up-to-date technical documentation for…
SaaS intelligence for AI agents. 5 unified tools cover 1,000+ services with 91-96% token savings.
AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mewsyy/context-prism'
If you have feedback or need assistance with the MCP directory API, please join our Discord server