@patruff/server-codesnip
v0.1.0
Published
MCP server for making targeted code snippet edits
Downloads
3
Readme
CodeSnip MCP Server
An MCP server for making targeted code snippet edits in files.
Installation
npm install @patruff/server-codesnipUsage
The server provides a single tool edit_snippet that can make precise edits to code files. It requires absolute paths to avoid confusion.
Example usage:
const request = {
name: "edit_snippet",
arguments: {
filePath: "C:/absolute/path/to/your/file.py",
oldSnippet: `def old_function():
print("old code")`,
newSnippet: `def old_function():
print("new code")`
}
};Testing
The repository includes a test script (test_script.py) with a division function that needs a zero check, and a test harness (test.ts) that demonstrates how to use the MCP to fix it.
To run the tests:
npm run build
npm testFeatures
- Makes targeted edits to specific code snippets
- Preserves file indentation and structure
- Returns a git-style diff of changes
- Handles whitespace variations intelligently
- Uses absolute paths for clarity
- Only modifies the exact snippet specified
Requirements
- Node.js >= 16
- TypeScript >= 4.5
