llm-context

  • Developer Tools
Python
Apache-2.0
37
A
security – no known vulnerabilities (report Issue)
A
license - permissive license (Apache-2.0)
A
quality - confirmed to work

Share code context with LLMs via MCP or clipboard

  1. Tools
  2. Prompts
  3. Resources
  4. Server Configuration
  5. README.md

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Tools

Functions exposed to the LLM to take actions

NameDescription
project_contextGenerates a structured repository overview including: 1) Directory tree with file status (✓ full, ○ outline, ✗ excluded) 2) Complete contents of key files 3) Smart outlines highlighting important definitions in supported languages. The output is customizable via profiles that control file inclusion rules and presentation format. The assistant tracks previously retrieved project context in the conversation and checks this history before making new requests.
get_filesRetrieves complete contents of specified files from the project. The assistant tracks all previously retrieved file contents and checks this history before making new requests.

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

README.md

LLM Context

License PyPI version

LLM Context is a tool that helps developers quickly inject relevant content from code/text projects into Large Language Model chat interfaces. It leverages .gitignore patterns for smart file selection and provides both a streamlined clipboard workflow using the command line and direct LLM integration through the Model Context Protocol (MCP).

Note: This project was developed in collaboration with Claude-3.5-Sonnet, using LLM Context itself to share code during development. All code in the repository is human-curated (by me 😇, @restlessronin).

Why LLM Context?

For an in-depth exploration of the reasoning behind LLM Context and its approach to AI-assisted development, check out our article: LLM Context: Harnessing Vanilla AI Chats for Development

Current Usage Patterns

  • Direct LLM Integration: Native integration with Claude Desktop via MCP protocol
  • Chat Interface Support: Works with any LLM chat interface via CLI/clipboard
    • Optimized for interfaces with persistent context like Claude Projects and Custom GPTs
    • Works equally well with standard chat interfaces
  • Project Types: Suitable for code repositories and collections of text/markdown/html documents
  • Project Size: Optimized for projects that fit within an LLM's context window. Large project support is in development

Installation

Install LLM Context using uv:

uv tool install llm-context

Warning: LLM Context is under active development. Updates may overwrite configuration files prefixed with lc-. We recommend backing up any customized files before updating.

Quickstart

MCP with Claude Desktop

Add to 'claude_desktop_config.json':

{ "mcpServers": { "CyberChitta": { "command": "uvx", "args": ["--from", "llm-context", "lc-mcp"] } } }

CLI Quick Start and Typical Workflow

  1. Navigate to your project's root directory
  2. Initialize repository: lc-init (only needed once)
  3. (Optional) Edit .llm-context/config.toml to customize ignore patterns
  4. Select files: lc-sel-files
  5. (Optional) Review selected files in .llm-context/curr_ctx.toml
  6. Generate context: lc-context
  7. Use with your preferred interface:
  • Project Knowledge (Claude Pro): Paste into knowledge section
  • GPT Knowledge (Custom GPTs): Paste into knowledge section
  • Regular chats: Use lc-set-profile code-prompt first to include instructions
  1. When the LLM requests additional files:
    • Copy the file list from the LLM
    • Run lc-read-cliplist
    • Paste the contents back to the LLM

Core Commands

  • lc-init: Initialize project configuration
  • lc-set-profile <name>: Switch profiles
  • lc-sel-files: Select files for inclusion
  • lc-context: Generate and copy context
  • lc-read-cliplist: Process LLM file requests

Features & Advanced Usage

LLM Context provides advanced features for customizing how project content is captured and presented:

  • Smart file selection using .gitignore patterns
  • Multiple profiles for different use cases
  • Code outline generation for supported languages
  • Customizable templates and prompts

See our User Guide for detailed documentation of these features.

Similar Tools

Check out our comprehensive list of alternatives - the sheer number of tools tackling this problem demonstrates its importance to the developer community.

Acknowledgments

LLM Context evolves from a lineage of AI-assisted development tools:

  • This project succeeds LLM Code Highlighter, a TypeScript library I developed for IDE integration.
  • The concept originated from my work on RubberDuck and continued with later contributions to Continue.
  • LLM Code Highlighter was heavily inspired by Aider Chat. I worked with GPT-4 to translate several Aider Chat Python modules into TypeScript, maintaining functionality while restructuring the code.
  • This project uses tree-sitter tag query files from Aider Chat.
  • LLM Context exemplifies the power of AI-assisted development, transitioning from Python to TypeScript and back to Python with the help of GPT-4 and Claude-3.5-Sonnet.

I am grateful for the open-source community's innovations and the AI assistance that have shaped this project's evolution.

I am grateful for the help of Claude-3.5-Sonnet in the development of this project.

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.

GitHub Badge

Glama performs regular codebase and documentation scans to:

  • Confirm that the MCP server is working as expected.
  • Confirm that there are no obvious security issues with dependencies of the server.
  • Extract server characteristics such as tools, resources, prompts, and required parameters.

Our directory badge helps users to quickly asses that the MCP server is safe, server capabilities, and instructions for installing the server.

Copy the following code to your README.md file:

Alternative MCP servers

  • -
    security
    A
    license
    -
    quality
    Model Context Protocol (MCP) server implementation that enables Claude Desktop to interact with Google's Gemini AI models.
    MIT
    • Apple
    • Linux
  • A
    security
    F
    license
    A
    quality
    A Model Context Protocol (MCP) server that provides tools to interact with LinkedIn's Feeds and Job API. You can do "search for 3 data engineer jobs in <city>. For each job check if it a good match for me by analyzing it against my resume in file resume.md."
  • A
    security
    A
    license
    A
    quality
    A Model Context Protocol (MCP) server that lets you seamlessly use OpenAI's models right from Claude.
    MIT
    • Apple
  • A
    security
    A
    license
    A
    quality
    MCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.
    MIT