---
title: 'The MCP config isn''t valid JSON: trailing commas, comments, curly quotes'
description: One comma too many and an app reads no MCP servers at all, often without saying so. The five mistakes that break the file, and how to find the line.
url: https://hamloy.com/mcp-fix/config-not-valid-json
---

[MCP fix](https://hamloy.com/mcp-fix)

# The MCP config isn't valid JSON: trailing commas, comments, curly quotes

One comma too many and an app reads no MCP servers at all, often without saying so. The five mistakes that break the file, and how to find the line.

You edit the file by hand, start the app, and every server in it is gone, not only the one you added. An MCP config is JSON, and JSON forgives nothing: one stray character and the whole file can't be read. Many apps then act as if the file were empty.

## The five mistakes

**A comma after the last entry.** The most common one, usually left behind when an entry is copied in or taken out:

```
{
  "mcpServers": {
    "hamloy": {
      "url": "https://hamloy.com/mcp",
    }
  }
}
```

The comma after the address has nothing following it. Take it out. The same goes for a comma after the last server's closing bracket.

**No comma between two entries.** The other side of the same coin: a second server pasted under the first, with nothing between them. Every entry but the last ends with a comma.

**A comment.** `// my servers` or `/* … */`. JSON has no comments. Zed reads them in its own `settings.json`; most apps don't.

**Curly quotes.** `“url”` where it should say `"url"`. A chat window, a word processor or a notes app turned the straight quotes into curly ones when the text passed through. Type the quotes again in a code editor.

**Single quotes, or no quotes.** `'url'` and `url:` are how JavaScript writes it. JSON wants double quotes around every name and every piece of text.

## Find the line

Paste the file into the [MCP Config Validator](https://hamloy.com/mcp-config-validator). It runs in your browser, sends nothing, and names the line and the mistake:

```
Wrong Line 4 A comma before a closing bracket. JSON allows none after the last entry:
               take it out.
```

An editor helps too: VS Code and Cursor underline the spot in red when the file is open as JSON.

## Codex is the exception

Codex's `~/.codex/config.toml` is TOML, not JSON: no braces, a `[mcp_servers.NAME]` table per server, and `name = "value"` lines. JSON pasted into it breaks the file the same way.

```
[mcp_servers.hamloy]
url = "https://hamloy.com/mcp"
```

The validator turns a JSON entry into TOML when you pick Codex.

## Skip the hand editing

Most apps will write the entry for you, and a program doesn't leave a comma behind:

```
claude mcp add --transport http hamloy https://hamloy.com/mcp
codex mcp add hamloy --url https://hamloy.com/mcp
gemini mcp add --transport http hamloy https://hamloy.com/mcp
```

For Cursor and VS Code, Hamloy's docs have a button that adds the server in one click: [Cursor](https://hamloy.com/docs/cursor), [VS Code](https://hamloy.com/docs/vs-code). For Claude Code and Codex, [the hamloy program](https://hamloy.com/docs/the-program) sets up the whole folder.

## Check that it worked

Start the app again, since most read the file only when they start, and ask "What's open in Hamloy?" The servers that vanished with the broken file are back too.

The file is valid and the server is still missing? It may sit under another app's key: see [mcpServers or servers?](https://hamloy.com/mcp-fix/mcpservers-or-servers)
