Détail du package

@morph-llm/morph-fast-apply

morph-llm17.9kMIT0.8.1

MCP server with Morph AI-powered file editing using fast apply model and abbreviated edit snippets (obfuscated)

readme

Morph Fast Apply MCP Server

Node.js server implementing Model Context Protocol (MCP) for filesystem operations with AI-powered file editing using Morph's fast apply model.

Features

  • AI-Powered File Editing - Advanced edit_file tool using Morph's fast apply model for intelligent code merging
  • Read/write files with memory-efficient head/tail operations
  • Create/list/delete directories with detailed metadata
  • Move files/directories
  • Search files with exclude patterns
  • Get comprehensive file metadata
  • Dynamic directory access control via Roots
  • Workspace-aware path resolution and automatic workspace detection

Set MORPH_API_KEY environment variable to enable AI-powered editing features.

Environment Variables

ALL_TOOLS - Control Tool Availability

This server supports two modes via the ALL_TOOLS environment variable:

ALL_TOOLS="false" (Recommended) - Fast file editing only

  • Only exposes the edit_file tool for lightning-fast code edits
  • Minimal surface area, maximum performance
  • Perfect for AI assistants focused on code editing

ALL_TOOLS="true" - Full filesystem access

  • Exposes all filesystem tools: read_file, write_file, list_directory, search_files, etc.
  • Complete MCP filesystem server functionality
  • Use when you need comprehensive file system operations
# Fast editing mode (recommended)
export ALL_TOOLS="false"
export MORPH_API_KEY="sk-your-morph-api-key-here"

# Full filesystem mode  
export ALL_TOOLS="true"
export MORPH_API_KEY="sk-your-morph-api-key-here"

MCP Roots (Recommended)

MCP clients can dynamically update allowed directories via Roots.

Key Tools

AI-Powered Editing

  • edit_file - Advanced AI-powered file editing using Morph's fast apply model with intelligent code merging (requires MORPH_API_KEY)

File Operations

  • read_file - Read file contents with optional head/tail parameters for large files
  • read_multiple_files - Read multiple files simultaneously
  • write_file - Create/overwrite files with atomic operations
  • tiny_edit_file - Make small line-based edits with git-style diff output

Directory Operations

  • create_directory - Create directories recursively
  • list_directory - List directory contents
  • list_directory_with_sizes - List directory contents with file sizes and sorting
  • directory_tree - Get recursive JSON tree structure
  • move_file - Move/rename files and directories

Search & Info

  • search_files - Search for files recursively with exclude patterns
  • get_file_info - Get comprehensive file metadata
  • list_allowed_directories - Show accessible directories

AI-Powered Editing with Morph

This server uses Morph's fast apply model API for intelligent code merging at 4500+ tokens/second with 99.2% accuracy. The edit_file tool processes code edits by taking initial code and edit snippets, then merging them intelligently using special "// ... existing code ..." comments for unchanged sections.

Getting a Morph API Key

  1. Visit Morph to sign up for an API key
  2. Set the MORPH_API_KEY environment variable in your MCP configuration
  3. API keys typically start with sk- or morph-

Code Obfuscation

This package includes obfuscated code for production deployment while maintaining the same functionality and API compatibility.

Usage with Claude Desktop

Add to your Claude Desktop configuration file (claude_desktop_config.json):

NPX (Recommended)

{
  "mcpServers": {
    "morph-fast-apply": {
      "command": "npx",
      "args": ["-y", "@morph-llm/morph-fast-apply"],
      "env": {
        "MORPH_API_KEY": "sk-your-morph-api-key-here",
        "ALL_TOOLS": "false"
      }
    }
  }
}

Docker

{
  "mcpServers": {
    "morph-fast-apply": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "--mount", "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop",
        "morph-llm/morph-fast-apply", "/projects"
      ],
      "env": {
        "MORPH_API_KEY": "sk-your-morph-api-key-here",
        "ALL_TOOLS": "false"
      }
    }
  }
}

Usage with Claude Code

One-liner Installation (Recommended)

claude mcp add filesystem-with-morph -e MORPH_API_KEY=sk-your-morph-api-key-here -e ALL_TOOLS=false -- npx @morph-llm/morph-fast-apply

💡 Pro tip: Configure Claude to always use Morph for edits by adding this to your project:

mkdir -p .claude
echo "IMPORTANT: ALWAYS use mcp_filesystem-with-morph_edit_file tool to make any code edits. Do not use the default edit tool." > .claude/CLAUDE.md

Config File Method

Add to your .claude.json file:

{
  "mcpServers": {
    "filesystem-with-morph": {
      "command": "npx",
      "args": [
        "@morph-llm/morph-fast-apply"
      ],
      "env": {
        "MORPH_API_KEY": "sk-your-morph-api-key-here",
        "ALL_TOOLS": "false"
      }
    }
  }
}

Manual Usage

For direct command-line usage or custom integrations:

# Set environment variables
export MORPH_API_KEY="sk-your-morph-api-key-here"
export ALL_TOOLS="false"  # or "true" for full filesystem access

# Run the MCP server
npx @morph-llm/morph-fast-apply

Usage with VS Code

For quick installation, click the installation buttons below...

Install with NPX in VS Code Install with NPX in VS Code Insiders

Install with Docker in VS Code Install with Docker in VS Code Insiders

For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P and typing Preferences: Open Settings (JSON).

Optionally, you can add it to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with others.

Note that the mcp key is not needed in the .vscode/mcp.json file.

You can provide sandboxed directories to the server by mounting them to /projects. Adding the ro flag will make the directory readonly by the server.

Docker

Note: all directories must be mounted to /projects by default. Remember to set your MORPH_API_KEY for AI-powered editing.

{
  "mcp": {
    "servers": {
      "morph-fast-apply": {
        "command": "docker",
        "args": [
          "run",
          "-i",
          "--rm",
          "--mount", "type=bind,src=${workspaceFolder},dst=/projects/workspace",
          "morph-llm/morph-fast-apply",
          "/projects"
        ],
        "env": {
          "MORPH_API_KEY": "sk-your-morph-api-key-here",
          "ALL_TOOLS": "false"
        }
      }
    }
  }
}

NPX

{
  "mcp": {
    "servers": {
      "morph-fast-apply": {
        "command": "npx",
        "args": [
          "-y",
          "@morph-llm/morph-fast-apply",
          "${workspaceFolder}"
        ],
        "env": {
          "MORPH_API_KEY": "sk-your-morph-api-key-here",
          "ALL_TOOLS": "false"
        }
      }
    }
  }
}