New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

morph-mcp

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

morph-mcp

Unified MCP server with AI-powered file editing (Morph Fast Apply) and intelligent code search (Fast Context Search)

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Morph MCP

Unified Model Context Protocol (MCP) server providing AI-powered file editing and intelligent code search capabilities.

Features

AI-Powered Tools

  • Fast Apply (edit_file) - Morph's lightning-fast code editing at 4500+ tokens/sec with 99.2% accuracy
  • Fast Context Search (fast_context_search) - AI-powered code search that intelligently explores repositories to find relevant code

Filesystem Operations

  • 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

Security & Access Control

  • Dynamic directory access control via MCP Roots
  • Workspace-aware path resolution
  • Automatic workspace detection
  • Atomic file operations with temp files for safety

Configuration

Environment Variables

VariableDescriptionDefault
MORPH_API_KEYYour Morph API key (required for AI tools)-
ENABLED_TOOLSComma-separated list of enabled tools, or allall
MORPH_DEBUGEnable debug logging for grep agent (true/false)false
ENABLE_WORKSPACE_MODEAuto-detect workspace root (true/false)true
WORKSPACE_ROOTOverride workspace root directory$PWD

Tool Configuration

Control which tools are available using ENABLED_TOOLS:

# Enable all tools (default)
ENABLED_TOOLS=all

# Only AI-powered tools
ENABLED_TOOLS=edit_file,fast_context_search

# Only fast apply
ENABLED_TOOLS=edit_file

# Only context search
ENABLED_TOOLS=fast_context_search

# Custom selection
ENABLED_TOOLS=read_file,write_file,edit_file,fast_context_search

Available Tools

AI-Powered Tools

edit_file

PRIMARY TOOL FOR EDITING FILES - Efficiently edit existing files by smartly showing only changed lines. Uses Morph's fast apply model for intelligent code merging.

Key features:

  • 4500+ tokens/sec with 99.2% accuracy
  • Smart context preservation with // ... existing code ...
  • Batch multiple edits to the same file
  • Git-style diff output

Requires: MORPH_API_KEY

Intelligently search and gather relevant code context from a repository using an AI-powered search agent. Automatically explores the codebase with grep, file reading, and directory analysis.

Example queries:

  • "Where is JWT token validation implemented?"
  • "How does the authentication middleware work?"
  • "Find the database connection setup"

Requires: MORPH_API_KEY

File Operations

  • read_file - Read complete file contents with optional head/tail
  • read_multiple_files - Read multiple files simultaneously
  • write_file - Create or overwrite files
  • tiny_edit_file - Make small line-based edits with diff output

Directory Operations

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

Search & Info

  • search_files - Recursively search with exclude patterns
  • get_file_info - Get detailed file metadata
  • list_allowed_directories - Show accessible directories

Installation

For Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "morph-mcp": {
      "command": "npx",
      "args": ["-y", "morph-mcp"],
      "env": {
        "MORPH_API_KEY": "sk-your-morph-api-key-here",
        "ENABLED_TOOLS": "all"
      }
    }
  }
}

For Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "morph-mcp": {
      "command": "npx",
      "args": ["-y", "morph-mcp"],
      "env": {
        "MORPH_API_KEY": "sk-your-morph-api-key-here",
        "ENABLED_TOOLS": "all"
      }
    }
  }
}

One-liner installation:

claude mcp add morph-mcp -e MORPH_API_KEY=sk-your-morph-api-key-here -e ENABLED_TOOLS=all -- npx morph-mcp

Docker

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

VS Code

For quick installation, click the installation buttons below:

Install with NPX in VS Code

Or manually add to .vscode/mcp.json:

{
  "mcp": {
    "servers": {
      "morph-mcp": {
        "command": "npx",
        "args": ["-y", "morph-mcp", "${workspaceFolder}"],
        "env": {
          "MORPH_API_KEY": "sk-your-morph-api-key-here",
          "ENABLED_TOOLS": "all"
        }
      }
    }
  }
}

Getting Started

1. Get Your Morph API Key

  • Sign up at Morph
  • Get your API key from the dashboard
  • API keys typically start with sk- or morph-

2. Choose Your Configuration

For fast editing only:

{
  "env": {
    "MORPH_API_KEY": "sk-...",
    "ENABLED_TOOLS": "edit_file"
  }
}

For code search only:

{
  "env": {
    "MORPH_API_KEY": "sk-...",
    "ENABLED_TOOLS": "fast_context_search"
  }
}

For everything (recommended):

{
  "env": {
    "MORPH_API_KEY": "sk-...",
    "ENABLED_TOOLS": "all"
  }
}

3. Test Your Setup

In your AI assistant, try:

  • Edit test: "Use the edit_file tool to add a comment to the main function"
  • Search test: "Use fast_context_search to find where database connections are initialized"

Usage Examples

Fast Apply Editing

Ask AI: "Use the edit_file tool to add error handling to this function"

The AI will:
1. Read the current code
2. Generate smart edit instructions with "// ... existing code ..."
3. Apply changes at 4500+ tokens/sec
4. Show you a git-style diff
Ask AI: "Use fast_context_search to find where JWT tokens are validated"

The agent will:
1. Explore the repository using grep, read, and analyse tools
2. Find relevant code across multiple files
3. Return precise line ranges with full context
4. Display formatted XML output with line numbers

Migration Guide

From @morph-llm/morph-fast-apply

Old config:

{
  "env": {
    "MORPH_API_KEY": "sk-...",
    "ALL_TOOLS": "false"
  }
}

New config:

{
  "env": {
    "MORPH_API_KEY": "sk-...",
    "ENABLED_TOOLS": "edit_file"
  }
}

From morph-codeseek

Old config:

{
  "env": {
    "GREP_AGENT_API_KEY": "sk-..."
  }
}

New config:

{
  "env": {
    "MORPH_API_KEY": "sk-...",
    "ENABLED_TOOLS": "fast_context_search"
  }
}

Architecture

Modular Design

morph-mcp/
├── index.ts              # Main server & tool registry
├── grep/                 # Fast context search agent
│   ├── agent/           # Multi-round exploration logic
│   ├── tools/           # Grep, read, analyse, finish
│   └── utils/           # Ripgrep, file finder, logger
├── morph-client.ts      # Morph API integration
└── path-*.ts            # Security & validation

Security

  • Path validation for all filesystem operations
  • Atomic file writes with temp files
  • Symlink protection
  • Dynamic directory access via MCP roots
  • API key validation at startup

Troubleshooting

Tools Not Showing Up

  • Check API key is set: MORPH_API_KEY=sk-...
  • Verify tools are enabled: ENABLED_TOOLS=all
  • Restart your AI assistant completely
  • Check logs: tail -f ~/Library/Logs/Claude/mcp*.log

Fast Context Search Not Finding Code

  • Ensure you're passing the correct repository path
  • Try more specific queries
  • Enable debug logging: MORPH_DEBUG=true
  • Check debug logs in ${TMPDIR}/morph-codeseek-debug/

Permission Errors

  • Check allowed directories: Use list_allowed_directories tool
  • Verify workspace mode is enabled: ENABLE_WORKSPACE_MODE=true
  • Pass directory explicitly via command-line args

Performance

FeatureSpeedAccuracy
Fast Apply (edit_file)4500+ tok/sec99.2%
Context Search4 rounds, <30sHigh relevance
File OperationsNative speed100%

Support

License

MIT License - See LICENSE file for details

Credits

Built by Morph - Making AI code editing fast and accurate.

FAQs

Package last updated on 11 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts