Related MCP Server Resources

Explore more AI models, providers, and integration options:

  • Explore AI Models
  • Explore AI Providers
  • Explore MCP Servers
  • LangDB Pricing
  • Documentation
  • AI Industry Blog
  • Code Analysis MCP Server
  • crawl4ai-mcp
  • Powertools MCP Search Server
  • Gemini MCP Image Generation Server
  • GIS Data Conversion MCP
Back to MCP Servers
code2prompt

code2prompt

Public
mufeedvh/code2prompt

Convert entire codebases into structured, customizable prompts for large language models by running a local Model Context Protocol (MCP) service that automates code ingestion, filtering, token tracking, and git integration for enhanced AI-driven code analysis and generation.

javascript
0 tools
May 30, 2025
Updated Jun 4, 2025

Supercharge Your AI with code2prompt

MCP Server

Unlock the full potential of code2prompt through LangDB's AI Gateway. Get enterprise-grade security, analytics, and seamless integration with zero configuration.

Unified API Access
Complete Tracing
Instant Setup
Get Started Now

Free tier available • No credit card required

Instant Setup
99.9% Uptime
10,000+Monthly Requests

Convert your codebase into a single LLM prompt !

Want to engage with us ? Join our Discord channel! Stay updated on new features 📢 Give your insight and suggestion 💬 Get help with configuration and usage 🛠️ Report Bug 🐛

Quick Install ⚡

# Cargo $ cargo install code2prompt # Homebrew $ brew install code2prompt

SDK with pip 🐍

pip install code2prompt-rs

How is it useful?

Core

code2prompt is a code ingestion tool that streamline the process of creating LLM prompts for code analysis, generation, and other tasks. It works by traversing directories, building a tree structure, and gathering informations about each file. The core library can easily be integrated into other applications.

CLI

code2prompt command line interface (CLI) was designed for humans to generate prompts directly from your codebase. The generated prompt is automatically copied to your clipboard and can also be saved to an output file. Furthermore, you can customize the prompt generation using Handlebars templates. Check out the provided prompts in the doc !

SDK

code2prompt software development kit (SDK) offers python binding to the core library. This is perfect for AI agents or automation scripts that want to interact with codebase seamlessly. The SDK is hosted on Pypi and can be installed via pip.

MCP

code2prompt is also available as a Model Context Protocol (MCP) server, which allows you to run it as a local service. This enables LLMs on steroids by providing them a tool to automatically gather a well-structured context of your codebase.

Documentation 📚

Check our online documentation for detailed instructions

Features

Code2Prompt transforms your entire codebase into a well-structured prompt for large language models. Key features include:

  • Automatic Code Processing: Convert codebases of any size into readable, formatted prompts
  • Smart Filtering: Include/exclude files using glob patterns and respect .gitignore rules
  • Flexible Templating: Customize prompts with Handlebars templates for different use cases
  • Token Tracking: Track token usage to stay within LLM context limits
  • Git Integration: Include diffs, logs, and branch comparisons in your prompts
  • Developer Experience: Automatic clipboard copy, line numbers, and file organization options

Stop manually copying files and formatting code for LLMs. Code2Prompt handles the tedious work so you can focus on getting insights and solutions from AI models.

Alternative Installation

Refer to the documentation for detailed installation instructions.

Binary releases

Download the latest binary for your OS from Releases.

Source build

Requires:

  • Git, Rust and Cargo.
git clone https://github.com/mufeedvh/code2prompt.git cd code2prompt/ cargo install --path crates/code2prompt

Star History

License

Licensed under the MIT License, see LICENSE for more information.

Liked the project?

If you liked the project and found it useful, please give it a :star: !

Contribution

Ways to contribute:

  • Suggest a feature
  • Report a bug
  • Fix something and open a pull request
  • Help me document the code
  • Spread the word
Publicly Shared Threads0

Discover shared experiences

Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!

Share your threads to help others
Related MCPs5
  • Code Analysis MCP Server
    Code Analysis MCP Server

    Enables AI-driven natural language exploration and analysis of codebases via Model Context Protocol,...

    4 tools
    Added May 30, 2025
  • crawl4ai-mcp
    crawl4ai-mcp

    Integrates web scraping and crawling tools with Model Context Protocol to enable large language mode...

    Added May 30, 2025
  • Powertools MCP Search Server
    Powertools MCP Search Server

    Model Context Protocol server enabling efficient local search of AWS Lambda Powertools documentation...

    2 tools
    Added May 30, 2025
  • Gemini MCP Image Generation Server
    Gemini MCP Image Generation Server

    Provides image generation capabilities via Google's Gemini 2 API using the Model Context Protocol, e...

    1 tools
    Added May 30, 2025
  • GIS Data Conversion MCP
    GIS Data Conversion MCP

    Provides Model Context Protocol (MCP) integration enabling large language models to perform advanced...

    9 tools
    Added May 30, 2025