Uses Ollama to run the Osmosis/Osmosis-Apply-1.7B model for applying code edits and merging changes
CodeMerge
A Model Context Protocol (MCP) server that uses the Osmosis-Apply-1.7B model to merge code edits.
- Code Merging: Uses the Osmosis/Osmosis-Apply-1.7B model to apply edits
- MCP Integration: Works as a Model Context Protocol server to integrate into existing AI IDE solutions
- File Operations: Can directly edit files in place or return edited code
Installation
Prerequisites
- Python 3.10 or higher
- Ollama installed and running
- The Osmosis model pulled:
ollama pull Osmosis/Osmosis-Apply-1.7B
Setup
- Clone the repository:
- Install dependencies using uv:
- Run:
Usage
As an MCP Server
CodeMerge can be used as an MCP server. Configure it in your MCP client:
Direct Usage
You can also use CodeMerge directly in Python:
MCP Tool Usage
The MCP server provides an edit_snippet
tool with the following parameters:
original_code
: The exact original code to be editededit_snippet
: The edit to apply, using// ... existing code ...
markersfile_path
: Absolute path to a file to update in place
Example tool call:
Edit Format
CodeMerge uses a specific format for edits that preserves context while being concise:
The // ... existing code ...
markers indicate where the original code should be preserved. This allows you to specify only the parts you want to change while maintaining the exact structure and formatting of the original code.
Dependencies
httpx>=0.28.1
: HTTP client for API callsmcp[cli]>=1.10.1
: Model Context Protocol implementationollama
: Python client for Ollama (installed separately)
Architecture
CodeMerge consists of several components:
codemerge.py
: Main MCP server implementationcall_snippet.py
: Direct usage interface with streaming supporttest_codemerge.py
: Comprehensive test suitepyproject.toml
: Project configuration and dependencies
This server cannot be installed
A Model Context Protocol server that uses Osmosis-Apply-1.7B to intelligently apply code edits while preserving the structure of the original code.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that provides tools for code modification and generation via Large Language Models, allowing users to create, modify, rewrite, and delete files using structured XML instructions.Last updated -12PythonMIT License
- -securityAlicense-qualityA Model Context Protocol (MCP) server implementation that enables LLMs to interact with the Osmosis protocol, allowing for querying and transaction functionality through natural language.Last updated -9TypeScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that helps large language models process code repositories by providing file tree generation, code merging, and code analysis capabilities.Last updated -314JavaScriptMIT License
- AsecurityAlicenseAqualityA comprehensive Model Context Protocol server that provides AI assistants with 158 tools for interacting with the Osmosis blockchain, covering everything from basic queries to direct transaction execution.Last updated -16156JavaScriptMIT License