LocalDev MCP

LocalDev MCP

A guarded Model Context Protocol server that lets AI assistants inspect, edit, test, and validate explicitly approved local software projects, featuring 49 focused MCP tools for project discovery, safe editing, Git inspection, Laravel integration testing, and more.

Category
访问服务器

README

LocalDev MCP

CI Node.js TypeScript License: MIT

A guarded Model Context Protocol server that lets AI assistants inspect, edit, test, and validate explicitly approved local software projects.

LocalDev MCP is designed for practical coding workflows without exposing a general-purpose terminal. File access, Git operations, process execution, Laravel integration testing, secrets, HTTP requests, and database inspection all use narrow, reviewable policies.

Highlights

  • 49 focused MCP tools for project discovery, centrally installed skills, code search, safe editing, binary file import, Git inspection, tests, builds, Laravel diagnostics, integration testing, and validation.
  • Project allowlisting through a local configuration file.
  • SHA-256 concurrency protection before modifying, replacing, renaming, deleting, or overwriting existing files.
  • Direct binary file import from mounted MCP file inputs without Base64 conversion, with source-root allowlisting and MIME/hash verification.
  • Batch operations for fast reads and multi-file patches with rollback attempts.
  • Guarded Git branch switching with clean-tree checks, branch-name validation, expected-HEAD verification, and dry-run support.
  • Risk-classified custom Artisan commands instead of unrestricted shell execution.
  • Guarded multiline Laravel Tinker execution through ephemeral scripts outside the target repository.
  • In-memory HMAC and digest operations using explicitly approved .env keys without returning the secret value.
  • Loopback-only HTTP requests with redirect revalidation and sensitive-header redaction.
  • Managed temporary Laravel servers that can automatically select an available loopback port and can stop only processes started by the same MCP instance.
  • Structured database snapshots and assertions without model-supplied raw SQL.
  • Secret-aware path blocking and output redaction.
  • MCP-native skill registry with progressive disclosure through list_skills, get_skill, and read_skill_reference.
  • Bundled Frontend Craft Director for design, redesign, implementation, responsive fixes, anti-AI-slop review, and rendered visual QA.
  • Configurable command timeouts up to 3,600 seconds for long-running builds, tests, installs, and validation workflows.

Architecture

MCP Client
   |
   v
LocalDev MCP (stdio)
   |
   +-- Project configuration allowlist
   +-- Central MCP-native skill registry
   +-- Path, upload-source, and secret guards
   +-- SHA-256 write and binary-import protection
   +-- Command and Laravel risk policies
   +-- Loopback HTTP enforcement
   +-- Managed-process ownership
   +-- Audit, backup, and cache layers
   |
   v
Approved local repositories only

Tool groups

Skills

list_skills, get_skill, read_skill_reference

Project discovery and reading

list_projects, get_project_info, get_project_snapshot, get_project_tree, list_directory, read_file, batch_read_files, search_files, search_code

Safe file editing and import

import_file_to_project, write_file, create_file, replace_text, apply_patch, batch_apply_patches, rename_file, delete_file

Git and validation

git_status, git_diff, git_switch_branch, inspect_changed_files, run_command, run_tests, run_validation_plan

Laravel and PHP

read_laravel_logs, inspect_routes, inspect_database_schema, run_artisan, laravel_run_artisan, laravel_tinker_execute, laravel_database_snapshot, laravel_database_assert, run_phpunit, run_pest, composer_install, clear_laravel_cache, restart_queue_workers

Local Laravel integration testing

local_secret_operation, local_http_request, start_local_process, inspect_local_process, stop_local_process

Frontend and Node.js

run_npm, run_eslint, run_build, npm_install

Binary file import

import_file_to_project accepts a real MCP file input in source_file and copies the mounted file directly into an allowlisted project. Binary data is streamed as bytes; it is never converted to Base64 or passed through text encoding.

Inputs:

  • project: configured project key.
  • source_file: uploaded file input advertised to the MCP client with schema type: "file".
  • destination: project-relative destination. Absolute paths, .. traversal, secret-like destinations, and symlink escapes are rejected.
  • overwrite: defaults to false. Existing files are refused unless explicitly enabled.
  • createParents: defaults to true.
  • expectedSha256: optional concurrency check for the existing destination when overwriting.

The result contains path, size, mimeType, and sha256. PNG, JPEG, WEBP, SVG, PDF, and common additional formats are detected from file signatures when available, with extension fallback for unknown data.

Uploaded source paths must be inside an approved mount root. By default, LocalDev MCP accepts files under the operating system temporary directory. Set one or more explicit roots when the tunnel mounts uploads elsewhere:

LOCALDEV_MCP_IMPORT_ROOTS=C:\path\to\tunnel\uploads

On Windows, separate multiple roots with ;; on macOS or Linux, use :. The default maximum import size is 100 MiB. It can be changed up to 1 GiB:

LOCALDEV_MCP_MAX_IMPORT_BYTES=209715200

Secret-like source names such as .env, private-key formats, and credential files are rejected. Overwrites create a local binary backup before replacement and verify the final destination hash.

Laravel integration workflow

Custom Artisan commands

laravel_run_artisan classifies commands as:

  • READ_ONLY
  • REVERSIBLE_LOCAL_WRITE
  • IRREVERSIBLE_LOCAL_WRITE
  • EXTERNAL_SIDE_EFFECT

Unknown project-specific commands are not assumed to be harmless. Add known read-only commands to readOnlyArtisanCommands; otherwise explicit approval is required for reversible local writes. Irreversible database commands and long-running or external-side-effect Artisan commands are blocked; dedicated MCP process tools must be used where available. Production flags such as --force and --env remain blocked.

Both run_artisan and laravel_run_artisan accept project-specific commands explicitly configured as read-only. Generic run_command deliberately keeps php artisan tinker and php -r blocked and directs callers to the dedicated Laravel tools instead.

JSON output mode accepts a valid JSON document even when the framework prints notices before or after it.

Guarded multiline Tinker

laravel_tinker_execute:

  • Executes multiline PHP through an ephemeral script outside the repository.
  • Removes the temporary script in finally.
  • Disables process, filesystem, network, dynamic-loading, and environment-access functions.
  • Blocks raw SQL and secret-file access patterns.
  • Detects common database-write operations and requires allowDatabaseWrite=true.
  • Supports none, rollback, and commit transaction modes.
  • Returns only sanitized output and a SHA-256 hash of the submitted code in audit records.

For tests that must expose a temporary database change to a second process, snapshot the original value, apply the reviewed change, and restore the exact snapshot in a finally step. For single-process temporary changes, use transactionMode: "rollback".

Secrets and HMAC

local_secret_operation can use only keys listed in allowedSecretEnvKeys for the selected project. The secret value:

  • Is read directly from .env into memory.
  • Is not returned to the MCP client.
  • Is not written to a temporary file.
  • Is not placed on the command line.
  • Is not included in audit logs.
  • Is used only for the requested presence check, HMAC, or digest operation.

Loopback-only HTTP

local_http_request accepts only:

localhost
127.0.0.1
::1

The host must resolve exclusively to loopback addresses. Redirect targets are validated again before following them. Requests to public domains, private-network addresses, or other IPs are rejected. Authorization, cookie, API-key, and webhook-signature headers are redacted from returned metadata.

Managed Laravel server

start_local_process starts only php artisan serve on a loopback host. Set port: 0 to select an available ephemeral port automatically. Explicit occupied ports are rejected.

stop_local_process accepts only a session ID created by the same MCP server instance for the same project. LocalDev MCP does not adopt or terminate unrelated operating-system processes.

Database assertions

laravel_database_snapshot and laravel_database_assert accept structured table, column, equality-filter, ordering, and bounded-limit inputs. Raw SQL is not accepted.

MCP-native skills

Skills live under skills/<skill-name>/ and are available to every configured project without copying them into application repositories.

The bundled skill is:

frontend-craft-director

Recommended frontend invocation:

@LocalDev

Project: <project-key>

Use the frontend-craft-director skill as the mandatory workflow for this frontend task.
Load the skill before editing files, inspect the real repository, produce a Design Read,
preserve routes/APIs/behavior, do not install packages without approval, run repository
validation, and report rendered visual-QA evidence honestly.

Requirements

  • Node.js 22 or newer
  • npm
  • Git
  • Optional: PHP and Composer for Laravel/PHP projects
  • Optional: ripgrep (rg) for faster code search

Installation

git clone https://github.com/mehrdad03/localdev-mcp.git
cd localdev-mcp
npm ci
npm run typecheck
npm run build
npm run smoke

Configure approved projects

Copy the example to a private local configuration:

Windows PowerShell

Copy-Item projects.example.json projects.local.json

macOS or Linux

cp projects.example.json projects.local.json

projects.local.json is preferred automatically when it exists. Otherwise LocalDev MCP falls back to projects.json. Both names are ignored by Git.

Example Laravel project configuration:

{
  "projects": {
    "my-laravel-app": {
      "root": "C:\\Projects\\my-laravel-app",
      "stack": ["laravel", "vue", "vite"],
      "phpExecutable": "C:\\path\\to\\php.exe",
      "allowedSecretEnvKeys": ["WEBHOOK_APP_SECRET"],
      "readOnlyArtisanCommands": ["integration:readiness"]
    }
  }
}

Configuration fields:

  • root: approved project root.
  • stack: descriptive project stack.
  • phpExecutable: optional project-specific PHP executable.
  • allowedSecretEnvKeys: .env keys approved only for in-memory secret operations and output redaction.
  • readOnlyArtisanCommands: project-specific commands that are verified to be read-only.

An alternative configuration file can be supplied through:

LOCALDEV_MCP_PROJECTS=/absolute/path/to/projects.json

Run the server

npm start

The server communicates over MCP stdio. Configure the MCP client to launch:

command: node
args: [<absolute-path>/dist/index.js]

Validation

npm run typecheck
npm run build
npm run smoke
npm run integration-smoke
npm run laravel-tools-smoke
npm run file-import-smoke
npm run benchmark

The generic smoke suites are self-contained and do not depend on private application repositories.

Security defaults

  • Only roots listed in the selected local project configuration are accessible.
  • Absolute target paths and .. traversal are rejected.
  • File imports accept sources only from configured upload roots, reject source and destination symlinks, and stream bytes without Base64 conversion.
  • .env, credentials, private keys, .git, vendor, and node_modules are blocked from normal file tools and imports.
  • Existing-file changes require the SHA-256 value returned by a read tool; binary imports support the same check when overwriting.
  • Patch, replace, rename, and delete operations create local backups.
  • Batch patching validates every target before writing and attempts rollback after partial failure.
  • Arbitrary executables, shell operators, deployments, production flags, destructive database operations, and destructive Git commands are blocked or require explicit risk-specific confirmation.
  • Tinker code cannot directly access files, environment variables, network sockets, process functions, or raw SQL execution helpers.
  • HTTP integration requests are restricted to loopback hosts and revalidate redirects.
  • Commands and sensitive operations are audited locally under logs/audit.log without recording approved secret values.

See SECURITY.md for the security model and reporting guidance.

Deliberate limitations

LocalDev MCP is not an operating-system sandbox, deployment agent, browser automation platform, or unrestricted terminal. Run it only on a trusted development machine, keep the project allowlist narrow, and review write approvals before execution.

Example workflow

1. get_skill when a governing workflow applies
2. get_project_snapshot
3. search_code / batch_read_files
4. apply_patch / batch_apply_patches
5. laravel_run_artisan / laravel_tinker_execute when integration work requires them
6. start_local_process -> local_http_request -> database assertions -> stop_local_process
7. restore temporary state in finally
8. run_tests / run_validation_plan
9. inspect_changed_files
10. git_switch_branch when a clean branch transition is required

License

MIT License. See LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选