Matryoshka
by yogthos·★ 134·Score 48
MCP server for analyzing documents larger than context windows using recursive language models and symbolic commands.
Overview
Matryoshka is an innovative MCP server that enables analysis of documents up to 100x larger than a language model's context window. Instead of traditional RAG or chunking approaches, it uses a Recursive Language Model (RLM) approach where the LLM outputs symbolic commands in a specialized Nucleus DSL that are executed by a logic engine. This architecture reduces token usage by 97%+ and maintains document-wide context without vector databases. The server provides two MCP interfaces: one with full LLM orchestration and another exposing direct Nucleus commands for programmatic access.
Try asking AI
After installing, here are 5 things you can ask your AI assistant:
When to choose this
Choose Matryoshka when you need to analyze very large documents that exceed your LLM's context window, especially when traditional chunking or vector database approaches lose important connections across document sections.
When NOT to choose this
Don't choose Matryoshka if you need fine-grained control over individual document chunks or require advanced metadata preservation that goes beyond its symbolic language capabilities.
Tools this server exposes
9 tools extracted from the READMElattice_loadLoad a document for analysis
lattice_queryExecute Nucleus commands on the loaded document
lattice_expandExpand a handle to see full data with optional limit/offset
lattice_memoStore arbitrary context as a memo handle
lattice_memo_deleteDelete a stale memo to free memory
lattice_closeClose the session and free memory
lattice_statusGet session status, document info, and memo usage
lattice_bindingsShow current variable bindings and memo labels
lattice_resetReset all bindings and clear the current document
Comparable tools
Installation
Install from npm:
pnpm add -g matryoshka-rlmOr run without installing:
npx matryoshka-rlm "How many ERROR entries are there?" ./server.logFor Claude Desktop integration, create claude_desktop_config.json with:
{
"mcpServers": {
"matryoshka": {
"command": "npx",
"args": ["matryoshka-rlm", "mcp"]
}
}
}FAQ
- How does Matryoshka handle documents larger than context window?
- It uses a recursive language model approach where the LLM outputs symbolic commands that are executed by a logic engine against the full document, eliminating the need for chunking.
- What is the Nucleus DSL?
- Nucleus is a constrained symbolic language based on S-expressions designed specifically for document analysis. It provides commands like grep, filter, and sum that the LLM can output to manipulate document data.
Compare Matryoshka with
Last updated · Auto-generated from public README + GitHub signals.