CodeToPrompt MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CodeToPrompt MCP ServerGenerate a context prompt from the src folder to help me refactor"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CodeToPrompt MCP Server
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-mcpThis 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 ofcodetoprompt'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 toolsctp-analyse-projectB
Provides a detailed statistical analysis of a codebase, including token counts, line counts, and breakdowns by file type.
| Name | Required | Description | Default |
|---|---|---|---|
| root_path | Yes | Root directory path of the project to analyse. | |
| include_patterns | No | Comma-separated glob patterns for files to include. | |
| exclude_patterns | No | Comma-separated glob patterns for files to exclude. | |
| respect_gitignore | No | Whether to respect .gitignore rules. | |
| top_n | No | Number of items to show in top lists. |
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| root_path | Yes | Root directory path of the project. | |
| include_patterns | No | Comma-separated glob patterns for files to include. | |
| exclude_patterns | No | Comma-separated glob patterns for files to exclude. | |
| respect_gitignore | No | Whether to respect .gitignore rules. | |
| compress | No | Use smart code compression to summarize files. | |
| output_format | No | Output format ('default', 'markdown', 'cxml'). | default |
| tree_depth | No | Maximum depth for the project structure tree. |
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| root_path | Yes | Root directory path of the project. | |
| paths | Yes | A list of specific file paths to include, relative to the root path. | |
| output_format | No | Output format ('default', 'markdown', 'cxml'). | default |
TDQS
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.
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.
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.
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.
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.
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.
3 tool updates
v0.1.0- First observed
ctp-analyse-project - First observed
ctp-get-context - First observed
ctp-get-files
TDQS
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.
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.
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.
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
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
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Serves your design system and coding standards to coding agents, so they stop guessing.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides 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.18MIT
- AlicenseBqualityCmaintenanceEnables token-efficient semantic search and analysis over any directory of files through hybrid search, directory overview, structural analysis, and dependency graphs.14MIT
- AlicenseAqualityBmaintenanceExposes boyter/scc code counting and complexity analysis to LLM agents via read-only tools like counting lines, finding top files, and cost estimation.7BSD 3-Clause
- AlicenseNot gradedqualityCmaintenanceEnables 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
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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