Skip to content

[FEATURE] Add support for custom HTTP and HTTPS ports via environment variables #40

@davibusanello

Description

@davibusanello

Feature Description

Currently, the MCP server only allows the use of default ports for HTTP (27123) and HTTPS (27124). There is no way to specify custom ports for either protocol.

Suggestion

  • Add two optional environment variables to allow custom port configuration:
    • OBSIDIAN_HTTP_PORT (default: 27123)
    • OBSIDIAN_HTTPS_PORT (default: 27124)
  • If set, these should override the default ports for the respective protocols.
  • Maintain backwards compatibility by falling back to current defaults if the variables are not provided.

Implementation Notes

  • Update the port selection logic (see BASE_URL calculation in mcp-server/src/shared/makeRequest.ts) to use these environment variables if present.
  • Document usage in the README and/or relevant config guides.

Motivation

  • Enables running the MCP server on ports that do not conflict with other applications.
  • Improves flexibility for users with restrictive environments or specific networking requirements.
  • Small security improvements by not using standard ports.

Additional Context

This would address the main limitation for custom port/address support, as custom addresses are already configurable via OBSIDIAN_HOST.

I'm open to work on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions