Skip to content

OBSIDIAN_API_URL environment variable is ignored - server hardcodes port 27124 #66

@randomusername21349

Description

@randomusername21349

Bug Description

The MCP server binary ignores the OBSIDIAN_API_URL environment variable and always connects to port
27124, regardless of the configured value. This makes it impossible to use MCP Tools with multiple
Obsidian vaults simultaneously on different ports.

Steps to Reproduce

  1. Set up two Obsidian vaults with Local REST API on different ports (e.g., Vault A on 27124, Vault B
    on 27126)
  2. Configure Claude Desktop with two MCP server entries, each with the correct OBSIDIAN_API_URL:
    "vault-a": {
    "command": "/path/to/vault-a/.obsidian/plugins/mcp-tools/bin/mcp-server",
    "env": {
    "OBSIDIAN_API_KEY": "...",
    "OBSIDIAN_API_URL": "https://127.0.0.1:27124"
    }
    },
    "vault-b": {
    "command": "/path/to/vault-b/.obsidian/plugins/mcp-tools/bin/mcp-server",
    "env": {
    "OBSIDIAN_API_KEY": "...",
    "OBSIDIAN_API_URL": "https://127.0.0.1:27126"
    }
    }
  3. Open both vaults in Obsidian
  4. Restart Claude Desktop

Expected Behavior

Each MCP server should connect to its configured port via OBSIDIAN_API_URL.

Actual Behavior

  • Both servers connect to port 27124 regardless of OBSIDIAN_API_URL
  • The vault on 27124 works; the vault on 27126 fails with 401 (wrong API key hitting wrong vault)
  • If only the 27126 vault is open, connection fails entirely with "Unable to connect"

Environment

  • MCP Tools: v0.2.27
  • Local REST API: v3.4.2
  • Obsidian: v1.11.5
  • macOS

Workaround

Currently, only one vault can be used at a time by ensuring the active vault is on port 27124.

Feature Request

Please add support for OBSIDIAN_API_URL (or separate OBSIDIAN_HOST/OBSIDIAN_PORT variables) so multiple
vaults can be used simultaneously with different ports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions