cyberchitta/llm-context.py logo

cyberchitta/llm-context.py

Free

通过 MCP 或剪贴板与 LLM 共享代码上下文。

FreeFree tier
Type
Open Source

About cyberchitta/llm-context.py

LLM Context is an open-source tool that solves the friction of sharing the right code context with Large Language Models (LLMs). It provides smart context management through intelligent file selection and rule-based filtering, enabling developers to share relevant project files instantly via the Model Context Protocol (MCP) or clipboard. The tool offers predefined workflows for human developers (using clipboard-based commands like lc-select and lc-context), AI agents with CLI access (using lc-preview and lc-context to create focused sub-task contexts), and direct MCP integration for AI agents in chat (tools like lc_outlines, lc_preview, and lc_missing). It includes smart code outlining and composable rules that allow easy switching between tasks such as code review and documentation. Installation is via uv tool install llm-context, and MCP server configuration supports Claude Desktop. The project is heavily human-curated by @restlessronin and was developed in collaboration with multiple Claude models.

Key Features

Share code with LLMs via Model Context Protocol (MCP) or clipboard
Rule-based customization for task-specific contexts (code review, documentation, etc.)
Smart code outlining for better context extraction
Composable rules to switch between different development tasks
MCP server integration for Claude Desktop (adds tools like lc_outlines, lc_preview, lc_missing)
Pre-built commands: lc-select (file selection), lc-context (formatted context), lc-preview (validate rules), lc-init (project setup)
Dynamic file fetching on demand (lc_missing) without manual copying
Built for both human chat interfaces and AI agent CLI workflows

Pros & Cons

Pros
  • Eliminates manual file copying and reduces friction in sharing code context with LLMs
  • Intelligent file selection avoids token limit issues by only including relevant files
  • Rule-based customization enables easy switching between different tasks
  • Open source and free to use
  • Provides direct MCP integration for seamless AI agent workflows
  • Includes smart code outlining features for better context
Cons
  • Requires Python environment and uv tool installation
  • Initial setup (lc-init) required per project
  • Limited to projects with compatible file structures
  • Documentation could be more comprehensive for complex rule configurations

Best For

Code review: Provide relevant files for AI-assisted reviewDocumentation generation: Focused context for writing docsAI agent sub-tasking: Create focused contexts for sub-agents during developmentDebugging: Share only relevant code snippets with LLMsPair programming: Quickly provide context to AI coding assistants

FAQ

What is LLM Context?
LLM Context is an open-source tool that helps developers share relevant project files with Large Language Models (LLMs) via the Model Context Protocol (MCP) or clipboard, using intelligent selection and rule-based filtering.
How do I install LLM Context?
Install using uv: `uv tool install 'llm-context>=0.6.0'`. Then navigate to your project root and run `lc-init` to set up the configuration files.
How do I integrate LLM Context with Claude Desktop?
Add the MCP server configuration to your Claude Desktop config file (e.g., `~/Library/Application Support/Claude/claude_desktop_config.json`) with the command: `uvx --from llm-context lc-mcp`. Restart Claude Desktop to enable MCP tools.
What commands does LLM Context provide?
The main commands are: `lc-select` (interactive file selection), `lc-context` (copy formatted context to clipboard), `lc-preview` (validate rule effectiveness), `lc-outlines` (generate excerpted context), `lc-missing` (fetch specific files on demand), and `lc-init` (one-time project setup).