Skip to main content
Glama

dev-tools-mcp

CI License: MIT

一个 MCP(Model Context Protocol)stdio 服务器,为 Claude Code 或任何 MCP 客户端提供五个结构化的开发工具:

#

工具

功能

1

run_e2e_tests

运行 Playwright 测试,启动开发服务器,返回每个测试的通过/失败结果

2

execute_sql_as_role

以带 JWT 声明的 Postgres 角色执行 SQL — 验证 Supabase RLS

3

typecheck

运行 tsc --noEmit,返回结构化错误(文件、行、代码、消息)

4

npm_run

运行任意 npm 脚本,将 Vitest/Jest 输出解析为结构化结果

5

nextjs_build

运行 next build,返回结构化错误 + 带大小的页面列表

前提条件

  • Node.js ≥ 18

  • 已安装 Claude Code

  • 对于 RLS 工具:psql 在 PATH 中,并且有一个正在运行的 Supabase/Postgres 实例

快速开始

# 1. Clone the repo
git clone https://github.com/briancox730/dev-tools-mcp.git
cd dev-tools-mcp

# 2. Install dependencies
npm install

# 3. Build
npm run build

# 4. Register with Claude Code (local scope — this project only)
claude mcp add --transport stdio dev-tools -- node /absolute/path/to/dev-tools-mcp/build/index.js

# OR register globally (available in all projects)
claude mcp add --transport stdio --scope user dev-tools -- node /absolute/path/to/dev-tools-mcp/build/index.js

替代方案:直接编辑 .claude.json

将此添加到 ~/.claude.json(全局)或项目根目录下的 .claude.json 中的 mcpServers 键:

{
  "mcpServers": {
    "dev-tools": {
      "type": "stdio",
      "command": "node",
      "args": ["/absolute/path/to/dev-tools-mcp/build/index.js"]
    }
  }
}

然后重启 Claude Code。

验证是否正常工作

在 Claude Code 中,运行 /mcp — 你应该看到 dev-tools: connected,并列出 5 个工具。

工具详情

1. run_e2e_tests — Playwright E2E 运行器

使用 JSON 报告器运行 Playwright,并将结果解析为结构化输出。

输入:

  • project_dir(必填)— 项目的绝对路径

  • test_pattern — 用于过滤的 glob 或文件路径,例如 "tests/auth.spec.ts"

  • headed — 以有头模式运行(默认:false)

  • start_server — 使用 Playwright 的 webServer 配置(默认:true)

  • timeout_seconds — 超过此秒数后终止(默认:120)

返回内容:

{
  "success": true,
  "summary": { "passed": 8, "failed": 1, "skipped": 0, "total": 9 },
  "tests": [
    { "name": "Auth > should redirect unauthenticated users", "status": "passed", "duration_ms": 1200 },
    { "name": "Auth > should show dashboard after login", "status": "failed", "duration_ms": 3400, "error": "Expected element to be visible..." }
  ]
}

提示: 确保你的 playwright.config.ts 中有 webServer 部分,这样 Playwright 会自动启动你的开发服务器:

export default defineConfig({
  webServer: {
    command: 'npm run dev',
    port: 3000,
    reuseExistingServer: !process.env.CI,
  },
});

2. execute_sql_as_role — Supabase RLS 测试器

以带有 JWT 声明的特定 Postgres 角色执行 SQL,然后回滚。绝不修改数据。

输入:

  • connection_string(必填)— 例如 "postgresql://postgres:postgres@localhost:54322/postgres"

  • sql(必填)— 要运行的查询

  • role — Postgres 角色(默认:"authenticated"

  • user_id — 设置为 auth.uid() 的 UUID

  • claims — 额外的 JWT 声明,例如 { "app_role": "parent" }

Claude Code 的示例提示:

"以 id 为 abc-123 的已认证父用户身份运行 SELECT * FROM children,并确认他们只能看到自己的孩子。"

返回内容:

{
  "success": true,
  "role": "authenticated",
  "user_id": "abc-123",
  "query": "SELECT * FROM children",
  "rows": [["id-1", "abc-123", "Alice"], ["id-2", "abc-123", "Bob"]],
  "row_count": 2
}

3. typecheck — TypeScript 检查器

运行 tsc --noEmit 并将输出解析为结构化错误。

输入:

  • project_dir(必填)

  • tsconfig — tsconfig 的相对路径(默认:"tsconfig.json"

  • files — 仅检查特定文件

返回内容:

{
  "success": false,
  "error_count": 2,
  "errors": [
    { "file": "src/utils.ts", "line": 42, "column": 5, "code": "TS2345", "message": "Argument of type 'string' is not assignable..." },
    { "file": "src/api.ts", "line": 18, "column": 12, "code": "TS2339", "message": "Property 'foo' does not exist on type..." }
  ]
}

4. npm_run — 结构化 npm 脚本运行器

使用 CI=trueFORCE_COLOR=0 运行任意 npm 脚本,然后解析 Vitest/Jest 输出。

输入:

  • project_dir(必填)

  • script(必填)— 例如 "test""test:unit""lint"

  • args — 在 -- 之后传递的额外参数

  • env — 额外的环境变量

返回内容:

{
  "success": false,
  "exit_code": 1,
  "script": "test",
  "summary": { "total_tests": 14, "passed_tests": 12, "failed_tests": 2 },
  "file_results": [
    { "file": "src/auth.test.ts", "status": "failed", "tests_failed": 2 },
    { "file": "src/utils.test.ts", "status": "passed", "tests_passed": 5 }
  ],
  "raw_stdout": "..."
}

5. nextjs_build — Next.js 构建验证器

以生产模式运行 next build,并解析错误和页面输出。

输入:

  • project_dir(必填)

  • env — 构建的额外环境变量

  • timeout_seconds —(默认:180)

返回内容:

{
  "success": true,
  "error_count": 0,
  "errors": [],
  "pages": [
    { "path": "/", "size_kb": 5.42, "type": "static" },
    { "path": "/dashboard", "size_kb": 12.1, "type": "dynamic" },
    { "path": "/api/auth", "size_kb": 0, "type": "ssr" }
  ],
  "build_duration_ms": 24500
}

开发

# Watch mode
npm run watch

# Run the unit tests (Vitest)
npm test

# Test interactively with the MCP Inspector
npm run inspect

测试

输出解析器是代码库中最棘手、最容易回归的部分——它们将自由格式的 Vitest/Jest/tsc/next build 控制台输出转换为结构化 JSON。这些纯函数使用 Vitesttest/ 下进行单元测试;使用 npm test 运行它们。CI(参见 .github/workflows/ci.yml)在每次推送和拉取请求时,在 Node 20 和 22 上运行 npm ci、TypeScript 构建和测试套件。

自定义想法

  • 添加 lint 工具,解析 ESLint JSON 输出

  • 添加 prisma_migrate 工具,用于结构化的迁移状态

  • 添加 docker_compose 工具,用于管理测试容器

  • 将 RLS 工具连接到 Supabase CLIsupabase db test)而不是原始 psql

许可证

MIT © 2026 Brian Cox

-
license - not tested
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • A paid remote MCP for AI agent browser DevTools MCP, built to return verdicts, receipts, usage logs,

  • One PAT, any MCP agent: Vercel, GitHub, Cloudflare, Supabase, GCP — unified dev infra gateway.

  • OCR, transcription, file extraction, and image generation for AI agents via MCP.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/briancox730/dev-tools-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server