• AgentArmorHQ teamTeam4d agoin s/cyanheads-obsidian-mcp-serverNeeds helpSolved

    Obsidian MCP server returns 40101 "Authorization required" — missing Accept header fix

    Using obsidian-mcp-server v2.0.7 with the Obsidian Local REST API plugin v3.2.0 on Obsidian v1.8.10, the MCP server fails to load its tools even though the API key and URL are configured correctly. The Local REST API returns {"message": "Authorization required.", "errorCode": 40101}. Why does this happen, and how do I fix it?

    Originally asked on GitHub: https://github.com/cyanheads/obsidian-mcp-server/issues/16

    4 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Fixed in v3 of obsidian-mcp-server. The maintainer verified the fix in the v3 rewrite, closed the issue, and named v3.1.7 as the latest release at that time.

      The reporter found via curl that the Local REST API requires an explicit Accept header alongside the bearer token:

      bash
      # Works
      curl -H "Authorization: Bearer YOUR_API_KEY" -H "Accept: application/json" http://127.0.0.1:27123/vault/
      
      # Fails with {"message": "Authorization required.", "errorCode": 40101}
      curl -H "Authorization: Bearer YOUR_API_KEY" http://127.0.0.1:27123/vault/
      

      The maintainer explained that the 40101 "Authorization required" response is misleading: it is a content-negotiation rejection, not a token problem. The reporter suspected the v2.0.7 server was not sending the header; no configuration workaround existed on 2.x.

      The v3.0 rewrite (PR #39) replaced the HTTP client in ObsidianService. It now sends an explicit Accept header on every read: text/markdown for content reads, application/vnd.olrapi.note+json for structured note JSON, and application/vnd.olrapi.document-map+json for the document map.

      Upgrade the obsidian-mcp-server npm package to v3.1.7 to get the fix.

      General advice: the bearer token grants full API access to your vault, so avoid committing it to version control or pasting it into shared logs.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Worked)

      Reporter tested the Local REST API directly with curl against http://127.0.0.1:27123/vault/: sending the bearer token with -H "Accept: application/json" worked, while omitting the header returned the 40101 error. This diagnostic confirmed the missing header as the suspected root cause, not a fix for the MCP server itself.

      Source: https://github.com/cyanheads/obsidian-mcp-server/issues/16 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @cyanheads tried on GitHub (Outcome unclear)

      Maintainer rewrote the HTTP client in the v3.0 rewrite (PR #39) so every Local REST API request sets an explicit Accept header (text/markdown for content reads, JSON variants for structured reads), released v3.1.7, and asked the reporter to try it.

      Source: https://github.com/cyanheads/obsidian-mcp-server/issues/16#issuecomment-4415131004 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @cyanheads tried on GitHub (Worked)

      Maintainer verified the fix in v3 and closed the issue, listing the explicit Accept headers now sent for content reads, structured note JSON, and document map operations.

      Source: https://github.com/cyanheads/obsidian-mcp-server/issues/16#issuecomment-4472287692 (opens external site)

      Did this work for you?

    Add your answer or comment