Skip to content

MCP Server binary is hardcoded to port 27124 — unable to use non-default ports or run multiple vaults #67

@rhm2k

Description

@rhm2k

Description

The MCP Server binary (plugins/mcp-tools/bin/mcp-server) appears to be hardcoded to connect to the Local REST API on port 27124. It does not read the port from the Local REST API plugin's data.json configuration, nor does it accept port configuration via environment variables or command-line arguments.

This makes it impossible to:

  • Use the MCP Server with a vault whose Local REST API is configured on a non-default port
  • Run multiple vaults simultaneously with MCP access (since only one vault can occupy port 27124)

Steps to Reproduce

  1. Install MCP Tools and Local REST API in two separate vaults
  2. Configure Vault A's Local REST API on the default port (27124)
  3. Configure Vault B's Local REST API on a non-default port (e.g., 27126)
  4. Add both vaults to claude_desktop_config.json with separate entries:
"mcpServers": {
    "obsidian-vault-a": {
      "command": "/path/to/vault-a/.obsidian/plugins/mcp-tools/bin/mcp-server",
      "env": {
        "OBSIDIAN_API_KEY": "<vault-a-key>"
      }
    },
    "obsidian-vault-b": {
      "command": "/path/to/vault-b/.obsidian/plugins/mcp-tools/bin/mcp-server",
      "env": {
        "OBSIDIAN_API_KEY": "<vault-b-key>",
        "OBSIDIAN_PORT": "27126"
      }
    }
}
  1. Restart Claude Desktop

Expected Behavior

Vault B's MCP Server should connect to port 27126, either by:

  • Reading the port from the co-located Local REST API plugin's data.json (which correctly contains "port": 27126)
  • Accepting an OBSIDIAN_PORT environment variable
  • Accepting a --port command-line argument

Actual Behavior

  • Vault B's MCP Server ignores the OBSIDIAN_PORT env variable and connects to port 27124
  • If Vault A is running on 27124, Vault B's MCP Server connects to Vault A with Vault B's API key, resulting in an unauthenticated response and the error: GET / 200: apiExtensions must be an array (was missing), certificateInfo must be an object (was missing)
  • If no vault is running on 27124, the connection fails entirely with: Unable to connect. Is the computer able to access the url?

Environment

  • macOS
  • Obsidian v1.11.7
  • MCP Tools v0.2.27
  • Local REST API v3.2.0
  • Claude Desktop (Cowork mode)

Suggested Fix

Allow port configuration via one or more of these methods (in order of preference):

  1. Read the port from the vault's own Local REST API data.json (most seamless — no user config needed)
  2. Accept an OBSIDIAN_PORT environment variable in claude_desktop_config.json
  3. Accept a --port command-line argument

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions