AI Personal Learning
and practical guidance
Ali-painted frog

codemcp: coding assistant MCP for Claude Desktop

General Introduction

codemcp is an open source tool designed for Claude Desktop user design, developed by Edward Z. Yang on GitHub. It makes Claude Desktop a useful pair programming assistant. Users can ask Claude to implement features, fix bugs, or refactor in their local codebase directly through a dialog, without having to copy and paste code manually. codemcp support Anthropic The Claude Pro subscription service ($20 per month) avoids high API fees. It ensures safe and controlled AI operations by limiting the toolset and enforcing the use of Git version control. Developers can check and tweak code with their favorite IDEs for a variety of programming scenarios.

codemcp: Claude Desktop-specific coding assistant MCP-1


 

Function List

  • Direct editing of native code: Modify project files via Claude to save changes automatically.
  • Running tests and formatting: Execute test scripts and formatting commands to maintain code quality.
  • Git Commit Management: Generate Git commits for each change, with support for viewing and rolling back.
  • Project Configuration Support: Initialize the project with a configuration file to load custom commands.
  • Log tracking: Record operation details for easy troubleshooting.

 

Using Help

Installation process

To use codemcp, you need to install the dependencies and configure the environment first. The following are the detailed steps:

  1. Installing the uv tool
    codemcp relies on uv to run. First install uv, we recommend using the official install script:

    • Linux/MacOS:
      curl -LsSf https://astral.sh/uv/install.sh | sh
      
    • Windows (PowerShell):
      powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
      

    After installation, run uv --version Check the version to make sure the installation was successful.

  2. Configuring Claude Desktop
    Open or create claude_desktop_config.json file, add the following:
{
"mcpServers": {
"codemcp": {
"command": "uvx",
"args": [
"--from".
"git+https://github.com/ezyang/codemcp@prod",
"codemcp"
]
}
}
}

After saving, Claude Desktop will load codemcp from GitHub via uvx.

  1. Setting up the project profile
    In the root of your Git repository, create the codemcp.toml Documentation. Example:
format = [". /run_format.sh"]
test = [". /run_test.sh"]
  • format: Specifies the formatting script path for code normalization.
  • test: Specify the test script path for running the test.
    These scripts need to be written by yourself to ensure that the virtual environment can be activated and run correctly.

How to use

After the installation is complete, you can operate codemcp in Claude Desktop. here is the exact procedure:

1. Initialization project

Create a new Project in Claude Desktop and enter it in Project Instructions:

Before doing anything, first init project $PROJECT_DIR.

commander-in-chief (military) $PROJECT_DIR Replace it with your project path, e.g. /Users/username/myproject. After initialization, codemcp reads the codemcp.toml Configuration.

2. Changing the code through dialogues

In the Claude Desktop chat window, tell Claude directly what you want to change. Example:

  • "Add a function to main.py that calculates the Fibonacci series."
  • "Fix logic error in utils.py."
    Claude will edit the file via codemcp and automatically generate a Git commit after each change. You can use the git log View submission history.

3. Checking and managing code changes

It is recommended that a separate branch (e.g. develop) to run codemcp, with the default branch set to mainThe following are common Git commands. The following are common Git commands:

  • View Changes::git diff main Displays the difference from the master branch.
  • Acceptance of changes::git fetch . develop:main Merge changes to the master branch.
    • Retention of submission history: first git checkout mainonce again git merge develop --no-ffThe
    • Compression Submission: Run git rebase -iIf you are not sure what you want to do, select squash and then execute fetch.
  • Undo changes::git reset --keep main Revert to the master branch state.

4. Implementation testing and formatting

If you configure the test cap (a poem) formatYou can ask Claude to run these commands. For example:

  • "Run all the tests and check that the code works."
  • "Formatting code after mission completion."
    Tests are run halfway through the task and formatting is performed at the end of the task.

5. Handling of flow restrictions

Claude Pro has a time limit, and Claude pauses when it encounters a stream limit. You can utilize this time:

  • Check the generated code.
  • Planning the next tasks.
    Once the restriction is lifted, just continue the conversation.

6. Viewing the logbook

In case of problems, check out the ~/.codemcp/codemcp.log Log file. For more detailed logging, edit the ~/.codemcprc::

[logger]
verbosity = "DEBUG"

The supported levels are DEBUG, INFO, WARNING, ERROR, and CRITICAL.

Featured Function Operation

  • safety design: codemcp limits the scope of Claude's tools to avoid misuse. All changes are rolled back via Git.
  • IDE Compatible: Code changes can be reviewed and adjusted with any IDE (e.g. VS Code).
  • manual control: Non-automated agents, each task needs to be checked and continued by the user to ensure that the code is going in the right direction.

With these steps, you can quickly get started with codemcp and improve your programming efficiency.

CDN1
May not be reproduced without permission:Chief AI Sharing Circle " codemcp: coding assistant MCP for Claude Desktop

Chief AI Sharing Circle

Chief AI Sharing Circle specializes in AI learning, providing comprehensive AI learning content, AI tools and hands-on guidance. Our goal is to help users master AI technology and explore the unlimited potential of AI together through high-quality content and practical experience sharing. Whether you are an AI beginner or a senior expert, this is the ideal place for you to gain knowledge, improve your skills and realize innovation.

Contact Us
en_USEnglish