Галоўная / Артыкулы / Connect Claude Desktop to Local Projects and GitHub with MCP

Артыкул апублікаваны на англійскай мове.

Connect Claude Desktop to Local Projects and GitHub with MCP

Set up a filesystem MCP server and a GitHub connector in Claude Desktop so it can edit local Java tests, commit, push and open pull requests for you.

1181 слоў

Pasting code back and forth between an IDE and a chat window gets old fast. The better arrangement is an assistant that can open the project folder on your machine, edit or add Java test classes right there, and then commit, push and open a pull request. It costs nothing, and the piece that makes it work is MCP, the Model Context Protocol. Getting it running takes a few tries if you hit the usual snags, so the errors are listed below next to the steps.

The copy-paste loop you're trying to kill

Take a QA engineer who writes Selenium scripts all day. The routine looks like this: copy a class out of VS Code, Eclipse or IntelliJ, paste it into the chat, read the suggestion, copy it again, paste it back into the IDE. Then switch to GitHub and upload or push the result by hand. Every step is manual and none of it needs a human.

What you want instead is to type "push this file to GitHub" and have it happen.

What MCP does

MCP is an open standard from Anthropic. It defines how an assistant like Claude talks to outside tools, apps and data sources in a controlled way. Without it, Claude only sees what you type into the chat, like someone shut in a room with a slot in the door. MCP cuts a proper door into that room, and two kinds of door matter for this setup:

  • A filesystem MCP server, which lets Claude read the files on your computer.
  • A connector, which lets Claude use external services such as GitHub, Gmail or Jira.

With both in place the chat stops being a text box and becomes something that acts. The chain runs from your IDE through the filesystem server:

VSCode / Eclipse / IntelliJ
        │
        ▼
Filesystem MCP Server
        │
        ▼
Claude Desktop
        │
        ▼
GitHub MCP Server
        │
        ▼
GitHub Repository

Prerequisites

  • Claude Desktop, the standalone app. Using claude.ai in a browser tab won't work for this, it only functions in the desktop application.
  • A GitHub account (free).
  • Node.js, a free runtime that certain tools need before they can start.
  • The absolute path to your project's root folder, whichever IDE you use.

All of it is free, and the free Claude plan is enough.

Step 1: give Claude your project folder

This part lets Claude read and write the files of, say, an Eclipse workspace directly.

  1. Install Node.js from nodejs.org. Click through the installer, there's nothing to configure.
  2. In Claude Desktop open Settings, then Developer, then Edit Config. A small settings file opens.
  3. Paste in the snippet below and swap the sample folder for your own project path. On Windows, double every backslash in the path.
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "C:\\Users\\YourName\\eclipse-workspace\\YourProjectName"
      ]
    }
  }
}
  1. Save, then quit Claude Desktop completely and start it again. Minimizing the window doesn't reload anything, the app really has to exit.
  2. Look for a small hammer or tools icon next to the message box. If it's there, the filesystem server loaded.

Step 2: hook up GitHub

This is where nearly everything goes wrong, so take it slowly.

Register your own app on GitHub

GitHub won't let an arbitrary program in. You create a small app entry of your own first, and GitHub hands back two secrets that Claude needs.

  1. Go to github.com/settings/applications/new.
  2. Enter Claude as the application name, https://claude.ai as the homepage URL, and the same https://claude.ai as the authorization callback URL. That callback is just a placeholder for now.
  3. Click Register application.
  4. Copy the Client ID that appears.
  5. Click Generate a new client secret and copy it immediately. GitHub shows it exactly once.

Add the connector in Claude

  1. In Claude Desktop go to Settings, then Connectors, hit the plus sign and choose Add custom connector.
  2. Name it GitHub and use https://api.githubcopilot.com/mcp/ as the URL.
  3. Open Advanced settings and paste the Client ID and Client Secret.
  4. Click Add, then click Connect on the GitHub entry that shows up.
  5. GitHub asks whether to allow access. Click Authorize.

Using both servers in one chat

Once the filesystem server and GitHub both show as connected, one conversation can use them together. The filesystem server exposes your local workspace, and the GitHub server exposes your repositories. Claude picks a file off your disk and pushes it to GitHub, with no pasting and no terminal.

In practice that covers the whole loop:

  • Browsing the contents of your project
  • Changing existing Java files
  • Writing new test scripts
  • Committing with a message
  • Pushing to the remote
  • Opening pull requests

Errors you can skip

  • An empty callback URL. GitHub requires one, so registration keeps failing until you fill it in.
  • Clicking Add before the client secret exists. With credentials missing, Claude only says it couldn't register with the sign-in service, which tells you nothing.
  • Being signed into two different Claude accounts, one in the browser and one in the desktop app. This was the worst of the three, because the "Account mismatch" error it causes has nothing to do with GitHub. The fix is to sign out in the browser and sign back in with the desktop app's account.

Prompts to copy

These work with Claude Desktop once both the filesystem and GitHub servers are active. First, a full request from staging to pushing:

End-to-End Example
Stage all test classes under the com.myAutomation package, commit the changes with the commit message "updated", and push the latest commit to the master branch of the Autonation Project GitHub repository.

And a branch-based git workflow:

Git Workflow
Create a new branch named feature/login-automation, commit all modified files with the message "Added Login Automation Tests", and push the branch to the GitHub repository.

A quick test run

Open Claude Desktop and go through these in order, each one builds on the last.

  1. Local access: ask it to open your automation testing project and show the structure.
  2. File changes: ask for a test class for the login page under src/test/java.
  3. Git: ask it to initialize a repository, create the branch feature/login-test and commit.
  4. Push: ask it to push that branch to the Automation Testing Project repository.
  5. Pull request: ask it to open a pull request against the develop branch.