MCP Config JSON Errors: How to Fix Common Mistakes
Invalid JSON in your MCP config file will prevent servers from loading. This error-focused guide shows you how to identify and fix common JSON syntax mistakes, schema errors, and formatting issues—with examples of what's wrong and how to fix it.
Common JSON Errors
These are the most frequent mistakes that break MCP configuration files:
Error 1: Trailing Commas
Invalid (Trailing Comma)
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}, ← Trailing comma here!
}
}
}
Valid (No Trailing Comma)
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Error 2: Missing Quotes
Invalid (Unquoted Keys)
{
mcpServers: { ← Missing quotes
corcava: { ← Missing quotes
url: "https://app.corcava.com/mcp",
headers: {
Authorization: "Bearer YOUR_API_KEY"
}
}
}
}
Valid (All Keys Quoted)
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Error 3: Wrong Nesting
Invalid (Mismatched Brackets)
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
} ← Missing closing brace
} ← Missing closing brace
}
Valid (Proper Nesting)
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Error 4: Comments in JSON
Invalid (JSON Doesn't Support Comments)
{
// This is a comment - not allowed!
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp", /* Another comment */
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Valid (No Comments)
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Error 5: Single Quotes Instead of Double
Invalid (Single Quotes)
{
'mcpServers': { ← Single quotes
'corcava': {
'url': 'https://app.corcava.com/mcp',
'headers': {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
}
}
Valid (Double Quotes)
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Header Formatting Issues
Common mistakes when formatting the Authorization header:
Error: Missing "Bearer " Prefix
Invalid (No Bearer Prefix)
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "YOUR_API_KEY" ← Missing "Bearer "
}
}
}
}
Valid (With Bearer Prefix)
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY" ← Correct format
}
}
}
}
Error: Extra Spaces or Line Breaks
Invalid (Extra Whitespace)
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY" ← Extra space
}
}
}
}
Valid (Correct Spacing)
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY" ← Single space after "Bearer"
}
}
}
}
Schema Validation Errors
Even valid JSON can have schema errors if the structure doesn't match MCP requirements:
Error: Missing Required Fields
Invalid (Missing URL)
{
"mcpServers": {
"corcava": {
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
← Missing "url" field
}
}
}
Error: Wrong Field Names
Invalid (Wrong Field Name)
{
"mcpServers": {
"corcava": {
"endpoint": "https://app.corcava.com/mcp", ← Should be "url"
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Working Corcava Config Example
Here's a complete, working configuration file for Corcava MCP:
Complete Working Config
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Replace YOUR_API_KEY with your actual Corcava API key.
Multiple MCP Servers
If you have multiple MCP servers, add them to the same config:
{
"mcpServers": {
"corcava": {
"url": "https://app.corcava.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_CORCAVA_API_KEY"
}
},
"other-server": {
"url": "https://other-server.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_OTHER_API_KEY"
}
}
}
}
How to Validate Your JSON
Before saving your config file, validate the JSON syntax:
Online Validators
- JSONLint - Paste your JSON and validate
- JSON Formatter - Format and validate
- JSON Formatter & Validator - Detailed error messages
Command Line (macOS/Linux)
python3 -m json.tool config.json
This will validate and pretty-print your JSON, or show an error if invalid.
VS Code
VS Code automatically validates JSON files. Invalid JSON will show red squiggles and error messages.
Quick Fix Checklist
Before Saving Your Config
- ✅ All keys are in double quotes
- ✅ No trailing commas
- ✅ All brackets and braces are matched
- ✅ No comments (// or /* */)
- ✅ Authorization header has "Bearer " prefix with single space
- ✅ URL field is present and correct
- ✅ JSON validates in an online validator
Related Troubleshooting
- Claude Desktop: Server Not Showing - Fix issues when MCP server doesn't appear
- Connection Failed - Diagnose network and connection issues
- Troubleshooting Index - Browse all troubleshooting guides
