/ Verzeichnis / Playground / llm-context.py
● Community cyberchitta ⚡ Sofort

llm-context.py

von cyberchitta · cyberchitta/llm-context.py

Share just the right slice of your codebase with any LLM — rule-driven file selection, outlines, and on-demand fetches, not 'paste it all'.

llm-context.py is a rule-based code-sharing tool that exposes its output via MCP or clipboard. Instead of uploading your whole repo, you define composable rules (filter, instruction, style, excerpt) per task and ship a focused context. The MCP flavor lets the LLM ask for more files on demand.

Warum nutzen

Hauptfunktionen

Live-Demo

In der Praxis

llm-context-py.replay ▶ bereit
0/0

Installieren

Wählen Sie Ihren Client

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "llm-context-py": {
      "command": "uvx",
      "args": [
        "llm-context.py"
      ],
      "_inferred": true
    }
  }
}

Öffne Claude Desktop → Settings → Developer → Edit Config. Nach dem Speichern neu starten.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "llm-context-py": {
      "command": "uvx",
      "args": [
        "llm-context.py"
      ],
      "_inferred": true
    }
  }
}

Cursor nutzt das gleiche mcpServers-Schema wie Claude Desktop. Projektkonfiguration schlägt die globale.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "llm-context-py": {
      "command": "uvx",
      "args": [
        "llm-context.py"
      ],
      "_inferred": true
    }
  }
}

Klicken Sie auf das MCP-Servers-Symbol in der Cline-Seitenleiste, dann "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "llm-context-py": {
      "command": "uvx",
      "args": [
        "llm-context.py"
      ],
      "_inferred": true
    }
  }
}

Gleiche Struktur wie Claude Desktop. Windsurf neu starten zum Übernehmen.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "llm-context-py",
      "command": "uvx",
      "args": [
        "llm-context.py"
      ]
    }
  ]
}

Continue nutzt ein Array von Serverobjekten statt einer Map.

~/.config/zed/settings.json
{
  "context_servers": {
    "llm-context-py": {
      "command": {
        "path": "uvx",
        "args": [
          "llm-context.py"
        ]
      }
    }
  }
}

In context_servers hinzufügen. Zed lädt beim Speichern neu.

claude mcp add llm-context-py -- uvx llm-context.py

Einzeiler. Prüfen mit claude mcp list. Entfernen mit claude mcp remove.

Anwendungsfälle

Praxisnahe Nutzung: llm-context.py

Ship a focused code-review context to your LLM

👤 Developers tired of pasting 3000 lines ⏱ ~15 min intermediate

Wann einsetzen: You're about to ask 'review my auth module' and don't want the whole repo in context.

Voraussetzungen
  • llm-context.py installed — uv tool install 'llm-context>=0.6.0'
  • Initialized in your repolc-init in your repo root
Ablauf
  1. Create a filter rule for auth
    Create an lc filter rule 'flt-auth' that includes src/auth/** and src/middleware/auth*.ts.✓ Kopiert
    → Rule file created under .lc/
  2. Preview what the rule selects
    Run lc_preview on flt-auth — show me which files will be sent and total token count.✓ Kopiert
    → File list + token count
  3. Share context with the LLM via MCP
    Using the flt-auth rule, review the module for security issues. If you need to see a specific file not included, ask via lc_missing.✓ Kopiert
    → Review with targeted file requests

Ergebnis: A code review that fits in context and can still explore — no manual paste.

Fallstricke
  • Rule too narrow → LLM can't understand callers of your module — Include interface / types of neighboring modules, use outlines for the rest
  • Rule too broad → token budget blown — Start broad, watch lc_preview, tighten until under your client's limits
Kombinieren mit: filesystem

Give an LLM a structural map of a huge codebase

👤 Engineers onboarding to unfamiliar monorepos ⏱ ~20 min intermediate

Wann einsetzen: 100k+ LOC repo; you need orientation, not all the code.

Ablauf
  1. Generate outline
    lc_outlines for the whole repo — classes, top-level functions, exports per file. Skip bodies.✓ Kopiert
    → Skeletal outline with a few thousand lines
  2. Ask orientation questions
    Given the outline, where's the entry point, where's routing defined, and which files hold the data-layer abstractions?✓ Kopiert
    → Architectural answers
  3. Drill in on one area
    Show me the full contents of the three files that define routing via lc_missing.✓ Kopiert
    → Specific files expand into context

Ergebnis: A guided tour without ever pasting the whole repo.

Attach project style rules to every prompt

👤 Teams with specific conventions ⏱ ~10 min beginner

Wann einsetzen: You want Claude to always know 'we use pytest, not unittest' without repeating.

Ablauf
  1. Write a style rule
    Create sty-python rule: 'pytest only, type hints required, black formatting'.✓ Kopiert
    → Rule saved
  2. Apply automatically
    Use prm-default which composes flt-current + sty-python + ins-standards for every context.✓ Kopiert
    → Rule auto-attached

Ergebnis: Per-task conventions enforced without manual boilerplate.

Kombinieren mit: drift

Kombinationen

Mit anderen MCPs für 10-fache Wirkung

llm-context-py + drift

drift records conventions; llm-context pushes only relevant files + style rules per task

Load drift conventions for this repo, then use lc with rule flt-auth + sty-ts to review the auth module.✓ Kopiert
llm-context-py + filesystem

After reviewing, filesystem applies edits

Based on the llm-context review, use filesystem to apply the suggested edits to src/auth/.✓ Kopiert

Werkzeuge

Was dieses MCP bereitstellt

WerkzeugEingabenWann aufrufenKosten
lc_outlines rule?: str Orient on large codebases free (local)
lc_preview rule: str Before shipping context, verify scope free
lc_missing path: str LLM calls this mid-conversation to request a file free

Kosten & Limits

Was der Betrieb kostet

API-Kontingent
None
Tokens pro Aufruf
Depends entirely on your rule scope — that's the point
Kosten in €
Free, open source
Tipp
Always run lc_preview before lc_outlines/shipping context — one second of preview saves thousands of tokens.

Sicherheit

Rechte, Secrets, Reichweite

Credential-Speicherung: None
Datenabfluss: Only to whichever LLM client/provider you pipe context into

Fehlerbehebung

Häufige Fehler und Lösungen

No rules found

Run lc-init in repo root to create .lc/ scaffolding.

Prüfen: ls .lc/
lc_preview token count surprisingly high

Your filter is too loose or includes generated files. Narrow globs and add ignore patterns.

Prüfen: lc_preview again
MCP tool not available

Use uvx --from llm-context lc-mcp in your MCP server config.

Prüfen: claude mcp list

Alternativen

llm-context.py vs. andere

AlternativeWann stattdessenKompromiss
repomix / ai-digestYou want a single-file dump, not MCP toolsNo interactive lc_missing; static snapshot
filesystem MCPYou want raw file accessNo rule-based selection or outlines
driftYou want persistent convention memory, not per-task file bundlingDifferent problem entirely

Mehr

Ressourcen

📖 Offizielle README auf GitHub lesen

🐙 Offene Issues ansehen

🔍 Alle 400+ MCP-Server und Skills durchsuchen