# Mcpdiet

> Mcpdiet is an open-source MCP server for developer tools. CLI and MCP server that measures token cost, dead servers and risky configs in your MCP. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, macOS, Linux, Windows, Self-hosted
- **Repository:** https://github.com/goldrusher9009-sketch/mcpdiet
- **MCP Registry name:** io.github.goldrusher9009-sketch/mcpdiet
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-27

## About

Each MCP server you install loads its full tool list into the model's context at the start of every session, and that overhead adds up before you type anything. mcpdiet discovers the MCP servers defined in Claude Desktop, Claude Code, Cursor, VS Code and Windsurf, starts each stdio server the way the client would, and reports how many tokens its tools, descriptions and schemas consume.

Beyond cost, it flags servers that fail to start, hard-coded secrets, unpinned npx packages, plain-HTTP remotes, duplicate tool names that shadow each other, and tool-poisoning phrasing in descriptions. Results come as a graded report with a ranked list of fixes and the tokens each fix would save. It can also save a fingerprint of your tool set and fail a run when a trusted tool changes.

It suits developers who run several MCP servers and want to trim their context window, and teams that want a budget or baseline check in CI. It can also run as an MCP server so an agent can audit its own setup.

## Features

- **Token cost per server:** Estimates the tokens each server adds to every session, based on its tool names, descriptions and schemas.
- **Auto-discovery of client configs:** Finds MCP servers in Claude Desktop, Claude Code, Cursor, VS Code and Windsurf, or scans a config file you point to.
- **Dead server detection:** Identifies configured servers that no longer start so they can be removed.
- **Basic security hygiene checks:** Looks for hard-coded secrets, unpinned npx packages, plain-HTTP remotes, duplicate tool names and suspicious description wording.
- **Ranked fix list:** Lists suggested changes ordered by the tokens they would save.
- **Baseline and budget gating:** Fails a run when token use exceeds a budget or when a saved tool fingerprint has changed.

## Good for

- Trim the context window used by a crowded Claude Code or Cursor setup
- Find and remove MCP servers that no longer start
- Enforce a token budget for MCP configs in a CI pipeline
- Detect tool definitions that changed after being approved
- Run a quick hygiene check on a new MCP server before adding it

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add mcpdiet -- npx -y @hashshabbir/mcpdiet
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "mcpdiet": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add mcpdiet -- npx -y @hashshabbir/mcpdiet
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.mcpdiet]
command = "npx"
args = ["-y", "@hashshabbir/mcpdiet"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

Or run: gemini mcp add -s user mcpdiet npx -- -y @hashshabbir/mcpdiet

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "mcpdiet": {
      "command": "npx",
      "args": [
        "-y",
        "@hashshabbir/mcpdiet"
      ]
    }
  }
}
```

## FAQ

### Does Mcpdiet send my data anywhere?

The project states that nothing leaves your machine and that environment values are never printed.

### Are remote MCP servers measured?

No. Only configured stdio servers are started and measured; remote servers are not.

### How accurate are the token counts?

They are estimates calculated as characters divided by four, intended for ranking servers rather than billing.

### How do I install Mcpdiet?

Run it with npx from the npm package @hashshabbir/mcpdiet or directly from the GitHub repository.

### Is Mcpdiet free?

Yes. Mcpdiet is open source, so you can use and self-host it for free.

### How do I add Mcpdiet to Claude Code?

Run this command in your terminal: claude mcp add mcpdiet -- npx -y @hashshabbir/mcpdiet

### What are the best alternatives to Mcpdiet?

The closest alternatives to Mcpdiet are MCP Checkup, MCP Token Optimizer, mcpwatch, slimproof and MCP Security Guard.

## Where this comes from

- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [MCP Checkup](https://ai-powered.com/mcp/mcp-checkup-2): MCP Checkup is an open-source MCP server for developer tools.
- [MCP Token Optimizer](https://ai-powered.com/mcp/mcp-token-optimizer-2): MCP Token Optimizer is an open-source MCP server for developer tools.
- [mcpwatch](https://ai-powered.com/mcp/mcpwatch-2): mcpwatch is an open-source MCP server for developer tools.
- [slimproof](https://ai-powered.com/mcp/slimproof): slimproof is an open-source MCP server for developer tools.
- [MCP Security Guard](https://ai-powered.com/mcp/mcp-security-guard): MCP Security Guard is an open-source MCP server for security.
- [MCP Readiness](https://ai-powered.com/mcp/mcp-readiness): MCP Readiness is an open-source MCP server for developer tools.
- [Checkmcp](https://ai-powered.com/mcp/checkmcp): Checkmcp is a freemium MCP server for developer tools.
- [mcpcost](https://ai-powered.com/mcp/mcpcost): mcpcost is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/mcpdiet
