Skip to main content
Glama
yash9439
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: omni-rag-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.

ParametersJSON Schema
NameRequiredDescriptionDefault
root_pathYesRoot directory path of the project to analyse.
include_patternsNoComma-separated glob patterns for files to include.
exclude_patternsNoComma-separated glob patterns for files to exclude.
respect_gitignoreNoWhether to respect .gitignore rules.
top_nNoNumber of items to show in top lists.

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It describes the output ('detailed statistical analysis') but lacks behavioral details such as performance characteristics, error handling, or side effects. For a tool that analyzes codebases, it doesn't mention whether it's read-only, resource-intensive, or has any limitations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. It wastes no words and directly communicates the tool's function without redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (5 parameters, no output schema, no annotations), the description is minimal but adequate for the basic purpose. It covers what the tool does but lacks depth on behavioral aspects and output details. Without an output schema, it doesn't explain return values, which could be important for a statistical analysis tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 5 parameters. The description adds no parameter-specific information beyond what's in the schema, such as examples or usage tips. Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Provides a detailed statistical analysis of a codebase, including token counts, line counts, and breakdowns by file type.' It specifies the action ('statistical analysis'), resource ('codebase'), and key metrics. However, it doesn't explicitly differentiate from sibling tools like 'ctp-get-context' or 'ctp-get-files', which might also interact with codebases.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools or other contexts, leaving the agent to infer usage based solely on the purpose. There's no explicit when/when-not advice or prerequisites stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ctp-get-contextC

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

ParametersJSON Schema
NameRequiredDescriptionDefault
root_pathYesRoot directory path of the project.
include_patternsNoComma-separated glob patterns for files to include.
exclude_patternsNoComma-separated glob patterns for files to exclude.
respect_gitignoreNoWhether to respect .gitignore rules.
compressNoUse smart code compression to summarize files.
output_formatNoOutput format ('default', 'markdown', 'cxml').default
tree_depthNoMaximum depth for the project structure tree.

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool generates a prompt with filters and formatting, but doesn't cover critical aspects like whether it's read-only or destructive, performance implications (e.g., processing large directories), or error handling. This leaves significant gaps for a tool that processes entire codebases.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. It avoids redundancy and wastes no words, though it could be slightly more structured (e.g., by explicitly mentioning key parameters).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (processing entire codebases with 7 parameters), no annotations, and no output schema, the description is insufficient. It lacks details on behavioral traits, output format specifics, error conditions, or performance considerations, making it incomplete for safe and effective use by an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 7 parameters thoroughly. The description adds minimal value beyond the schema by mentioning 'filters and formatting options,' which loosely maps to parameters like include/exclude patterns and output_format, but doesn't provide additional semantic context or usage examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generates a comprehensive, context-rich prompt from an entire codebase directory, applying filters and formatting options.' This specifies the verb ('generates'), resource ('context-rich prompt'), and scope ('from an entire codebase directory'), though it doesn't explicitly differentiate from sibling tools like 'ctp-analyse-project' or 'ctp-get-files'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its siblings. It mentions 'applying filters and formatting options,' which hints at customization, but lacks explicit when/when-not instructions or alternatives, leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ctp-get-filesC

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

ParametersJSON Schema
NameRequiredDescriptionDefault
root_pathYesRoot directory path of the project.
pathsYesA list of specific file paths to include, relative to the root path.
output_formatNoOutput format ('default', 'markdown', 'cxml').default

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions formatting 'into a prompt' but doesn't disclose behavioral traits such as performance characteristics (e.g., rate limits, file size limits), error handling, or what happens if files are missing. This leaves significant gaps for a tool that retrieves and formats content.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part ('retrieves', 'content of a specific list of files', 'from the project', 'formatted into a prompt') contributes directly to understanding the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool with 3 parameters. It lacks details on return values (e.g., structure of the formatted prompt), error conditions, or operational constraints, which are critical for proper usage in a retrieval and formatting context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional meaning beyond what the schema provides (e.g., it doesn't explain the implications of 'output_format' choices or path resolution details). Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'retrieves' and the resource 'content of a specific list of files', specifying that it's from 'the project' and formatted 'into a prompt'. It distinguishes from sibling tools like 'ctp-analyse-project' by focusing on retrieval rather than analysis, but doesn't explicitly differentiate from 'ctp-get-context' which might have overlapping functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'ctp-get-context'. The description mentions retrieving files 'from the project' but doesn't specify prerequisites, constraints, or scenarios where this tool is preferred over siblings, leaving usage context implied rather than explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 3 tool updatesv0.1.0
    • First observedctp-analyse-project
    • First observedctp-get-context
    • First observedctp-get-files

TDQS

B3.3/5.0
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
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

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.
    18
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    Enables token-efficient semantic search and analysis over any directory of files through hybrid search, directory overview, structural analysis, and dependency graphs.
    14
    MIT
  • A
    license
    A
    quality
    B
    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
    C
    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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yash9439/codetoprompt-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server