bash-mcp

io.github.nickw8由 GitHub 账号 nickw8 发布v5.0.1更新于 Oct 29, 2026

Structured JSON wrappers for git, kubectl, terraform, helm, argocd, gh, glab and other CLIs.

概览

AI 生成的概览

本地 MCP 服务器,封装 git、kubectl、terraform、helm、argocd、jq 等命令行工具,返回结构化 JSON 而非原始文本。

可以做什么
  • 列出、树状展示、统计大小与查找文件,按行号读取文件并提取文件结构大纲
  • 用 ripgrep 搜索文件内容,用 glob 匹配路径
  • 查看 git 状态、日志、差异、分支,以及仓库健康快照和 PR 上下文
  • 查询 Kubernetes、Helm、ArgoCD 与 Terraform/OpenTofu 的状态、日志、计划与健康诊断
  • 为 .NET、Node.js、Python 和 shell 项目运行 lint、测试与类型检查并返回结构化诊断
  • 用 jq 和 yq 转换 JSON 与 YAML,并通过 run、run_seq、batch 执行任意命令
适用场景
适合助手在同一台机器上处理代码、仓库或基础设施,并希望得到紧凑、带类型的输出而不是解析给人看的命令行表格。内置的一步式诊断工具适合排查故障的 Pod、Helm release、ArgoCD 应用和 CI 流水线。
运行要求
通过 npx 或全局 npm 安装以 stdio 在本地运行,需要 Node.js 20 或更高版本。各工具组需要对应的命令行工具:git、kubectl、helm、argocd、terraform 或 tofu、jq、yq、ripgrep、dotnet、liquibase、ruff、mypy、pytest;缺少时仅该工具报错。可选变量:BASH_MCP_MODE、BASH_MCP_PROFILE、BASH_MCP_RESPONSE_MODE、BASH_MCP_LOG、TF_BINARY。
安装前请注意
run、run_seq 和 batch 会在你的机器上执行任意命令;BASH_MCP_MODE 默认 readOnly,会拦截写操作命令,设为 off 则取消该保护。工具作用于本地命令行凭据所指向的集群、云账号或仓库,因此 kubectl 与 terraform 调用可能读取敏感状态。tf_outputs 会遮蔽敏感输出,但其他结果仍可能包含机密。可选钩子可拦截原始 shell 命令。

安装

在 SourceWeft 中

  1. 打开 控制台中的 bash-mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

bash-mcp

An MCP server that wraps common CLI tools (kubectl, terraform, helm, git, argocd, jq, yq, ripgrep, etc.) and returns structured JSON instead of raw text output.

Designed for AI agents and LLM-powered workflows where parsing human-readable CLI output wastes tokens and breaks easily.

Created with the help of Claude since it is the main consumer of the structured data.

Quick Start

Option 1: Zero-install with npx

No installation needed — just add the MCP config and npx will fetch it on first use.

Option 2: Global install

bash
npm install -g @nickw8/bash-mcp

Option 3: Install from source

bash
git clone https://github.com/nickw8/bash-mcp.gitcd bash-mcpnpm install && npm run buildnpm link

Verify your setup

Run the built-in preflight check before wiring bash-mcp into a client:

bash
npx -y @nickw8/bash-mcp --doctor   # or: bash-mcp --doctor (global install)

It reports your Node version, whether the MCP SDK loads, which CLIs are available (versions included), and the resolved BASH_MCP_MODE — then exits non-zero if a critical check fails (Node too old or the SDK can't load). Missing CLIs are advisory, not failures. Without --doctor, the binary starts the MCP server as usual.

Claude Code Setup

Add bash-mcp to your Claude Code settings. For all projects (recommended), edit ~/.claude/settings.json. For a single project, edit .claude/settings.json in the project root.

With npx (no install required):

json
{  "mcpServers": {    "bash-mcp": {      "command": "npx",      "args": ["-y", "@nickw8/bash-mcp"],      "env": {        "BASH_MCP_MODE": "readOnly"      }    }  }}

Safe by default: an unset BASH_MCP_MODE resolves to readOnly, which blocks mutating run/batch commands. The examples set it explicitly for clarity. For trusted local use, set BASH_MCP_MODE=off to allow writes.

With global install:

json
{  "mcpServers": {    "bash-mcp": {      "command": "bash-mcp",      "env": {        "BASH_MCP_MODE": "readOnly"      }    }  }}

To verify it's working, start Claude Code and check that bash-mcp tools (like cat, rg, git_status) appear in the tool list.

You can also add it from the CLI:

bash
claude mcp add bash-mcp -e BASH_MCP_MODE=readOnly -- npx -y @nickw8/bash-mcp

Steer agents toward the structured tools (optional)

Registering the server exposes the tools, but agents still reach for raw Bash out of habit. Two assets fix that: a rules file (~/.claude/rules/bash-mcp-tools.md, auto-loaded into every session — the tool inventory) and a PreToolUse(Bash) redirect hook. Install both with:

bash
npx -y @nickw8/bash-mcp --install-claude        # copy into ~/.claudenpx -y @nickw8/bash-mcp --install-claude --check # report drift, write nothing

It prints the settings.json hook block to paste in (the rules file needs no settings — Claude Code auto-loads ~/.claude/rules/*.md). See hooks/README.md for details and the clone-time npm run claude:install equivalent. --uninstall-claude removes both files again.

Or install the Claude Code plugin, which bundles the server and the hook (in warn mode — it never blocks unless BASH_MCP_HOOK=block):

/plugin install bash-mcp --marketplace nickw8/bash-mcp

Every other client (VS Code/Copilot, Codex, generic stdio) and pinned versions: docs/guides/installation.md.

Claude Desktop Setup

Edit claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\) and add the same mcpServers entry:

json
{  "mcpServers": {    "bash-mcp": {      "command": "npx",      "args": ["-y", "@nickw8/bash-mcp"],      "env": {        "BASH_MCP_MODE": "readOnly"      }    }  }}

Restart Claude Desktop after editing.

Cursor Setup

Add bash-mcp to ~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project):

json
{  "mcpServers": {    "bash-mcp": {      "command": "npx",      "args": ["-y", "@nickw8/bash-mcp"],      "env": {        "BASH_MCP_MODE": "readOnly"      }    }  }}

(Use "command": "bash-mcp" with no args if you installed globally.) Any MCP-aware client works the same way — point it at the bash-mcp binary or npx -y @nickw8/bash-mcp.

Recommended Hooks

Optional Claude Code hooks in hooks/ steer agents toward the structured tools by blocking raw shell commands (git status, kubectl get, cat, …) that have a bash-mcp equivalent, while letting write commands (git commit, kubectl apply) pass through. BASH_MCP_HOOK=warn makes every block advisory; off disables the hook.

See docs/runbooks/hooks-setup.md for setup.

Why Structured Output?

Raw CLI tools return text meant for humans. AI agents waste tokens parsing tables, aligning columns, and guessing field boundaries. bash-mcp runs the same CLI tools but returns structured JSON with typed schemas, so the agent gets exactly the data it needs.

# Raw kubectl output: 148 tokens to parse a tableNAME                     READY   STATUS    RESTARTS   AGEnginx-7c5b8d6c88-abc12  1/1     Running   0          3d
# bash-mcp output: typed, compact, ready to use{ "name": "nginx-7c5b8d6c88-abc12", "status": "Running", "age": "3d", ... }

See docs/guides/token-benchmarks.md for measured savings (e.g. kubectl describe pod → kube_diagnose_pod is ~64% fewer tokens).

Philosophy: structured tools first, run is the escape hatch

  1. Reach for a structured tool first. Every wrapper returns typed JSON the agent can use directly — no column-counting, no re-parsing on a format change.
  2. Prefer a diagnostic over a chain of raw commands. Tools like kube_diagnose_pod, helm_release_triage, and argo_app_health_summary answer an operational question in one call — { status, likelyCauses, suggestedNextCommands, evidence } — instead of making the agent run get, then logs, then reason across both.
  3. run / batch are the escape hatch. For commands without a dedicated wrapper, run executes anything with smart truncation. Optional hooks actively steer agents back to the structured tool when a raw equivalent is invoked.

Read-only tools carry the MCP readOnlyHint annotation. run/batch can be gated with BASH_MCP_MODE (see Configuration).

Which tool should I use?

Pick the structured tool that matches your intent instead of reaching for a raw command. The list_guidance tool returns this same index as JSON (filter by intent or category), so agents can self-select without the README.

I want to…Use thisInstead of
diagnose a crashing or failing Kubernetes podkube_diagnose_podkubectl describe pod, kubectl logs
find all not-ready or failing pods in a namespacekube_pod_failure_summarykubectl get pods, kubectl get pods | grep
check a deployment's rollout healthkube_deployment_statuskubectl rollout status, kubectl get deployment
understand recent cluster eventskube_events_summarykubectl get events
summarize the changes in a Terraform plantf_plan_summaryterraform plan, terraform show
review the current feature branch before a PRgit_pr_contextgit diff, git log, git status
understand the overall state of a repositoryrepo_health_summarygit status, git log --oneline
read a file's structure without loading the full bodyoutlinecat (entire file), cat
read one region of a large filecatcat (whole file), sed -n '10,40p'
keep a broad search from flooding the contextrgrg | head
search for exact code references or symbolsrggrep -r, rg
check whether a pull request's CI checks passgh_pr_checksgh pr checks, gh pr view
find out why a CI / GitHub Actions run failedgh_run_failure_summarygh run view --log-failed, gh run list
check whether a GitLab pipeline or merge request's jobs passglab_ci_statusglab ci get, glab ci status
find out why a GitLab CI pipeline failedglab_pipeline_failure_summaryglab ci trace, glab ci view
triage why a Helm release is unhealthyhelm_release_triagehelm status, helm get values
check whether an ArgoCD app is healthy and in syncargo_app_health_summaryargocd app get, argocd app list
validate a Liquibase changelog for errorsliquibase_validateliquibase validate
preview the SQL Liquibase would run for pending changesetsliquibase_update_sqlliquibase updateSQL, liquibase updateSQL | grep
list Liquibase changesets not yet applied to the databaseliquibase_statusliquibase status --verbose
lint a shell script for bugs and quoting issuesbash_lintshellcheck, shellcheck -f json1
run a bats or shell test suitebash_testbats, bash test.sh
discover which CLIs are installed before calling a toolcheck_environmentwhich, <tool> --version

Tools

📖 Full tool reference → docs/tools.md — generated from the registered tools (inputs, outputs, and the raw command each one approximates). Regenerate with npm run docs:tools.

Environment

ToolDescription
check_environmentReport which CLIs are installed (and their versions) so you can pick the right tool before calling it.
list_guidanceReturn an intent → preferred-tool index so you can pick the right bash-mcp tool for a goal.

Filesystem

ToolDescription
lsList files in a directory.
treeShow directory structure as a compact tree.
duShow disk usage for paths.
find_filesFind files by name pattern, type, or modification time.

Search

ToolDescription
rgSearch file contents with ripgrep.
globFind files matching a glob pattern.

File

ToolDescription
catRead one or more files with line numbers and smart truncation.
outlineShow the structural outline of a file — function/class names, top-level comments, imports.

Git

ToolDescription
git_statusStructured git status: branch, staged/unstaged/untracked files.
git_logStructured git log: commit hash, author, date, message.
git_diffStructured git diff: files changed with insertions/deletions counts.
git_branchesList git branches.
repo_health_summaryOne-call snapshot of a git working tree: branch, ahead/behind vs upstream, staged/unstaged/untracked counts, recent commits, and the uncommitted diffstat.
git_pr_contextCollect the commits and file changes of a branch vs a base ref (for writing a PR description): commit list, changed files with status, and a diffstat over base...head.
git_diff_contentShow git diff with structured patch content.

GitHub

ToolDescription
gh_pr_checksReport a pull request's CI checks as counts per state plus the failing and pending checks.
gh_run_failure_summaryDiagnose a GitHub Actions run in one call: status, the failed jobs and steps, and the ##[error] lines from the failed log as evidence.

GitLab

ToolDescription
glab_ci_statusReport a GitLab pipeline's jobs as counts per status plus the failed, running and pending jobs.
glab_pipeline_failure_summaryDiagnose a GitLab pipeline in one call: status, the failed jobs and why GitLab says they failed, and the last script lines of each failed job's trace as evidence.

Kubernetes

ToolDescription
kube_getGet Kubernetes resources as structured data.
kube_logsGet pod logs.
kube_contextsList available kubectl contexts with current context marked.
kube_diagnose_podDiagnose why a pod is unhealthy in one call.
kube_pod_failure_summaryList unhealthy pods in a namespace with their failure reason and evidence — one call instead of get + describe per pod.
kube_deployment_statusReport a deployment's rollout health (ready/desired replicas, conditions) as a structured diagnosis.
kube_events_summarySummarize Warning events in a namespace (grouped by reason, ordered by count) instead of scrolling raw kubectl get events.

Terraform

ToolDescription
tf_state_listList resources in Terraform state.
tf_showShow current Terraform state as structured JSON.
tf_plan_summaryRun terraform plan and return a structured summary of changes (add/change/destroy counts and affected resources).
tf_workspacesList Terraform workspaces with current workspace marked.
tf_outputsList Terraform/OpenTofu outputs as [name, value] pairs; a sensitive output is redacted to [name] alone.
tf_providersList the Terraform/OpenTofu version and selected provider versions for the project.
tf_validate_summaryValidate the Terraform/OpenTofu config and return a compact pass/fail summary with diagnostics.
tf_modules_summaryList the modules used by an initialized Terraform/OpenTofu project (key, source, version).
tf_backend_infoReport the configured backend type and config for an initialized project.

Helm

ToolDescription
helm_listList Helm releases with status, chart, and app version.
helm_statusGet detailed status of a Helm release.
helm_valuesGet the computed values for a Helm release as structured data.
helm_release_triageDiagnose a Helm release's health in one call: combines helm status + helm history into current status, likely causes, suggested next commands, and recent-revision evidence.

ArgoCD

ToolDescription
argo_appsList ArgoCD applications with sync/health status.
argo_app_detailGet detailed status for a single ArgoCD application including resource health.
argo_app_diffShow what's out of sync for an ArgoCD application.
argo_app_health_summaryDiagnose an ArgoCD application's health in one call: overall sync/health, likely causes, suggested next commands, and the unhealthy resources/conditions as evidence.

Data Processing

ToolDescription
jqQuery and transform JSON using jq expressions.
yqQuery and transform YAML files using yq expressions (mikefarah/yq).

.NET

ToolDescription
dotnet_buildRun dotnet build and return structured diagnostics with file, line, column, message, and error code.
dotnet_testRun dotnet test and return structured results: pass/fail/skip counts, failure messages.

Liquibase

ToolDescription
liquibase_validateValidate a Liquibase changelog and return a structured pass/fail result with per-changeset errors (duplicate ids, checksum drift).
liquibase_update_sqlRender the SQL Liquibase would run for pending changesets (updateSQL) as structured per-changeset summaries with a SQL-Server batch lint.
liquibase_statusList Liquibase changesets not yet applied to the target database, as structured JSON.

Node.js

ToolDescription
npm_lintRun biome check and return structured diagnostics with file, line, column, message, and rule.
npm_testRun vitest or jest (picked from package.json) and return structured test results: suites, pass/fail counts, failure messages.
npm_typecheckRun tsc/tsgo --noEmit and return structured type errors with file, line, column, message, and TS error code.

Python

ToolDescription
python_lintRun ruff check and return structured diagnostics with file, line, column, message, and rule code.
python_testRun pytest and return structured test results: suites, pass/fail counts, failure messages.
python_typecheckRun mypy and return structured type errors with file, line, column, message, and error code.

Shell

ToolDescription
bash_syntax_checkCheck shell scripts for syntax errors with bash -n and return structured diagnostics (file, line, message).
bash_lintRun shellcheck and return structured diagnostics with file, line, column, message, and SC rule code.
bash_testRun a shell test script — bats .bats files via --tap, or a plain .sh harness — and return structured results: per-case pass/fail plus a summary parsed from TAP or N tests, M failures output, falling back to exit-code-only when the format is unrecognized.

Execution

ToolDescription
runRun a single command — a binary plus an args array, executed directly without a shell (so no pipes, redirects, or ';'/'&&' in the string) — and return structured output with smart truncation.
run_seqRun an ordered list of labeled commands one after another, stopping at the first failure by default.
batchRun multiple commands in parallel and return all results.

Results

ToolDescription
result_getPage through a result the response budget trimmed.

All tf_* tools accept binary: "terraform" | "tofu" (or set $TF_BINARY) to run OpenTofu.

Example Agent Workflows

Triage a crash-looping pod. Before — three raw calls plus reasoning:

kubectl get pods -n payments          # find the broken podkubectl describe pod api-xyz          # read events/state, infer causekubectl logs api-xyz --tail=200       # scroll for the error# ...agent reasons across all three to guess the next step

After — one structured call:

kube_diagnose_pod(pod="api-xyz", namespace="payments")→ { status: "CrashLoopBackOff",    likelyCauses: ["container exits 1; DB connection refused"],    suggestedNextCommands: ["kube_logs(pod='api-xyz', container='api')"],    evidence: ["Restart Count: 12", "BackOff x140 over 30m"] }

Review a feature branch. Before: git log main..HEAD, git diff --stat main...HEAD, git diff main...HEAD — three commands, manual stitching. After:

git_pr_context(base="main")→ { commits: [...], files: [...], summary: { filesChanged, insertions, deletions } }

Check capabilities before acting. Instead of which kubectl && kubectl config current-context:

check_environment()→ { kubectl: { installed: true, version: "1.31.2", context: "prod" },    terraform: { installed: false }, ... }

Configuration

Environment Variables

VariableValuesDefaultEffect
BASH_MCP_LOGerror | info | offerrorWide-event JSON logging to stderr (one line per tool call). error logs only failed calls; info adds successes; off/silent disables. stdout always stays pure MCP. run/batch commands are redacted (metadata only).
BASH_MCP_MODEreadOnly | confirmWrites | offreadOnlyGates run/batch. Default readOnly blocks commands classified as mutating (confirmWrites likewise). Set off (or dangerous) to disable enforcement — recommended only for trusted local use.
BASH_MCP_PROFILEcore | development | infrastructure | allallWhich tool groups register. Fewer tools, less schema in context — see tool discovery. An unknown value fails at startup.
BASH_MCP_RESPONSE_MODEauto | summary | compact | fullautoResponse budget. A cut result carries retained and its full payload is pageable with result_get. full is the v4 behaviour. See output conventions.
BASH_MCP_RESULT_TTLseconds900How long a stored result stays retrievable; 0 disables the store.
BASH_MCP_HOOKblock | warn | offblock (warn in the plugin)Redirect hook behaviour.
TF_BINARYterraform | tofuterraformDefault binary for all tf_* tools (overridable per-call via binary).

Timeouts

Each tool group uses appropriate default timeouts:

  • Filesystem/search/git: 30 seconds
  • Kubernetes/Helm/ArgoCD: 15 seconds
  • Terraform state: 30 seconds
  • Terraform plan: 120 seconds
  • .NET build/test: 120 seconds
  • Python lint: 30 seconds
  • Python test: 120 seconds
  • Python typecheck: 60 seconds

Command Buffer

All commands default to a 10 MB output buffer. Override per-tool in src/exec.ts.

Development

bash
# Install dependenciesnpm install
# Run in development mode (auto-reloads)npm run dev
# Build for productionnpm run build
# Start production servernpm start
# Run testsnpm test
# Lint and formatnpm run lintnpm run format

Architecture

src/  index.ts              # Server entry point — registers tools and starts stdio transport  exec.ts               # Command execution layer — runs CLI tools via execFile  tool.ts               # defineTool — wraps registerTool with wide-event logging + error catching  error.ts              # ToolError taxonomy + classifyError (missing_binary, timeout, ...)  logger.ts             # Zero-dep structured stderr logger (BASH_MCP_LOG)  safety.ts             # Command classification + BASH_MCP_MODE gate for run/batch  format.ts             # Multi-format list output (TSV, columnar, JSON)  response.ts           # MCP response helpers (ok, okList, err)  shell.ts              # Shell escaping utilities  parsers/    types.ts            # Shared interfaces: Diagnostic, TestResult, TestSuite    schemas.ts          # Shared Zod (diagnostic, budget fragment, applyBudget)  tools/    argocd/argocd.ts    # argo_apps, argo_app_detail, argo_app_diff    batch/batch.ts      # batch (parallel command execution)    dotnet/      dotnet.ts         # dotnet_build, dotnet_test      parsers/          # MSBuild and TRX output parsers    file/      file.ts           # cat (file reading with metadata), outline (structural file outline)      outline/          # Language-specific outline extractors    filesystem/      filesystem.ts     # ls, tree, du, find_files    git/      git.ts            # git_status, git_log, git_diff, git_branches      diff.ts           # git_diff_content (structured patch hunks)    helm/helm.ts        # helm_list, helm_status, helm_values    json/json.ts        # jq    kubernetes/      kubernetes.ts     # kube_get, kube_logs, kube_contexts    npm/      npm.ts            # npm_lint, npm_test, npm_typecheck      parsers/          # Biome, Vitest, tsc output parsers    run/run.ts          # run (command execution with smart truncation)    search/search.ts    # rg, glob    terraform/      terraform.ts      # tf_state_list, tf_show, tf_plan_summary, tf_workspaces    yaml/yaml.ts        # yq

Each tool file exports a single register*Tools(server) function that registers all tools in its group. Every tool returns both content (text for display) and structuredContent (typed JSON for programmatic use).

Adding a New Tool

  1. Add to an existing category (src/tools/<group>/<group>.ts) or create a new category directory
  2. Define input/output schemas with Zod (add annotations: { readOnlyHint: true } for read-only tools)
  3. Implement the handler using exec() or execJson() from #exec, return ok() or err() from #response
  4. Register it with defineTool from #tool (injects wide-event logging + uniform error catching)
  5. Wire the group's register*Tools into src/index.ts
  6. Add tests in a co-located *.test.ts file
typescript
import { z } from "zod";import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";import { exec } from "#exec";import { ok, err } from "#response";import { defineTool } from "#tool";
export function registerMyTools(server: McpServer) {  defineTool(server, "my_tool", {    title: "My tool",    description: "What it does and why structured output helps.",    inputSchema: {      path: z.string().describe("Path to operate on"),    },    outputSchema: {      result: z.string(),    },    annotations: { readOnlyHint: true },  }, async ({ path }) => {    const result = await exec("mytool", ["--json", path]);
    if (result.exitCode !== 0) {      return err(result.stderr, { result: "" });    }
    return ok({ result: result.stdout.trim() });  });}

See docs/guides/adding-tools.md for the full guide.

Prerequisites

The following CLI tools must be installed for their respective tool groups to work:

  • Always required: Node.js >= 20
  • Filesystem/search: ls, tree, find, du, rg (ripgrep)
  • Git: git
  • Kubernetes: kubectl
  • Terraform/OpenTofu: terraform or tofu
  • Helm: helm
  • ArgoCD: argocd
  • JSON: jq
  • YAML: yq (mikefarah/yq)
  • .NET: dotnet (.NET SDK)
  • Liquibase: liquibase
  • Python: ruff (lint), mypy (typecheck), pytest (test)

Tools gracefully return errors if their underlying CLI is not installed.

License

Apache-2.0

来源:README.md,提交 9a72849

工具

65

ls

List directory

List files in a directory. Returns entries as [name, size, permissions, modified] — directories end with '/' and links with '@'. Use nameOnly for names alone, recursive for one level of subdirectories, all to include hidden files.

输入参数allpathnameOnlyrecursive

tree

Directory tree

Show directory structure as a compact tree. Returns structured nodes instead of ASCII art. Use dirsOnly for directory-only view, pattern to filter by glob, maxDepth to control depth.

输入参数path必填excludepatterndirsOnlymaxDepth

du

Disk usage

Show disk usage for paths. Returns entries as [path, sizeBytes] pairs, in the order du emits them. Use maxDepth to control how deep the summary goes.

输入参数path必填maxDepth

find_files

Find files

Find files by name pattern, type, or modification time. Returns structured list of paths. Use names for multiple glob patterns (OR logic), modifiedWithin for recent files (e.g. '7d', '1h').

输入参数namepathtypenamespatternmaxDepthwithMetadatamodifiedWithin

rg

Ripgrep search

Search file contents with ripgrep. Returns files as [file, "line:text", ...] rows (a context line is "line-text"), [file, count] under countPerFile, [file] under filesOnly. Use glob (string or array, '!' to exclude) to filter files, ignoreCase for case-insensitive search, filesOnly for just filenames, countPerFile for match counts per file, maxPerFile to cap hits per file. For 'collect all X' tasks use only:true to return just the matched substrings (one row per hit) — add replace ($1 capture groups) to extract structured values.

输入参数globonlypathcontextpatternreplacefilesOnlyignoreCasemaxPerFilemaxResultscountPerFilefixedStrings另有 1 个

glob

Glob file search

Find files matching a glob pattern. Returns a compact list of paths.

输入参数cwdpattern必填

git_status

Git status

Structured git status: branch, staged/unstaged/untracked files. Replaces parsing raw git status output.

输入参数cwd

git_log

Git log

Structured git log: commit hash, author, date, message. Compact and parseable. Use range for ref comparisons (e.g. 'main..feature'). Use exclude to filter out commits matching a pattern (e.g. 'ci:').

输入参数cwdpathcountrangesinceauthorexcludewithFiles

git_diff

Git diff

Structured git diff: files changed with insertions/deletions counts. Use base+ref for two-ref comparison (e.g. base='main', ref='feature'). Use path to scope to one or more files or directories.

输入参数cwdrefbasepathstaged

git_branches

Git branches

List git branches. Returns the current branch and [name, lastCommit] pairs; a remote branch's name starts with remotes/.

输入参数cwdremote

repo_health_summary

Repo health summary

One-call snapshot of a git working tree: branch, ahead/behind vs upstream, staged/unstaged/untracked counts, recent commits, and the uncommitted diffstat.

输入参数cwdcommits

git_pr_context

Git PR context

Collect the commits and file changes of a branch vs a base ref (for writing a PR description): commit list, changed files with status, and a diffstat over base...head.

输入参数cwdbasehead

kube_get

Kubectl get resources

Get Kubernetes resources as structured data. Wraps kubectl get -o json and returns a compact summary by default. Use the jq param to extract specific fields from the raw JSON (e.g. '.spec.template.spec.containers[].env') instead of the summary.

输入参数jqnamecontextmaxItemsresourceselectornamespaceincludeRawdetailLevelallNamespacesincludeLabels

kube_logs

Kubectl logs

Get pod logs. lines are as kubectl prints them, '<timestamp> <message>', oldest first; consecutive repeats of a message merge into the first, marked ' [×N]', and a budget cut keeps the newest. Use grep to filter lines by regex pattern (e.g. 'ERROR|WARN') instead of piping through shell commands.

输入参数podgreptailsincecontextmaxItemscontainernamespaceignoreCaseincludeRawdetailLevel

kube_contexts

Kubectl contexts

List available kubectl contexts with current context marked.

无需输入参数。

kube_diagnose_pod

Diagnose a pod

Diagnose why a pod is unhealthy in one call. Returns status, likely causes, suggested next commands, and evidence (CrashLoopBackOff/ImagePullBackOff/OOMKilled/Unschedulable/restarts).

输入参数pod必填contextnamespace

kube_pod_failure_summary

Summarize failing pods

List unhealthy pods in a namespace with their failure reason and evidence — one call instead of get + describe per pod.

输入参数contextmaxItemsnamespaceincludeRawdetailLevelallNamespaces

kube_deployment_status

Deployment rollout status

Report a deployment's rollout health (ready/desired replicas, conditions) as a structured diagnosis.

输入参数name必填contextnamespace

kube_events_summary

Summarize warning events

Summarize Warning events in a namespace (grouped by reason, ordered by count) instead of scrolling raw kubectl get events.

输入参数contextmaxItemsnamespaceincludeRawdetailLevelallNamespaces

tf_state_list

Terraform state list

List resources in Terraform state. Returns the resource addresses, plus a byType rollup once there are more than 20 (type, name, and module are readable from each address).

输入参数cwd必填binary

tf_show

Terraform show

Show current Terraform state as structured JSON. Returns resource summary with types and attributes.

输入参数cwd必填binary

tf_plan_summary

Terraform plan summary

Run terraform plan and return a structured summary of changes (add/change/destroy counts and affected resources). Each action is create, update, delete, replace or read; a replace counts in add and destroy, as terraform's Plan line does.

输入参数cwd必填binarytargetvarFileplanFile

tf_workspaces

Terraform workspaces

List Terraform workspaces with current workspace marked.

输入参数cwd必填binary

tf_outputs

Terraform outputs

List Terraform/OpenTofu outputs as [name, value] pairs; a sensitive output is redacted to [name] alone.

输入参数cwd必填binary

tf_providers

Terraform providers

List the Terraform/OpenTofu version and selected provider versions for the project.

输入参数cwd必填binary

tf_validate_summary

Terraform validate summary

Validate the Terraform/OpenTofu config and return a compact pass/fail summary with diagnostics.

输入参数cwd必填binary

tf_modules_summary

Terraform modules summary

List the modules used by an initialized Terraform/OpenTofu project (key, source, version). Reads .terraform/modules/modules.json — run init first.

输入参数cwd必填

tf_backend_info

Terraform backend info

Report the configured backend type and config for an initialized project. Reads .terraform/terraform.tfstate — run init first.

输入参数cwd必填

argo_apps

ArgoCD applications

List ArgoCD applications with sync/health status. Structured summary instead of table output.

输入参数projectselector

argo_app_detail

ArgoCD app detail

Get detailed status for a single ArgoCD application including resource health.

输入参数name必填

argo_app_diff

ArgoCD app diff

Show what's out of sync for an ArgoCD application.

输入参数name必填

argo_app_health_summary

ArgoCD app health summary

Diagnose an ArgoCD application's health in one call: overall sync/health, likely causes, suggested next commands, and the unhealthy resources/conditions as evidence.

输入参数name必填

helm_list

Helm releases

List Helm releases with status, chart, and app version. Structured output.

输入参数filtercontextnamespaceallNamespaces

helm_status

Helm release status

Get detailed status of a Helm release.

输入参数contextrelease必填namespace

helm_values

Helm release values

Get the computed values for a Helm release as structured data.

输入参数contextrelease必填allValuesnamespace

helm_release_triage

Helm release triage

Diagnose a Helm release's health in one call: combines helm status + helm history into current status, likely causes, suggested next commands, and recent-revision evidence.

输入参数contextrelease必填namespace

jq

jq JSON processor

Query and transform JSON using jq expressions. Accepts a file path or raw JSON string. Returns parsed, structured output — far more compact than reading a full JSON file. The filter is passed directly to jq (no shell), so shell-style escaping such as backslash-escaped quotes is neither needed nor supported — write the filter exactly as jq expects it.

输入参数fileinputslurpfiltercompactrawOutput

yq

yq YAML processor

Query and transform YAML files using yq expressions (mikefarah/yq). Outputs as JSON for structured consumption. Far more compact than reading a full YAML file.

输入参数fileinputexpressionoutputFormat

cat

Read file contents

Read one or more files with line numbers and smart truncation. Returns structured output with metadata. Pass `path` for a single file, or `paths` to read several in one call (returns { files, count }) — collapsing what would otherwise be multiple round-trips. For large files, use startLine/endLine or maxLines to limit output. Use ref to read from a git branch/commit instead of disk (e.g. ref='main'). NOTE: reading with cat does NOT satisfy the built-in Edit/Write "must read first" guard (it tracks only the built-in Read tool) — run the built-in Read on a file immediately before editing it.

输入参数refpathpathsendLinemaxLinesstartLinelineNumbers

outline

File structure outline

Show the structural outline of a file — function/class names, top-level comments, imports. Returns a compact view without implementation bodies. Includes git metadata (branch, commit) when the file is in a git repo. Use instead of cat when reviewing file structure or auditing many files at once.

输入参数refpath必填

run

Run a command

Run a single command — a binary plus an args array, executed directly without a shell (so no pipes, redirects, or ';'/'&&' in the string) — and return structured output with smart truncation. Pass the binary as `command` and its arguments as `args` (e.g. command='npm', args=['test']); for a real shell pipeline run the shell yourself: command='sh', args=['-c', 'a | b > c']. Keeps the last N lines of output by default (where errors typically appear), or the first N with mode='head'. Use for build, test, and lint commands where you need exit code and error details, not full verbose output.

输入参数cwdargsmodecommand必填timeoutcollapsemaxBytesmaxLines

run_seq

Run commands in sequence

Run an ordered list of labeled commands one after another, stopping at the first failure by default. Use for dependent steps (e.g. build then test then package) where order matters and a later step is pointless if an earlier one fails. Unlike batch (parallel), run_seq is sequential and short-circuits; set stopOnError=false to run every step regardless.

输入参数stepsmaxLinesstopOnError

batch

Run commands in parallel

Run multiple commands in parallel and return all results. Each command is a binary plus an args array, executed without a shell (for a pipeline use command='sh', args=['-c', '...']). Use when you need to gather independent pieces of information in a single tool call instead of multiple sequential calls.

输入参数commands

git_diff_content

Git diff with content

Show git diff with structured patch content. Returns parsed hunks per file instead of raw unified diff text. Use this when you need to see actual code changes, not just file-level stats. Use base+ref for two-ref comparison (e.g. base='main', ref='feature'). Use path to scope to one or more files or directories.

输入参数cwdrefbasepathstagedcontext

npm_lint

Lint (structured)

Run biome check and return structured diagnostics with file, line, column, message, and rule. Far more compact and parseable than raw lint output. Use minSeverity to filter by severity level.

输入参数cwdfixpathsmaxItemsdetailLevelminSeverity

npm_test

Test (structured)

Run vitest or jest (picked from package.json) and return structured test results: suites, pass/fail counts, failure messages. Much more compact than raw test output. Only failures are listed by default; use verbose=true for all tests.

输入参数cwdpatternverbosecoverage

npm_typecheck

Type check (structured)

Run tsc/tsgo --noEmit and return structured type errors with file, line, column, message, and TS error code. Much more compact than raw tsc output. Auto-detects tsgo for faster checking. Use project to specify a tsconfig.

输入参数cwdprojectmaxItemsdetailLevel

dotnet_build

Build (structured)

Run dotnet build and return structured diagnostics with file, line, column, message, and error code. Much more compact than raw MSBuild output. Warnings are omitted by default; pass includeWarnings:true (or detailLevel:'full') to include them.

输入参数cwdprojectmaxItemsdetailLevelconfigurationincludeWarnings

dotnet_test

Test (structured)

Run dotnet test and return structured results: pass/fail/skip counts, failure messages. Much more compact than raw test output. Only failures are listed.

输入参数cwdfilterproject

liquibase_validate

Validate changelog (structured)

Validate a Liquibase changelog and return a structured pass/fail result with per-changeset errors (duplicate ids, checksum drift). Much more compact than raw output. liquibase is on PATH — no mise/wrapper needed.

输入参数cwdlabelscontextsextraArgsdefaultsFilechangelogFile

liquibase_update_sql

Preview migration SQL (structured)

Render the SQL Liquibase would run for pending changesets (updateSQL) as structured per-changeset summaries with a SQL-Server batch lint. Does NOT apply changes. SQL bodies are omitted unless includeRaw or changesetId is set. liquibase is on PATH — no mise/wrapper needed.

输入参数cwdlabelscontextsmaxItemsbatchLintextraArgsincludeRawchangesetIddetailLeveldefaultsFilechangelogFile

liquibase_status

Pending changesets (structured)

List Liquibase changesets not yet applied to the target database, as structured JSON. Reports up-to-date vs a pending list. liquibase is on PATH — no mise/wrapper needed.

输入参数cwdlabelscontextsextraArgsdefaultsFilechangelogFile

python_lint

Python lint (structured)

Run ruff check and return structured diagnostics with file, line, column, message, and rule code. Much more compact than raw ruff output. Use minSeverity to filter by severity level.

输入参数cwd必填fixpathsmaxItemsdetailLevelminSeverity

python_test

Python test (structured)

Run pytest and return structured test results: suites, pass/fail counts, failure messages. Much more compact than raw test output. Only failures are listed by default; use verbose=true for all tests.

输入参数cwd必填pathpatternverbose

python_typecheck

Python type check (structured)

Run mypy and return structured type errors with file, line, column, message, and error code. Much more compact than raw mypy output.

输入参数cwd必填pathsmaxItemsdetailLevel

bash_syntax_check

Bash syntax check (structured)

Check shell scripts for syntax errors with `bash -n` and return structured diagnostics (file, line, message). Parses without executing, so it is safe on untrusted scripts. Reports valid:true when no errors are found.

输入参数filesmaxItemsdetailLevel

bash_lint

Bash lint (structured)

Run shellcheck and return structured diagnostics with file, line, column, message, and SC rule code. Much more compact than raw shellcheck output. Use minSeverity to filter by severity level.

输入参数filesmaxItemsdetailLevelminSeverity

bash_test

Bash test (structured)

Run a shell test script — bats `.bats` files via `--tap`, or a plain `.sh` harness — and return structured results: per-case pass/fail plus a summary parsed from TAP or `N tests, M failures` output, falling back to exit-code-only when the format is unrecognized. Executes the script, so it is gated by BASH_MCP_MODE.

输入参数cwdfiletimeout

check_environment

Check environment

Report which CLIs are installed (and their versions) so you can pick the right tool before calling it. Probes are client-only and non-blocking — no server/auth calls. Includes kubectl's current context when available.

无需输入参数。

list_guidance

List tool-selection guidance

Return an intent → preferred-tool index so you can pick the right bash-mcp tool for a goal. Each entry names the tool to prefer, raw-command anti-patterns to avoid, and why. Filter with `intent` (substring) or `category` to narrow the list.

输入参数intentcategory

gh_pr_checks

PR checks

Report a pull request's CI checks as counts per state plus the failing and pending checks. Defaults to the current branch's PR; passing checks are counted, not listed, unless all=true.

输入参数prallcwd

gh_run_failure_summary

CI run failure summary

Diagnose a GitHub Actions run in one call: status, the failed jobs and steps, and the ##[error] lines from the failed log as evidence. Defaults to the latest run on the current branch.

输入参数cwdrunbranch

glab_ci_status

GitLab pipeline status

Report a GitLab pipeline's jobs as counts per status plus the failed, running and pending jobs. Defaults to the current branch's latest pipeline; pass mr for a merge request's head pipeline. Passing, skipped and manual jobs are counted, not listed, unless all=true.

输入参数mrallcwdrepobranchpipeline

glab_pipeline_failure_summary

GitLab pipeline failure summary

Diagnose a GitLab pipeline in one call: status, the failed jobs and why GitLab says they failed, and the last script lines of each failed job's trace as evidence. Allowed-to-fail jobs are noted, not counted as the failure. Defaults to the current branch's latest pipeline.

输入参数mrcwdrepobranchpipeline

result_get

Get Retained Result

Page through a result the response budget trimmed. Pass the retained.id from that response; path selects a field (dotted, e.g. files.0), offset/limit slice an array. Snapshot of the original call, kept for retained.expiresInSec.

输入参数idpathlimitoffset

版本历史

1
  1. v5.0.1最新Oct 23, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分