Skip to main content
Glama
https://github.com/Streen9/react-mcp

https://github.com/Streen9/react-mcp

React MCP(模型上下文协议)

铁匠徽章

强大的服务器实现,使 Claude AI 能够通过模型上下文协议与 React 应用程序进行交互。

示例用法

Related MCP server: MCP-Claude Code Bridge

概述

React MCP 在 Claude AI 和 React 生态系统之间架起了一座桥梁,使 Claude 能够:

  • 创建新的 React 应用程序

  • 运行 React 开发服务器

  • 管理文件和目录

  • 安装 npm 包

  • 执行终端命令

  • 跟踪和管理长期运行的流程

该服务器实现了模型上下文协议,为 Claude 提供了在开发环境中执行真实世界操作的能力。

特征

  • React 项目管理

    • 使用可选模板创建新的 React 应用程序

    • 运行开发服务器

    • 管理依赖项

  • 文件操作

    • 读取和写入文件

    • 编辑 React 组件和配置

  • 流程管理

    • 启动并监控长时间运行的进程

    • 实时跟踪过程输出

    • 在需要时终止进程

  • 命令执行

    • 运行任意终端命令

    • 安装 npm 包

    • 执行开发任务

  • 综合测井

    • 详细的 JSON 和文本日志

    • 使用时间戳进行进程跟踪

    • 执行历史记录

安装

  1. 克隆此存储库

  2. 安装依赖项:

npm install

用法

在claude_desktop_config中添加以下内容:

{
  "mcpServers": {
    "react-mcp": {
      "command": "node",
      "args": [
        "C:/Users/kalip/OneDrive/Desktop/react-mcp/index.js"
      ]
    },
  }
}

该服务器在 stdio 传输上运行,允许它与桌面 Claude APP 一起用作模型上下文协议工具。

可用工具

create-react-app

创建一个新的 React 应用程序。

参数:

  • name (必填):React 应用程序的名称

  • template (可选):要使用的模板(例如,typescript、cra-template-pwa)

  • directory (可选):创建应用程序的基本目录(默认为主目录)

run-react-app

以开发模式运行 React 应用程序。

参数:

  • projectPath (必需):React 项目文件夹的路径

run-command

运行终端命令。

参数:

  • command (必需):要执行的命令

  • directory (可选):运行命令的目录(默认为当前目录)

get-process-output

获取正在运行或已完成的进程的输出。

参数:

  • processId (必需):获取输出的进程的 ID

stop-process

停止正在运行的进程。

参数:

  • processId (必需):要停止的进程的 ID

list-processes

列出所有正在运行的进程。

edit-file

创建或编辑文件。

参数:

  • filePath (必需):要编辑的文件的路径

  • content (必需):要写入文件的内容

read-file

读取文件的内容。

参数:

  • filePath (必需):要读取的文件路径

install-package

在项目中安装 npm 包。

参数:

  • packageName (必需):要安装的包的名称(可以包含版本)

  • directory (可选):项目目录(默认为当前目录)

  • dev (可选):是否作为开发依赖项安装

check-installation-status

检查包安装过程的状态。

参数:

  • processId (必需):要检查的安装过程的 ID

日志记录

服务器在logs目录中维护详细日志:

  • react-mcp-logs.json :结构化 JSON 日志

  • react-mcp-logs.txt :人类可读的文本日志

建筑学

该服务器使用以下关键组件:

  • 模型上下文协议 SDK :用于与 Claude AI 进行通信

  • StdioServerTransport :通过标准输入/输出进行 I/O

  • Zod :用于模式验证和类型安全

  • 子进程:用于生成和管理外部进程

执照

麻省理工学院

作者

@streen9

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

Available Tools

9 tools
create-react-appC

Create a new React application

Inputs: name (required), template, directory.

edit-fileC

Create or edit a file

Inputs: content (required), filePath (required).

get-process-outputB

Get the output from a running or completed process

Inputs: processId (required).

install-packageC

Install a npm package in a project

Inputs: packageName (required), dev, directory.

list-processesA

List all running processes

Inputs: no named parameters.

read-fileB

Read the contents of a file

Inputs: filePath (required).

run-commandC

Run a terminal command

Inputs: command (required), directory.

run-react-appC

Run a React application in development mode

Inputs: projectPath (required).

stop-processB

Stop a running process

Inputs: processId (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 9 tools

    Disambiguation4/5

    Tools are mostly distinct: process management (list, stop, get output), file operations (read/edit), and React-specific actions (create/run app) are clearly separated. However, 'run-react-app' and generic 'run-command' could be confused if an agent doesn't read descriptions, and 'run-command' overlaps slightly with the dev server startup.

    Naming Consistency5/5

    All tools follow a consistent verb_noun snake_case pattern (e.g., stop-process, create-react-app, list-processes). No deviations or mixed conventions, making the naming predictable and intuitive.

    Tool Count5/5

    With 9 tools, the server covers the core React development workflow (create, run, manage processes, edit files, install packages) without redundancy. Each tool serves a clear purpose and the count is well within the ideal 3-15 range.

    Completeness4/5

    The toolset covers the essential React development lifecycle: project creation, dev server management, file editing, package installation, and process monitoring. Minor gaps like build/test commands or file deletion are missing but agents can work around them using run-command or edit-file.

    Related MCP Connectors

    Related MCP Servers