"Invalid JSON payload received" after attempting to configure Notion MCP Server as a custom extension
Notion.so provides an MCP server to be used with a private API key.
This works fine in MCP clients that use the Cursor/Claude config style, where there is a JSON file with contents like this:
"mcpServers": {
"notionApi": {
"command": "npx",
"args": ["-y", "@notionhq/notion-mcp-server"],
"env": {
"OPENAPI_MCP_HEADERS":
"{\"Authorization\": \"Bearer ntn_****\", \"Notion-Version\": \"2022-06-28\" }"
}
}
}
This is the style of config provided as an example by Notion's MCP Server documentation.
The Notion MCP server accepts a OPENAPI_MCP_HEADERS envar containing the API key, embedded within the full header string. The above is my working config for Claude Desktop (with the key redacted, obviously).
However, attempting to configure this for Goose causes this extremely long error:
Ran into this error: Request failed: Request failed with status: 400 Bad Request. Message: Invalid JSON payload received. Unknown name "type" at 'tools.function_declarations[31].parameters.properties[2].value.items.properties[0].value.properties[0].value.items.properties[0].value.properties[1].value': Proto field is not repeating, cannot start list. Invalid JSON payload received. Unknown name "type" at 'tools.function_declarations[31].parameters.properties[2].value.items.properties[1].value.properties[0].value.items.properties[0].value.properties[1].value': Proto field is not repeating, cannot start list. Invalid JSON payload received. Unknown name "additionalProperties" at 'tools.function_declarations[36].parameters.properties[5].value': Cannot find field. Invalid JSON payload received. Unknown name "type" at 'tools.function_declarations[36].parameters.properties[5].value.properties[0].value.items.properties[0].value.properties[1].value': Proto field is not repeating, cannot start list. Invalid JSON payload received. Unknown name "additionalProperties" at 'tools.function_declarations[37].parameters.properties[4].value': Cannot find field. Invalid JSON payload received. Unknown name "additionalProperties" at 'tools.function_declarations[38].parameters.properties[1].value': Cannot find field. Invalid JSON payload received. Unknown name "type" at 'tools.function_declarations[38].parameters.properties[2].value.items.properties[0].value.properties[1].value': Proto field is not repeating, cannot start list. Invalid JSON payload received. Unknown name "type" at 'tools.function_declarations[39].parameters.properties[1].value.items.properties[0].value.properties[1].value': Proto field is not repeating, cannot start list. Invalid JSON payload received. Unknown name "additionalProperties" at 'tools.function_declarations[39].parameters.properties[2].value': Cannot find field. Invalid JSON payload received. Unknown name "type" at 'tools.function_declarations[39].parameters.properties[3].value.items.properties[0].value.properties[1].value': Proto field is not repeating, cannot start list..
Inspecting the values stored in the MacOS key chain, I can see that Goose stores a JSON blob containing all previously configured secret keys. It seems likely that the quote-escaped JSON sequence stored against the OPENAPI_MCP_HEADERS key is causing the JSON decoder to fail.
Extension config in ~/.config/goose/config.yaml:
notion:
args:
- -y
- '@notionhq/notion-mcp-server'
bundled: null
cmd: npx
description: ''
enabled: true
env_keys:
- OPENAPI_MCP_HEADERS
envs: {}
name: notion
timeout: 300
type: stdio
To Reproduce Steps to reproduce the behavior:
- Open Goose settings panel
- Add Custom Extension
- Set name as 'notion' and extension type as 'STDIO'
- Add
npx -y @notionhq/notion-mcp-serveras the command - Add
OPENAPI_MCP_HEADERSenvironment variable with the above quote-escaped JSON blob as the value - Save
- Toast message shows with "notion: Successfully activated extension!"
- In Goose session, enter any prompt
- Goose emits the above error
Expected behavior Goose can make the stored environment variable available to the Notion MCP server.
System Information:
- OS & Arch: MacOS 14.4.1
- Interface: UI
- Version: v1.0.24
- Extensions enabled: Built-ins only
- Provider & Model: gemini-2.5-flash-preview-05-20
Additional context
- Also tried using a non-escaped version of the JSON blob as the environment variable value
- Same Notion MCP server instance (via
npx) confirmed working on the same system using Claude Desktop as the client - Notion API key confirmed working
- Goose works as expected if the Notion custom extension is removed
- Goose works as expected if the Notion custom extension is installed, but disabled
- Prompt does not have to mention or require any MCP tools, any prompt (eg: "count to ten") exhibits the same error
- Other custom extensions confirmed working on the same system, but removed during this test
can you try setting it as an env var and see if that unblocks for now? https://github.com/block/goose/blob/4ff5ed462aee0d5e7690713621578f9cd3c75400/crates/goose/src/config/base.rs#L420-L434
same with fetch server and logseq server
This also happens in Linux, only with Gemini, not OpenRouter
this should be fixed in the latest version