Repository navigation
Description
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:
-
Backend: Add
mcp_external_urlkey tosystem_settingstableGET /api/settings/mcp-url— returns configured URL (or null for default behavior)PUT /api/settings/mcp-url— admin-only, sets the external MCP URLDELETE /api/settings/mcp-url— resets to default (auto-detect from hostname)
-
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
-
Frontend API Keys page (
ApiKeys.vue): Fetch configured URL on mount- If
mcp_external_urlis set in settings, use it - Otherwise, fall back to current
window.location.hostnamelogic - The
getMcpConfig()function and the connection info snippet both use this URL
- If
Files to Change
src/backend/routers/settings.py— Add MCP URL endpointssrc/frontend/src/views/Settings.vue— Add MCP URL config sectionsrc/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
feat: Configurable MCP Server URL in Admin Settings (Abilityai#76)
docs: sync feature flows for MCP URL config (Abilityai#76)
merge: integrate upstream/main into feature branch
docs: Add MCP URL config to requirements and architecture (Abilityai#76)
merge: integrate upstream/main into feature branch
merge: integrate upstream/main into feature branch
feat: Configurable MCP Server URL in Admin Settings (Abilityai#76)
docs: sync feature flows for MCP URL config (Abilityai#76)
docs: Add MCP URL config to requirements and architecture (Abilityai#76)
docs: fix MCP URL section line reference after rebase
feat: Configurable MCP Server URL in Admin Settings (Abilityai#76)
docs: sync feature flows for MCP URL config (Abilityai#76)
docs: Add MCP URL config to requirements and architecture (Abilityai#76)
docs: fix MCP URL section line reference after rebase
feat: Configurable MCP Server URL in Admin Settings (#76) (#161)
Merge pull request #1490 from Abilityai/feature/93-fork-to-own