agentsclimarketplace

Mcp daemon isolation

Skill chkim-su/forge-editor/skills/mcp-daemon-isolation

Context isolation for query-type MCP tools (LSP, search, database) via external CLI. Use when MCP query results consume too many context tokens.From its SKILL.md

Install
npx -y skills add chkim-su/forge-editor --skill mcp-daemon-isolation

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

5.7 KB, as published. Nobody here has run it

MCP Daemon Isolation for Query-Type MCPs

External CLI pattern for isolating query-type MCP tool results from main context.

Query-Type MCP Definition

TypeExamplesCharacteristics
Query-typeSerena (LSP), Database, SearchUnpredictable result size, potentially thousands of tokens
Action-typeFile write, Git, DeploySmall results, success/failure focused

Identification criteria: Tools with find_*, search_*, get_*, list_* patterns


Problem

Claude Session
├── mcp__serena__find_symbol("UserService")
│   └── Result: 2,500 tokens (full JSON)    ← CONSUMED
└── Context budget: rapidly depleting

Daemon isolates tool definitions (~350 tokens × tools), but results still consume context.


Solution: External CLI + Structured Extraction

Claude Session
├── Bash: serena-query find_symbol UserService
│   └── stdout: "• UserService [Class] @ src/user.py:42"
│       (~50 tokens)                      ← MINIMAL
└── Full result stored: /tmp/serena-result.json

Key insight: Claude IS the LLM. Structured extraction provides 95%+ token savings.


Architecture

┌──────────────┐     ┌──────────────────┐     ┌──────────────┐
│ Claude       │────▶│ serena-query     │────▶│ Serena       │
│ Session      │     │ (external CLI)   │     │ Daemon :8765 │
└──────────────┘     └──────────────────┘     └──────────────┘
     Bash (~50 tok)     SSE + MCP Protocol       29 tools

For protocol details: Read("references/mcp-sse-protocol.md")


Structured Extractors

ToolFull JSONExtracted OutputSavings
list_dir~800📁 Dirs(12): hooks... 📄 Files(11)95%
get_symbols_overview~1,200Class(2): Config... Function(5)96%
find_symbol~2,000• UserService [Class] @ src/user.py:42-9897%
search_for_pattern~1,500Matches(15) in 8 files95%

For formatter code: Read("references/extractors-and-examples.md")


Usage

Output Modes

serena-query find_symbol UserService                    # summary (default)
serena-query find_symbol UserService --mode location    # location only (for Read)
serena-query find_symbol UserService --mode full        # full JSON

Basic Commands

serena-query list_dir .
serena-query get_symbols_overview src/main.py --depth 1
serena-query find_symbol UserService --path src/
serena-query search_for_pattern "class.*Service" --path src/
serena-query find_symbol UserService --output /tmp/result.json

Optimal Workflow: Explore-Locate-Read

1. Explore (--mode summary)   ~25 tokens  "What symbols exist?"
2. Locate (--mode location)   ~15 tokens  "Where exactly is it?"
3. Read (Read tool)           actual size  Only needed code
Scenariostdio approachdaemon+ReadSavings
Class analysis~525~24054%
11 function analysis~4,300~66585%
Large-scale search~10,000+~50095%

For detailed examples: Read("references/extractors-and-examples.md")


Installation

pip install httpx
cp scripts/serena-query ~/.local/bin/
chmod +x ~/.local/bin/serena-query

Daemon Setup

uvx --from git+https://github.com/oraios/serena \
  serena start-mcp-server --transport sse --port 8765 --project-from-cwd

Decision: Structured vs LLM Summarization

AspectLLM SummarizationStructured Extraction
Latency+2-5 seconds~0ms
CostAPI call per queryZero
ConsistencyVariableDeterministic

Claude IS the LLM consuming the output - no need for additional summarization.


Isolation Strategy Guide

ScenarioRecommendedReason
Single symbol editstdioImmediate modification
Codebase explorationdaemonExpect large results
Reference trackingdaemon + locationOnly need locations
Refactoring planningdaemon + fullFull structure analysis

Common Issues

SymptomCauseSolution
"Received request before initialization"Missing handshakeinitialize → notifications/initialized → tools/call sequence
"Connection refused on 8765"Daemon not runningsystemctl --user start serena-daemon
"Empty result"Structure mismatchSave raw JSON with --output and verify

References

Implementation

Protocol & Examples

Related

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.