vscode-mcp-server
Advanced tools
Comparing version
@@ -475,2 +475,10 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; | ||
}); | ||
// Check if the original file exists | ||
try { | ||
await fs.access(originalPath); | ||
} | ||
catch (error) { | ||
await this.log("Error: Original file does not exist:", originalPath); | ||
throw new Error(`Cannot perform diff because the target file does not exist: ${originalPath}`); | ||
} | ||
// Try to show diff in VS Code via extension | ||
@@ -522,5 +530,16 @@ const extension = await this.connectToExtension(targetProjectPath); | ||
// If diff fails, create a basic text comparison | ||
const originalContent = await fs.readFile(originalPath, "utf-8"); | ||
const modifiedContent = await fs.readFile(modifiedPath, "utf-8"); | ||
return `--- ${originalPath}\n+++ ${modifiedPath}\n\nOriginal:\n${originalContent}\n\nModified:\n${modifiedContent}`; | ||
try { | ||
const originalContent = await fs.readFile(originalPath, "utf-8"); | ||
const modifiedContent = await fs.readFile(modifiedPath, "utf-8"); | ||
return `--- ${originalPath}\n+++ ${modifiedPath}\n\nOriginal:\n${originalContent}\n\nModified:\n${modifiedContent}`; | ||
} | ||
catch (readError) { | ||
// If reading the original file fails, it likely doesn't exist | ||
if (readError.code === "ENOENT") { | ||
await this.log("Error: Cannot read original file, it does not exist:", originalPath); | ||
throw new Error(`Cannot perform diff because the target file does not exist: ${originalPath}`); | ||
} | ||
// For other errors, rethrow | ||
throw readError; | ||
} | ||
} | ||
@@ -536,2 +555,16 @@ } | ||
: path.resolve(filePath); | ||
// Check if the file exists | ||
try { | ||
await fs.access(absolutePath); | ||
} | ||
catch (error) { | ||
return { | ||
content: [ | ||
{ | ||
type: "text", | ||
text: `Cannot perform diff because the target file does not exist: ${filePath}`, | ||
}, | ||
], | ||
}; | ||
} | ||
// Create temp file for the modified version | ||
@@ -538,0 +571,0 @@ tempFile = await this.createTempFile(newContent); |
{ | ||
"name": "vscode-mcp-server", | ||
"version": "0.1.9", | ||
"description": "VS Code MCP Server for AI assistants", | ||
"version": "0.1.10", | ||
"description": "VSCode MCP Server for AI assistants to interact with VSCode", | ||
"main": "build/index.js", | ||
@@ -6,0 +6,0 @@ "type": "module", |
@@ -1,4 +0,4 @@ | ||
# VS Code MCP Server | ||
# Code MCP Server | ||
A Model Context Protocol (MCP) server for VS Code integration, enabling AI assistants to interact with VS Code. | ||
A Model Context Protocol (MCP) server for VS Code integration, enabling AI agents like Goose or Claude to interact with VS Code. | ||
@@ -13,3 +13,3 @@ ## Features | ||
You can install the VS Code MCP Server using npx: | ||
You can install the Code MCP Server using npx: | ||
@@ -33,4 +33,4 @@ ```bash | ||
```bash | ||
git clone https://github.com/your-repo/vscode-mcp.git | ||
cd vscode-mcp/server | ||
git clone https://github.com/block/code-mcp.git | ||
cd code-mcp/server | ||
``` | ||
@@ -44,3 +44,3 @@ | ||
This will create a file like `vscode-mcp-server-1.0.0.tgz` in the current directory. | ||
This will create a file like `vscode-mcp-server-X.X.X.tgz` in the current directory. | ||
@@ -50,13 +50,5 @@ 3. Install the package globally from the local tarball: | ||
```bash | ||
npm install -g ./vscode-mcp-server-1.0.0.tgz | ||
npm install -g ./vscode-mcp-server-X.X.X.tgz | ||
``` | ||
## Updating | ||
To update to the latest version: | ||
```bash | ||
npx vscode-mcp-server update | ||
``` | ||
## Usage | ||
@@ -78,4 +70,4 @@ | ||
- ID: `vscode-mcp-server` | ||
- Name: `VS Code MCP Server` | ||
- Description: `Allows interaction with VS Code through the Model Context Protocol` | ||
- Name: `VSCode MCP Server` | ||
- Description: `Allows interaction with VSCode through the Model Context Protocol` | ||
- Command: `npx vscode-mcp-server` | ||
@@ -93,3 +85,3 @@ | ||
"mcpServers": { | ||
"vscode": { | ||
"vscode-mcp-server": { | ||
"command": "npx", | ||
@@ -112,3 +104,3 @@ "args": ["vscode-mcp-server"], | ||
### Automated Publishing with GitHub Actions | ||
### Automated Publishing with GitHub Actions (WIP) | ||
@@ -115,0 +107,0 @@ 1. release.yml: Automatically creates a new release when you push to the main branch with conventional commit messages |
52100
2.54%1123
3.03%123
-6.11%