goose icon indicating copy to clipboard operation
goose copied to clipboard

"Invalid JSON payload received" after attempting to configure Notion MCP Server as a custom extension

Open jordan-ghost opened this issue 6 months ago • 1 comments

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:

  1. Open Goose settings panel
  2. Add Custom Extension
  3. Set name as 'notion' and extension type as 'STDIO'
  4. Add npx -y @notionhq/notion-mcp-server as the command
  5. Add OPENAPI_MCP_HEADERS environment variable with the above quote-escaped JSON blob as the value
  6. Save
  7. Toast message shows with "notion: Successfully activated extension!"
  8. In Goose session, enter any prompt
  9. 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

jordan-ghost avatar May 27 '25 07:05 jordan-ghost

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

salman1993 avatar May 29 '25 20:05 salman1993

same with fetch server and logseq server

dailydaniel avatar Jul 02 '25 11:07 dailydaniel

This also happens in Linux, only with Gemini, not OpenRouter

rolznz avatar Jul 07 '25 07:07 rolznz

this should be fixed in the latest version

DOsinga avatar Oct 15 '25 13:10 DOsinga