MM

mizchi/mcp-reloader

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

11 stars 2 forks 质量 66 趋势 18MIT

Hot-reload server for Model Context Protocol (MCP) with dynamic tool loading

概览

A hot-reload development tool for building MCP (Model Context Protocol) servers with Claude Code. This tool enables Claude Code to dynamically reload MCP tools as they are modified, making it perfect for iterative development where Claude Code can write and test MCP tools in real-time. MCP Reloader is specifically designed for developers using Claude Code to build MCP tools. It solves the common development pain point where MCP clients need to be restarted whenever server tools are modified. By implementing file watching and the tools/list_changed notification, Claude Code can modify tools and immediately test them without manual restarts.

README

以下为原文 README 节选,完整内容请查看原文。

MCP Reloader

A hot-reload development tool for building MCP (Model Context Protocol) servers with Claude Code. This tool enables Claude Code to dynamically reload MCP tools as they are modified, making it perfect for iterative development where Claude Code can write and test MCP tools in real-time.

Overview

MCP Reloader is specifically designed for developers using Claude Code to build MCP tools. It solves the common development pain point where MCP clients need to be restarted whenever server tools are modified. By implementing file watching and the tools/list_changed notification, Claude Code can modify tools and immediately test them without manual restarts.

Key Features for Claude Code Development

  • Real-time Tool Development: Claude Code can write, modify, and test MCP tools without restarts
  • Dynamic Tool Loading: Automatically loads JavaScript tools from tools/ directory
  • Instant Feedback Loop: Changes are reflected immediately in the MCP client
  • File Watching: Uses chokidar to detect file changes in real-time
  • Process Wrapping: Wrap any LSP/MCP process with hot-reload capabilities
  • Auto-restart on Config Changes: Watch configuration files and restart when needed

Quick Start with Claude Code

1. Create a new MCP project

mkdir my-mcp-tools
cd my-mcp-tools
mkdir tools

2. Configure Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "my-tools": {
      "command": "npx",
      "args": ["mcp-reloader"],
      "cwd": "/path/to/my-mcp-tools"
    }
  }
}

3. Ask Claude Code to create tools

Now Claude Code can create and modify tools in the tools/ directory, and they will be automatically available without restarting Claude Desktop!

Example: Claude Code Creating Tools

Here’s how Claude Code can create a tool that will be immediately available:

// tools/search-files.js
export default {
  name: "search_files",
  description: "Search for files matching a pattern",
  inputSchema: {
    type: "object",
    properties: {
      pattern: {
        type: "string",
        description: "Glob pattern to search for files"
      },
      directory: {
        type: "string",
        description: "Directory to search in",
        default: "."
      }
    },
    required: ["pattern"]
  },
  handler: async ({ pattern, directory = "." }) => {
    const { glob } = await import('glob');
    const files = await glob(pattern, { cwd: directory });
    return `Found ${files.length} files:\n${files.join('\n')}`;
  }
};

Claude Code can create this file, and it will be immediately available to use!

Installation

# Global installation
npm install -g mcp-reloader

# Or use directly with npx (recommended)
npx mcp-reloader --help

Usage

Basic Server Start

# Start default MCP server with hot-reload
npx mcp-reloader

# Or if installed globally
mcp-reloader

Using Include Patterns

在 GitHub 查看完整 README

安装

npx mcp-reloader
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "my-tools": { "command": "npx", "args": ["mcp-reloader"], "cwd": "/path/to/my-mcp-tools" } } }