code-mcp-server v0.1.1
Code MCP Server
A Model Context Protocol (MCP) server for VS Code integration, enabling AI agents like Goose or Claude to interact with VS Code.
Features
- File diffing
- Opening files
- more to come
Installation
You can install the Code MCP Server using npx:
npx code-mcp-server install
This command will:
- Check your operating system compatibility (Windows/macOS)
- Install the server
- Generate a Goose install URL that you can copy and paste it into a browser to easily istall the Goose Extension.
Local Installation Using npm pack
If you want to test the package locally before publishing to npm, you can use npm pack
:
Clone the repository and navigate to the server directory:
git clone https://github.com/block/code-mcp.git cd code-mcp/server
Create a tarball of the package:
npm pack
This will create a file like
code-mcp-server-X.X.X.tgz
in the current directory.Install the package globally from the local tarball:
npm install -g ./code-mcp-server-X.X.X.tgz
Usage
Once installed, you can configure your AI assistant to use this server. The server provides various tools for interacting with VS Code, including:
- Opening files
- Creating Diffs of file changes that require Accept/Reject
Configuration
After installation, you'll need to configure your AI assistant to use this server.
Goose Desktop Configuration
- ID:
code-mcp-server
- Name:
Code MCP Server
- Description:
Allows interaction with VS Code through the Model Context Protocol
- Command:
npx code-mcp-server
Claude Desktop Configuration
Add the following to your Claude Desktop configuration file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"code-mcp-server": {
"command": "npx",
"args": ["code-mcp-server"],
"env": {}
}
}
}
Other AI Assistants
For other AI assistants that support the Model Context Protocol, refer to their documentation for how to configure external MCP servers. You'll typically need to provide:
- The command
npx code-mcp-server
- Any required environment variables
Development
Automated Publishing with GitHub Actions (WIP)
- release.yml: Automatically creates a new release when you push to the main branch with conventional commit messages
- npm-publish.yml: Automatically publishes to npm when a new release is created
To use these workflows:
- Push your changes to GitHub with conventional commit messages (e.g., "feat: add install command")
- The release workflow will create a new release with an incremented version
- The npm-publish workflow will then publish the new version to npm
You'll need to add an npm token to your GitHub repository secrets:
- Generate an npm token: npm token create
- Add the token to your GitHub repository secrets as npm_token
Updating the Package
Update the version
npm version patch/minor/major
Publish
npm publish