Skip to content

Configurable MCP Server URL in Admin Settings #76

Closed

Description

@vybe

Problem

The MCP server URL shown to users on the API Keys page is hardcoded in the frontend (src/frontend/src/views/ApiKeys.vue:344-351):

const mcpServerUrl = computed(() => {
  const host = window.location.hostname
  if (host === 'localhost' || host === '127.0.0.1') {
    return 'http://localhost:8080/mcp'
  }
  return `http://${host}:8080/mcp`
})

This assumes MCP always runs on port 8080 directly. In production deployments where MCP is proxied through nginx (e.g., https://us14.abilityai.dev/mcp), the generated URL is wrong — users get http://us14.abilityai.dev:8080/mcp instead of the proxied HTTPS URL.

There is no way to override this without editing source code.

Proposed Solution

Make the MCP server URL configurable via Admin Settings:

  1. Backend: Add mcp_external_url key to system_settings table

    • GET /api/settings/mcp-url — returns configured URL (or null for default behavior)
    • PUT /api/settings/mcp-url — admin-only, sets the external MCP URL
    • DELETE /api/settings/mcp-url — resets to default (auto-detect from hostname)
  2. Frontend Settings page (Settings.vue): Add "MCP Server URL" field in a new section

    • Text input with placeholder showing the auto-detected default
    • Save/Reset buttons
    • Validation: must be a valid URL ending in /mcp
  3. Frontend API Keys page (ApiKeys.vue): Fetch configured URL on mount

    • If mcp_external_url is set in settings, use it
    • Otherwise, fall back to current window.location.hostname logic
    • The getMcpConfig() function and the connection info snippet both use this URL

Files to Change

  • src/backend/routers/settings.py — Add MCP URL endpoints
  • src/frontend/src/views/Settings.vue — Add MCP URL config section
  • src/frontend/src/views/ApiKeys.vue — Fetch and use configured URL

Acceptance Criteria

  • Admin can set a custom MCP server URL in Settings
  • API Keys page shows the configured URL in connection snippets
  • Resetting returns to auto-detect behavior
  • Non-admin users cannot change the setting
  • Works for both HTTP and HTTPS URLs

Activity

  1. added
    priority-p1
    type-feature
    on Mar 6, 2026
  2. added
    complexity-low
    theme-infrastructure
    on Jun 3, 2026
  3. added a commit that references this issue on Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-lowpriority-p1theme-infrastructuretype-feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions