Skip to main content
Glama
CodeToPrompt MCP Server
by yash9439

CodeToPrompt MCP Server

PyPI version

CodeToPrompt MCP Server exposes the powerful features of the codetoprompt library through the Model Context Protocol (MCP). This allows LLM agents and other MCP-compatible clients to programmatically generate prompts, analyze codebases, and retrieve specific file contents.


πŸ”§ Installation

Install from PyPI:

pip install codetoprompt-mcp

This will automatically install codetoprompt and the required mcp library.


Related MCP server: scc-mcp

πŸš€ Usage with an MCP Client

This server is designed to be used with an MCP client, such as the Claude Desktop App.

Example: Claude Desktop Configuration

To use this server with Claude, add it to your claude_desktop_config.json file:

{
  "mcpServers": {
    "CodeToPrompt": {
      "command": "ctp-mcp"
    }
  }
}

Once configured, you can invoke the tools from your conversation with the LLM.

Available Tools

  • ctp-get-context: The primary tool for generating a comprehensive prompt from a directory. It supports all of codetoprompt's filtering, formatting, and compression options.

  • ctp-analyse-project: Provides a detailed statistical analysis of a codebase, including token counts, line counts, and breakdowns by file type.

  • ctp-get-files: Retrieves the content of specific files, formatted as a prompt. This is useful for targeted queries.


🀝 Contributing

We welcome contributions! Please refer to the main codetoprompt repository for contribution guidelines.

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for full details.

Available Tools

3 tools
ctp-analyse-projectB

Provides a detailed statistical analysis of a codebase, including token counts, line counts, and breakdowns by file type.

Inputs: root_path (required), include_patterns, exclude_patterns, respect_gitignore, +1 more.

ctp-get-contextC

Generates a comprehensive, context-rich prompt from an entire codebase directory, applying filters and formatting options.

Inputs: root_path (required), include_patterns, exclude_patterns, respect_gitignore, +3 more.

ctp-get-filesC

Retrieves the content of a specific list of files from the project, formatted into a prompt.

Inputs: root_path (required), paths (required), output_format.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: ctp-analyse-project provides statistical analysis, ctp-get-context generates comprehensive prompts from entire directories, and ctp-get-files retrieves specific file contents. There is no overlap in functionality, making it easy for an agent to select the right tool based on the task.

    Naming Consistency5/5

    All tools follow a consistent 'ctp-verb-noun' naming pattern with hyphens, using descriptive verbs like 'analyse', 'get', and 'get' (though 'get' repeats, it's consistent in structure). The naming is uniform and predictable across all three tools.

    Tool Count3/5

    With only 3 tools, the set feels thin for a server focused on code-to-prompt operations, potentially lacking broader functionality like editing or filtering prompts. However, it covers basic analysis and retrieval tasks adequately for its scope.

    Completeness3/5

    The tools cover analysis and retrieval of codebases, but there are notable gaps such as no tools for modifying prompts, handling dynamic contexts, or integrating with external systems. This limits the server's ability to support full code-to-prompt workflows without workarounds.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides LLM-optimized tools for advanced code analysis, repository complexity evaluation, and call graph generation. It enables users to visualize directory structures, detect code patterns, and build semantic context with significant token savings.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Exposes boyter/scc code counting and complexity analysis to LLM agents via read-only tools like counting lines, finding top files, and cost estimation.
      7
      BSD 3-Clause
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to generate annotated file trees, retrieve file statistics, list git-changed files, and read file contents from local directories or GitHub repositories.
      MIT