Skip to main content
Glama

CodeMerge

by Gulp-AI

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

  1. Clone the repository:
git clone <repository-url> cd codemerge
  1. Install dependencies using uv:
uv sync
  1. Run:
uv run python codemerge.py

Usage

As an MCP Server

CodeMerge can be used as an MCP server. Configure it in your MCP client:

{ "mcpServers": { "codemerge": { "command": "uv", "args": [ "--directory", "/path/to/codemerge", "run", "codemerge.py" ] } } }

Direct Usage

You can also use CodeMerge directly in Python:

from call_snippet import apply_code_edit # Original code original_code = """def hello(): print('Hello, World!') print('Some code') print('Some more code') return 'success'""" # Edit to apply edit_snippet = """def hello(): print('Hello, Universe!') print('Some code') # ... existing code ... return 'success'""" # Apply the edit result = apply_code_edit(original_code, edit_snippet) print(result)

MCP Tool Usage

The MCP server provides an edit_snippet tool with the following parameters:

  • original_code: The exact original code to be edited
  • edit_snippet: The edit to apply, using // ... existing code ... markers
  • file_path: Absolute path to a file to update in place

Example tool call:

{ "name": "edit_snippet", "arguments": { "original_code": "def hello():\n print('Hello, World!')", "edit_snippet": "def hello():\n print('Hello, Universe!')\n # ... existing code ...", "file_path": "/path/to/your/file.py" } }

Edit Format

CodeMerge uses a specific format for edits that preserves context while being concise:

// ... existing code ... FIRST_EDIT // ... existing code ... SECOND_EDIT // ... existing code ... THIRD_EDIT // ... existing code ...

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 calls
  • mcp[cli]>=1.10.1: Model Context Protocol implementation
  • ollama: Python client for Ollama (installed separately)

Architecture

CodeMerge consists of several components:

  • codemerge.py: Main MCP server implementation
  • call_snippet.py: Direct usage interface with streaming support
  • test_codemerge.py: Comprehensive test suite
  • pyproject.toml: Project configuration and dependencies
-
security - not tested
F
license - not found
-
quality - not tested

A Model Context Protocol server that uses Osmosis-Apply-1.7B to intelligently apply code edits while preserving the structure of the original code.

  1. Installation
    1. Prerequisites
    2. Setup
  2. Usage
    1. As an MCP Server
    2. Direct Usage
    3. MCP Tool Usage
  3. Edit Format
    1. Dependencies
      1. Architecture

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          A 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 -
          12
          Python
          MIT License
          • Linux
          • Apple
        • -
          security
          A
          license
          -
          quality
          A 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 -
          9
          TypeScript
          MIT License
          • Apple
        • A
          security
          A
          license
          A
          quality
          A 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 -
          3
          14
          JavaScript
          MIT License
        • A
          security
          A
          license
          A
          quality
          A 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 -
          161
          56
          JavaScript
          MIT License

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/Gulp-AI/Osmosis-Apply-1.7B-MCP'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server