CodeToPrompt MCP Server
Click on "Deploy 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 Server Generate 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: 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 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.
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
Scored across 3 tools
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
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.
Research-backed lint + generation for agent context files (CLAUDE.md, AGENTS.md) + prompt enhancer.
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.MIT
- AlicenseAqualityDmaintenanceExposes 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 gradedqualityDmaintenanceEnables 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
- AlicenseAqualityDmaintenanceAnalyzes a local codebase and exposes its structure, per-file summaries, dependency graph, and complexity hotspots as tools for MCP clients like Claude.4MIT