Mcpdiet
CLI and MCP server that measures token cost, dead servers and risky configs in your MCP
Mcpdiet is an open-source MCP server for developer tools. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, API, macOS
- Runs
- Locally
- Version
- 0.2.0
- Listing updated
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add mcpdiet -- npx -y @hashshabbir/mcpdietAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"mcpdiet": {
"command": "npx",
"args": [
"-y",
"@hashshabbir/mcpdiet"
]
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"mcpdiet": {
"command": "npx",
"args": [
"-y",
"@hashshabbir/mcpdiet"
]
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"mcpdiet": {
"command": "npx",
"args": [
"-y",
"@hashshabbir/mcpdiet"
]
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.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.
Add with the CLI
Run in a terminal
codex mcp add mcpdiet -- npx -y @hashshabbir/mcpdietOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.mcpdiet]
command = "npx"
args = ["-y", "@hashshabbir/mcpdiet"]Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"mcpdiet": {
"command": "npx",
"args": [
"-y",
"@hashshabbir/mcpdiet"
]
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "mcpdiet": { "command": "npx", "args": [ "-y", "@hashshabbir/mcpdiet" ] } } }Or run: gemini mcp add -s user mcpdiet npx -- -y @hashshabbir/mcpdiet
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "mcpdiet": { "command": "npx", "args": [ "-y", "@hashshabbir/mcpdiet" ] } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.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
Add to cline_mcp_settings.json
{ "mcpServers": { "mcpdiet": { "command": "npx", "args": [ "-y", "@hashshabbir/mcpdiet" ] } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.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
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "mcpdiet": { "command": "npx", "args": [ "-y", "@hashshabbir/mcpdiet" ] } } }Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "mcpdiet": { "command": "npx", "args": [ "-y", "@hashshabbir/mcpdiet" ] } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "mcpdiet": { "command": "npx", "args": [ "-y", "@hashshabbir/mcpdiet" ] } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
About Mcpdiet
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.
What it does
- 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
Pricing
Open source
Free, MIT licensed
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.