Skip to main content
Glama

mcp-devtools

npm version CI License: MIT Node.js

通过 Model Context Protocol 实现的 AI 原生开发工具。 一个生产级的 MCP 服务器,为 AI 智能体(Claude、Cursor、Copilot、Continue 等) 提供对本地开发环境的安全、受限访问。

为什么选择它

MCP 生态系统中充斥着单一用途的教程和绑定特定供应商的适配器。 目前还没有一个维护良好、多工具、框架无关且具备生产质量的 MCP 包, 可用于日常开发工具。

mcp-devtools 填补了这一空白,它提供了 14 个工具、3 个 MCP 资源、 4 个 MCP 提示词、一个 插件 API、两种传输模式(stdio + 带认证的 HTTP), 以及一个 审计日志 — 这些功能均基于在 DailyBot 生产环境中提炼的模式构建。

Related MCP server: GPT Commander

快速开始

stdio (默认)

npx @oscarmarin/mcp-devtools

将其添加到 Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "devtools": {
      "command": "npx",
      "args": ["-y", "@oscarmarin/mcp-devtools"]
    }
  }
}

或者 Cursor (~/.cursor/mcp.json):使用相同的代码块。

HTTP 传输

在项目根目录下创建一个 mcp-devtools.json:

{
  "transport": "http",
  "port": 3333,
  "auth": {
    "token": "env:MCP_AUTH_TOKEN"
  }
}

然后启动服务器:

npx @oscarmarin/mcp-devtools

MCP 端点将在 http://localhost:3333 可用。

工具

组别

工具

文件系统

read_file, write_file, list_directory, search_files, get_file_info

数据库

query_db, list_tables, describe_table

进程

run_command, read_logs, get_env, list_processes

OpenAPI

parse_openapi, call_api

各工具参考:docs/tools/。

MCP 资源

服务器通过 MCP 资源公开只读数据:

URI

描述

devtools://tools

所有已注册工具及其模式的目录

devtools://server-info

服务器版本、传输方式、作用域、工具数量

MCP 提示词

针对常见开发工作流精心策划的提示词模板:

提示词

描述

debug_error

使用 mcp-devtools 工具系统地调试错误

code_review

审查文件中的错误、安全问题和代码质量

explore_codebase

探索并理解项目的结构和约定

refactor_function

为可读性、性能或可测试性重构函数

插件 API

使用自定义工具扩展 mcp-devtools — 无需 fork。

基于配置(启动时加载):

{
  "plugins": ["./my-tools.js", "@scope/mcp-plugin-foo"]
}

每个插件模块默认导出一个工具定义数组:

import { defineTool } from "@oscarmarin/mcp-devtools";
import { z } from "zod";

export default [
  defineTool({
    name: "my_tool",
    description: "Does something useful",
    inputSchema: z.object({ input: z.string() }),
    handler: async (args, config) => ({
      ok: true,
      data: { result: args.input.toUpperCase() },
    }),
  }),
];

配置

配置由 cosmiconfig 从 mcp-devtools.json、.mcp-devtoolsrc 或 package.json 中的 mcpDevtools 键加载。 请参阅 mcp-devtools.example.json 和 docs/configuration.md 获取完整模式。

支持零配置:运行 npx @oscarmarin/mcp-devtools 且不带配置时,将使用模式默认值 (RNF-05)。

安全性

四项不可绕过的控制措施:

  1. 文件系统作用域边界。 每个路径都会解析为绝对路径并与 config.scope 进行比较。逃逸出作用域的符号链接将抛出 SCOPE_VIOLATION。

  2. 命令允许列表。 run_command 仅执行基本名称在 allowedCommands 中的二进制文件。调用使用 spawn(file, args)(无 shell),因此通过命令参数进行 shell 注入在结构上是不可能的。

  3. 数据库只读模式。 当 readOnly: true 时,所有 SQL 都会被解析,并且 INSERT/UPDATE/DELETE/DROP/CREATE/GRANT 会被拒绝。查询在 PostgreSQL 中以 BEGIN READ ONLY ... ROLLBACK 方式运行。

  4. HTTP Bearer 认证。 当配置了 auth.token 时,每个 HTTP 请求都必须包含 Authorization: Bearer <token>。比较使用 crypto.timingSafeEqual 以防止时序攻击。

其他安全措施:

  • 审计日志。 可选的 NDJSON 日志,记录每次工具调用,包含时间、脱敏后的输入和结果状态。

  • 密钥掩码。 get_env 会自动掩盖匹配常见密钥模式(SECRET, TOKEN, PASSWORD, KEY 等)的值。

  • OpenAPI 主机限制。 call_api 仅向规范 servers 数组中列出的主机发送请求。

  • 输出上限。 所有工具都会限制其输出以防止上下文溢出(命令为 100KB,文件为 1MB,查询为 200 行)。

贡献

git clone https://github.com/marin1321/mcp-devtools.git
cd mcp-devtools
npm install
npm run dev       # tsup --watch
npm run test      # vitest
npm run typecheck # tsc --noEmit
npm run lint      # eslint .

请参阅 CONTRIBUTING.md 获取完整工作流,并参阅 CODE_OF_CONDUCT.md 获取社区准则。

许可证

MIT © Oscar Humberto Marin Molina — oscarmarindev.com

Available Tools

15 tools
call_apiCall APIC

Invoke an operation defined in an OpenAPI spec.

Inputs: specPath (required), operationId (required), pathParams, queryParams, +2 more.

describe_tableDescribe tableC

Return column metadata for a table in a configured database connection.

Inputs: table (required), connection, schema.

echo_testEcho testA

Returns the provided message and a server-side ISO timestamp. Used to verify the MCP server pipeline end-to-end.

Inputs: message (required).

get_envGet environmentC

Return environment variables (process env or .env file) with optional masking.

Inputs: source, path, keys, maskSecrets.

get_file_infoGet file infoA

Return metadata (size, type, MIME, line count, symlink info) for a file or directory.

Inputs: path (required).

list_directoryList directoryC

List directory entries inside the configured scope, with optional recursion and glob filtering.

Inputs: path, depth, glob, includeHidden.

list_processesList processesB

List running processes, optionally filtered by name or listening port.

Inputs: name, port, limit.

list_tablesList tablesC

List tables in a configured database connection.

Inputs: connection, schema.

parse_openapiParse OpenAPIB

Parse an OpenAPI spec and return a summary of operations.

Inputs: path (required).

query_dbQuery databaseC

Execute a parameterized SQL query against a configured database connection. Read-only by default.

Inputs: sql (required), connection, params, timeoutMs, +1 more.

read_fileRead fileB

Read a text file inside the configured scope. Optionally restrict to a line range.

Inputs: path (required), startLine, endLine.

read_logsRead logsC

Read the tail of a configured log file with optional filter.

Inputs: path (required), tail, filter, jsonField.

run_commandRun commandC

Spawn a process from the configured allowedCommands list. Captures stdout/stderr with caps and a timeout.

Inputs: command (required), args, cwd, timeoutMs, +1 more.

search_filesSearch filesC

Search for a pattern (literal or regex) across files inside the configured scope.

Inputs: pattern (required), path, glob, regex, +4 more.

write_fileWrite fileA

Write a file atomically inside the configured scope (writes to a temp file then renames).

Inputs: path (required), content (required), encoding, createDirs.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 15 tools

    Disambiguation5/5

    Each tool targets a distinct operation: database metadata vs query, file read vs write vs listing vs search, process listing vs command execution, API calling vs spec parsing, etc. No two tools have overlapping purposes.

    Naming Consistency5/5

    All tools follow a verb_noun pattern in snake_case (e.g., list_directory, read_file, query_db). The verbs vary but are appropriate for the action, and the naming is uniform throughout.

    Tool Count4/5

    15 tools is slightly broad for a devtools server covering databases, files, processes, APIs, logs, and environment variables, but each tool has a clear role and the count is not excessive for a general-purpose utility server.

    Completeness3/5

    Core developer utilities are covered (file ops, database queries, command execution, API handling), but there are gaps like no process kill, no file editing, no HTTP utilities, and database is read-only. The set feels like a curated collection rather than a comprehensive toolkit.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Open-source, local macOS MCP server for AI agents. Automate background Safari/Chrome tabs, native apps, files and shell with scoped permissions, optional approvals and delegated coding agents.
      97
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that gives your AI assistant full awareness of your local dev environment — running processes, Docker containers, git state, open ports, log files, and more.
      8 npm
      1
      MIT