mcp-dev-tools

mcp-dev-tools

Provides AI coding assistants with tools to run git status, recent commits, tests, and linter on a real repository.

Category
访问服务器

README

mcp-dev-tools

An MCP (Model Context Protocol) server I built to expose everyday dev commands — git status, recent commits, running tests, running the linter — as tools an AI coding assistant (Claude Code, Claude Desktop, or any other MCP-compatible client) can call directly against a real repository.

Why I built this

I wanted to actually understand how MCP servers work end to end — the handshake, the transport, tool schemas — rather than just wiring one up from a template. So this was built from an empty folder, one piece at a time, verifying each step before adding the next.

How I built it

  1. Scaffolded the projectnpm init, TypeScript config for Node ESM (NodeNext module/resolution), installed @modelcontextprotocol/sdk and zod.
  2. Wrote the smallest possible server — an McpServer instance, a single dummy ping tool, connected over a stdio transport.
  3. Verified it with the MCP Inspector before writing anything real — spawned the server as a subprocess, confirmed the initialize handshake completed and tools/list/tools/call worked, using the raw protocol traffic rather than assuming it worked.
  4. Added the real tools one at a time (git_status, recent_commits, run_tests, run_linter), re-testing after each addition rather than batching changes.
  5. Made the target repo configurable — moved from hardcoding process.cwd() to reading a CLI argument, so the server can run against any project, not just itself.
  6. Hit and fixed a real platform bug along the way — see below.

A real bug this surfaced

run_tests and run_linter initially failed on Windows with a cryptic spawn EINVAL. Cause: Node deliberately blocks execFile/spawn from directly invoking .cmd/.bat files (like npm.cmd) without shell: true — a security fix (CVE-2024-27980) to stop unsafe argument injection into batch files. The git calls were unaffected since git.exe is a real executable, not a shell shim. Fixed by scoping shell: true to just the two npm calls, where the arguments are fixed literals rather than dynamic input, so the shell-parsing risk the restriction exists to prevent doesn't actually apply here.

Tools

Tool Description Arguments
ping Echoes a message back; used to verify the server is wired up message: string
git_status Working tree status (staged / unstaged / untracked) of the target repo
recent_commits Recent commit history on the current branch count?: number (default 10, max 50)
run_tests Runs npm test in the target repo and returns output, including failures
run_linter Runs npm run lint in the target repo and returns output, including lint errors

How it works

  • Transport: stdio — the client spawns this process and communicates over stdin/stdout using JSON-RPC 2.0. stdout is reserved exclusively for protocol traffic; all logging goes to stderr (console.error), otherwise it would corrupt the stream.
  • Tool execution: each tool shells out to a real command (git, npm) via Node's child_process.execFile, using an argument array rather than a single shell string — this avoids shell injection entirely for the git-based tools.
  • Error handling: a failing command (e.g. failing tests, a missing lint script) is not treated as a protocol error. It's caught and returned as a normal tool result with isError: true and the real command output attached, so the calling model can see what went wrong rather than getting an opaque failure.
  • Target repo: a single REPO_DIR constant, resolved once at startup from a CLI argument (falling back to the current working directory), is threaded through every tool — so the server can be pointed at any project without code changes.

How to use it yourself

Prerequisites: Node.js 20+ and npm.

git clone <this-repo-url>
cd mcp-dev-tools
npm install

Run directly against the source with tsx (no build step needed):

npm run dev -- C:\path\to\some\other\repo

Or compile and run the built output:

npm run build
npm start -- C:\path\to\some\other\repo

If no path is given, it defaults to the directory the server is launched from.

Wiring it into an MCP client (Claude Code / Claude Desktop)

Add an entry to the client's MCP server config, pointing args at the built server and the repo you want it to operate on:

{
  "mcpServers": {
    "dev-tools": {
      "command": "node",
      "args": [
        "C:\\path\\to\\mcp-dev-tools\\build\\index.js",
        "C:\\path\\to\\the\\project\\you\\want\\to\\work\\on"
      ]
    }
  }
}

Debugging with the MCP Inspector

npx @modelcontextprotocol/inspector npx tsx src/index.ts C:\path\to\some\other\repo

Opens a browser UI showing the live tool list and lets you call each tool manually while watching the raw JSON-RPC exchange.

Tech stack

  • TypeScript, compiled with tsc to ES2022/NodeNext modules
  • @modelcontextprotocol/sdk — official MCP server implementation
  • zod — runtime validation for tool input schemas
  • tsx for zero-build local development

Project structure

mcp-dev-tools/
├── src/
│   └── index.ts      # server setup + all tool definitions
├── tsconfig.json
├── package.json
└── README.md

License

ISC

推荐服务器

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 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
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 模型以安全和受控的方式获取实时的网络信息。

官方
精选