
Code MCP
An MCP server that provides tools for reading, writing, and editing files on the local filesystem.
ezyang
Tools
deskaid
This is a multipurpose tool that supports the following subcommands: ## ReadFile file_path offset? limit? Reads a file from the local filesystem. The file_path parameter must be an absolute path, not a relative path. By default, it reads up to ${MAX_LINES_TO_READ} lines starting from the beginning of the file. You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters. Any lines longer than ${MAX_LINE_LENGTH} characters will be truncated. For image files, the tool will display the image for you. ## WriteFile file_path content Write a file to the local filesystem. Overwrites the existing file if there is one. Before using this tool: 1. Use the ReadFile tool to understand the file's contents and context 2. Directory Verification (only applicable when creating new files): - Use the LS tool to verify the parent directory exists and is the correct location ## EditFile file_path old_string new_string This is a tool for editing files. For larger edits, use the Write tool to overwrite files. Before using this tool: 1. Use the View tool to understand the file's contents and context 2. Verify the directory path is correct (only applicable when creating new files): - Use the LS tool to verify the parent directory exists and is the correct location To make a file edit, provide the following: 1. file_path: The absolute path to the file to modify (must be absolute, not relative) 2. old_string: The text to replace (must be unique within the file, and must match the file contents exactly, including all whitespace and indentation) 3. new_string: The edited text to replace the old_string The tool will replace ONE occurrence of old_string with new_string in the specified file. CRITICAL REQUIREMENTS FOR USING THIS TOOL: 1. UNIQUENESS: The old_string MUST uniquely identify the specific instance you want to change. This means: - Include AT LEAST 3-5 lines of context BEFORE the change point - Include AT LEAST 3-5 lines of context AFTER the change point - Include all whitespace, indentation, and surrounding code exactly as it appears in the file 2. SINGLE INSTANCE: This tool can only change ONE instance at a time. If you need to change multiple instances: - Make separate calls to this tool for each instance - Each call must uniquely identify its specific instance using extensive context 3. VERIFICATION: Before using this tool: - Check how many instances of the target text exist in the file - If multiple instances exist, gather enough context to uniquely identify each one - Plan separate tool calls for each instance WARNING: If you do not follow these requirements: - The tool will fail if old_string matches multiple locations - The tool will fail if old_string doesn't match exactly (including whitespace) - You may change the wrong instance if you don't include enough context When making edits: - Ensure the edit results in idiomatic, correct code - Do not leave the code in a broken state - Always use absolute file paths (starting with /) If you want to create a new file, use: - A new file path, including dir name if needed - An empty old_string - The new file's contents as new_string Remember: when making multiple file edits in a row to the same file, you should prefer to send all edits in a single message with multiple calls to this tool, rather than multiple messages with a single call each. ## LS directory_path Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You should generally prefer the Glob and Grep tools, if you know which directories to search. Args: ctx: The MCP context command: The subcommand to execute (ReadFile, WriteFile, EditFile, LS) file_path: The path to the file or directory to operate on content: Content for WriteFile command old_string: String to replace for EditFile command new_string: Replacement string for EditFile command offset: Line offset for ReadFile command limit: Line limit for ReadFile command
README
codemcp
Make Claude Desktop a pair programming assistant by installing codemcp. With it, you can directly ask Claude to implement features, fix bugs and do refactors on a codebase on your computer; Claude will directly edit files and run tests. Say goodbye to copying code in and out of Claude's chat window!
codemcp offers similar functionality to other AI coding software (Claude Code, Cursor, Cline, Aider), but it occupies a unique point in the design space:
-
It's intended to be used with Claude Pro, Anthropic's $20/mo subscription offering. Say goodbye to giant API bills. (Say hello to time-based rate limits.)
-
It's built around safe agentic AI by providing a limited set of tools that helpful, honest and harmless LLMs are unlikely to misuse, and enforcing best practices like use of Git version control to ensure all code changes can be rolled back. As a result, you can safely unleash the AI and only evaluate at the end if you want to accept the changes or not.
-
It's IDE agnostic: you ask Claude to make changes, it makes them, and then you can use your favorite IDE setup to review the changes and make further edits.
Getting started
First, install uv and install git, if they are not installed already (on Windows, if you installed Git, I recommend rebooting).
Then, in claude_desktop_config.json
:
{
"mcpServers": {
"codemcp": {
"command": "/Users/<username>/.local/bin/uvx",
"args": [
"--from",
"git+https://github.com/ezyang/codemcp@prod",
"codemcp"
]
}
}
}
On Windows, double backslashes are necessary for the path:
C:\\Users\\<username>\\.local\\bin\\uvx.exe
Restart the Claude Desktop app after modifying the JSON. If the MCP successfully loaded, a hammer icon will appear and when you click it "codemcp" will be visible.
Global install with pip
If you don't want to use uv, you can also globally pip install the latest codemcp version, assuming your global Python install is recent enough (Python 3.12) and doesn't have Python dependencies that conflict with codemcp. Some users report this is easier to get working on Windows.
pip install git+https://github.com/ezyang/codemcp@prod
- Add the following configuration to
claude_desktop_config.json
file
{
"mcpServers": {
"codemcp": {
"command": "python",
"args": ["-m", "codemcp"]
}
}
}
- Restart Claude Desktop
You will need to manually upgrade codemcp to take updates using
pip install --upgrade git+https://github.com/ezyang/codemcp@prod
Other tips
Pro tip: If the server fails to load, go to Settings > Developer > codemcp >
Logs to look at the MCP logs, they're very helpful for debugging. The logs on
Windows should be loaded C:\Users\<user_name>\AppData\Roaming\Claude\logs
(replace <user_name>
with your username.
Pro tip: if on Windows, the logs say "Git executable not found. Ensure that Git is installed and available", and you just installed Git, reboot your machine (the PATH update hasn't propagated.) If this still doesn't work, open System Properties > Environment Variables > System variables > Path and ensure there is an entry for Git.
Pro tip: if you like to live dangerously, you can change prod
to main
. If
you want to pin to a specific release, replace it with 0.3.0
or similar.
Pro tip: it is supported to specify only uvx
as the command, but uvx must be
in your global PATH (not just added via a shell profile); on OS X, this is
typically not the case if you used the self installer (unless you installed
into a system location like /usr/local/bin
).
Usage
First, you must create a codemcp.toml
file in the Git repository checkout
you want to work on. If you want the agent to be able to do things like run
your formatter or run tests, add the commands to execute them in the commands
section (note: these commands need to appropriately setup any virtual
environment they need):
format = ["./run_format.sh"]
test = ["./run_test.sh"]
Next, in Claude Desktop, we recommend creating a Project and putting this in the Project Instructions:
Initialize codemcp with $PROJECT_DIR
Where $PROJECT_DIR
is the path to the project you want to work on.
Then chat with Claude about what changes you want to make to the project. Every time codemcp makes a change to your code, it will generate a commit.
To see some sample transcripts using this tool, check out:
codemcp will generate a commit per chat and amend it as it is working on your feature.
Philosophy
-
When you get rate limited, take the time to do something else (review Claude's code, review someone else's code, make plans, do some meetings)
-
This is not an autonomous agent. At minimum, you have to intervene after every chat to review the changes and request the next change. While you can ask for a long list of things to be done in a single chat, you will likely hit Claude Desktop's output limit and have to manually "continue" the agent anyway. Embrace it, and use the interruptions to make sure Claude is doing the right thing.
-
When Claude goes off the rails, it costs you time rather than dollars. Behave accordingly: if time is the bottleneck, watch Claude's incremental output carefully.
Configuration
Here are all the config options supported by codemcp.toml
:
project_prompt = """
Before beginning work on this feature, write a short haiku. Do this only once.
"""
[commands]
format = ["./run_format.sh"]
test = ["./run_test.sh"]
The project_prompt
will be loaded when you initialize the project in chats.
The commands
section allows you to configure commands for specific tools. The
names are told to the LLM, who will decide when it wants to run them. You can add
instructions how to use tools in the project_prompt
; we also support a more verbose
syntax where you can give specific instructions on a tool-by-tool basis:
[commands.test]
command = ["./run_test.sh"]
doc = "Accepts a pytest-style test selector as an argument to run a specific test."
Troubleshooting
To run the server with inspector, use:
PYTHONPATH=. mcp dev codemcp/__main__.py
Logs are written to ~/.codemcp/codemcp.log
. The log level can be set in a global configuration file at ~/.codemcprc
:
[logger]
verbosity = "INFO" # Can be DEBUG, INFO, WARNING, ERROR, or CRITICAL
Logging is not configurable on a per project basis, but this shouldn't matter much because it's difficult to use Claude Desktop in parallel on multiple projects anyway.
Contributing
See CONTRIBUTING.md.
Type Checking
This project uses pyright
for type checking with strict mode enabled. The type checking configuration is in pyproject.toml
. We use a few strategies to maintain type safety:
-
Type stubs for external libraries:
- Custom type stubs are in the
stubs/
directory - The
stubPackages
configuration inpyproject.toml
maps libraries to their stub packages
- Custom type stubs are in the
-
File-specific ignores for challenging cases:
- For some files with complex dynamic typing patterns (particularly testing code), we use file-specific ignores via
tool.pyright.ignoreExtraErrors
inpyproject.toml
- This is preferable to inline ignores and lets us maintain type safety in most of the codebase
- For some files with complex dynamic typing patterns (particularly testing code), we use file-specific ignores via
When making changes, please ensure type checking passes by running:
./run_typecheck.sh
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Excel MCP Server
A Model Context Protocol server that enables AI assistants to read from and write to Microsoft Excel files, supporting formats like xlsx, xlsm, xltx, and xltm.
Playwright MCP Server
Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.
MCP Package Docs Server
Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.
Claude Code MCP
An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
@kazuph/mcp-taskmanager
Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.
Apple MCP Server
Enables interaction with Apple apps like Messages, Notes, and Contacts through the MCP protocol to send messages, search, and open app content using natural language.
Gitingest-MCP
An MCP server for gitingest. It allows MCP clients like Claude Desktop, Cursor, Cline etc to quickly extract information about Github repositories including repository summaries, project directory structure, file contents, etc