Stop Hand-Editing MCP Configs: A Zero-Dependency Go CLI

go dev.to

If you are experimenting with Model Context Protocol (MCP) servers using AI clients like Claude Desktop, Cursor, or terminal agents, you've probably hit this friction point: managing the configuration file.

Adding a new local or remote server usually means:

  1. Hunting down the hidden mcp_config.json file (which lives in entirely different directories depending on your OS and the client you use).
  2. Manually editing a deeply nested JSON structure.

It sounds simple until you miss a comma, leave a trailing comma, or break a bracket, and suddenly your AI client crashes or fails to boot.

I got tired of breaking my configs, so I built a tiny utility to handle it straight from the terminal.

Enter agmcp

agmcp is a CLI manager written in pure Go that safely reads, patches, and writes deeply nested JSON configurations without destroying existing keys or breaking your client apps with syntax errors.

Here is a demo of how agmcp works:

Why build this?

There are package managers for everything, but MCP configs are uniquely annoying because they are just raw JSON files sitting in arbitrary system paths. I wanted a tool that was:

  • Blazing Fast & Lightweight: Written in Go using strictly the standard library (encoding/json, os, path/filepath). Absolutely no CGO.
  • Safe: It performs safe JSON patching. It won't overwrite or format over other custom settings your client might have saved in the file.
  • Frictionless: It cross-compiles for Linux and Windows, with native install scripts that handle OS-level PATH injection automatically.

Usage

Once installed, you don't even need to know where the config file is. You just run:

# Add a GitHub MCP server
agmcp add github npx -y @modelcontextprotocol/server-github

# Remove a server
agmcp remove github

# List active servers
agmcp list
Enter fullscreen mode Exit fullscreen mode

Try it out

If you are testing a lot of servers locally, give it a try. It is entirely open-source, and I'd love to get feedback from other developers on the Go architecture or the JSON patching approach.

GitHub Repository: https://github.com/simplychiragk/agmcp

Let me know what you think or if you run into any edge cases with specific MCP clients!

Source: dev.to

arrow_back Back to Tutorials