/ Diretório / Playground / llm-context.py
● Comunidade cyberchitta ⚡ Instantâneo

llm-context.py

por 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.

Por que usar

Principais recursos

Demo ao vivo

Como fica na prática

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

Instalar

Escolha seu cliente

~/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
    }
  }
}

Abra Claude Desktop → Settings → Developer → Edit Config. Reinicie após salvar.

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

Cursor usa o mesmo esquema mcpServers que o Claude Desktop. Config de projeto vence a global.

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

Clique no ícone MCP Servers na barra lateral do Cline, depois "Edit Configuration".

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

Mesmo formato do Claude Desktop. Reinicie o Windsurf para aplicar.

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

O Continue usa um array de objetos de servidor em vez de um map.

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

Adicione em context_servers. Zed recarrega automaticamente ao salvar.

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

Uma linha só. Verifique com claude mcp list. Remova com claude mcp remove.

Casos de uso

Usos do mundo real: llm-context.py

Ship a focused code-review context to your LLM

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

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

Pré-requisitos
  • llm-context.py installed — uv tool install 'llm-context>=0.6.0'
  • Initialized in your repolc-init in your repo root
Fluxo
  1. Create a filter rule for auth
    Create an lc filter rule 'flt-auth' that includes src/auth/** and src/middleware/auth*.ts.✓ Copiado
    → 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.✓ Copiado
    → 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.✓ Copiado
    → Review with targeted file requests

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

Armadilhas
  • 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
Combine com: filesystem

Give an LLM a structural map of a huge codebase

👤 Engineers onboarding to unfamiliar monorepos ⏱ ~20 min intermediate

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

Fluxo
  1. Generate outline
    lc_outlines for the whole repo — classes, top-level functions, exports per file. Skip bodies.✓ Copiado
    → 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?✓ Copiado
    → Architectural answers
  3. Drill in on one area
    Show me the full contents of the three files that define routing via lc_missing.✓ Copiado
    → Specific files expand into context

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

Attach project style rules to every prompt

👤 Teams with specific conventions ⏱ ~10 min beginner

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

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

Resultado: Per-task conventions enforced without manual boilerplate.

Combine com: drift

Combinações

Combine com outros MCPs para 10× de alavancagem

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.✓ Copiado
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/.✓ Copiado

Ferramentas

O que este MCP expõe

FerramentaEntradasQuando chamarCusto
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

Custo e limites

O que custa rodar

Cota de API
None
Tokens por chamada
Depends entirely on your rule scope — that's the point
Monetário
Free, open source
Dica
Always run lc_preview before lc_outlines/shipping context — one second of preview saves thousands of tokens.

Segurança

Permissões, segredos, alcance

Armazenamento de credenciais: None
Saída de dados: Only to whichever LLM client/provider you pipe context into

Solução de problemas

Erros comuns e correções

No rules found

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

Verificar: ls .lc/
lc_preview token count surprisingly high

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

Verificar: lc_preview again
MCP tool not available

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

Verificar: claude mcp list

Alternativas

llm-context.py vs. outros

AlternativaQuando usarTroca
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

Mais

Recursos

📖 Leia o README oficial no GitHub

🐙 Ver issues abertas

🔍 Ver todos os 400+ servidores MCP e Skills