ctp-get-contextLABSCO SUMMARY
Know what a codebase costs before you send it.
The analysis tool answers the question that decides everything else — how many tokens this tree is — and the context tool then packs only what you chose to include. That order is what keeps a large repository from becoming a truncated prompt.
What it is
An MCP server around the codetoprompt library, which packs a codebase into a single prompt with filtering, formatting and compression options exposed as tool parameters.
What you get
- A whole directory rendered into one prompt, with codetoprompt's filtering, formatting and compression options available on the call
- A statistical read of the codebase first: token counts, line counts and a breakdown by file type
- The contents of specific files formatted as a prompt, when only part of the tree matters
- The same packing behaviour the CLI gives you, available to an agent without shelling out
Requirements
pip install codetoprompt-mcp, which brings in codetoprompt and the mcp library, then a single ctp-mcp command in your client config. No account and no key — it reads the files you point it at.
Setup effort
One command — pip install codetoprompt-mcp
USE CASES
Sizing a repository before you feed it to a model
Get token counts, line counts and a per-file-type breakdown, so the decision about what to include is made on numbers.
Packing a project into one prompt
Generate a single comprehensive prompt from a directory, with filtering and compression applied on the way through.
Asking about a specific corner of the codebase
Pull just the files that matter, formatted as a prompt, instead of shipping the whole tree for a narrow question.
Trimming a prompt that came back too large
Re-run the analysis after changing filters to see whether the exclusions actually brought the size down.
3 tools
Listed in project docs. Your client may show a different list.
ctp-analyse-projectctp-get-filesBEFORE YOU INSTALL
What to know first
Tools you get
3 tools named in the project's documentation.
Requires
ctp-mcp on PATH
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
Server setup
pip install codetoprompt-mcpMCP Clients
Claude Desktop
{
"mcpServers": {
"CodeToPrompt": {
"command": "ctp-mcp"
}
}
}