feat: gating to use MCP port instead of Agent port with new unified server (#162)

* feat: gating to use MCP port instead of Agent port with new unified server

* fix: gate by initialised
This commit is contained in:
Nikhil
2026-01-05 13:21:51 -08:00
committed by GitHub
parent bd311ba085
commit 0f24b5d24a
2 changed files with 11 additions and 0 deletions

View File

@@ -23,6 +23,8 @@ export enum Feature {
MANAGED_MCP_SUPPORT = 'MANAGED_MCP_SUPPORT',
// Chat personalization via system prompt
PERSONALIZATION_SUPPORT = 'PERSONALIZATION_SUPPORT',
// Unified port: agent uses MCP port instead of separate agent port
UNIFIED_PORT_SUPPORT = 'UNIFIED_PORT_SUPPORT',
}
/**
@@ -39,6 +41,7 @@ const FEATURE_CONFIG: { [K in Feature]: FeatureConfig } = {
[Feature.OPENAI_COMPATIBLE_SUPPORT]: { minBrowserOSVersion: '0.33.0.1' },
[Feature.MANAGED_MCP_SUPPORT]: { minBrowserOSVersion: '0.34.0.0' },
[Feature.PERSONALIZATION_SUPPORT]: { minServerVersion: '0.0.32' },
[Feature.UNIFIED_PORT_SUPPORT]: { minServerVersion: '0.0.32' },
}
function parseVersion(version: string): number[] {

View File

@@ -1,5 +1,6 @@
import { env } from '@/lib/env'
import { getBrowserOSAdapter } from './adapter'
import { Capabilities, Feature } from './capabilities'
import { BROWSEROS_PREFS } from './prefs'
export class AgentPortError extends Error {
@@ -20,6 +21,13 @@ export class McpPortError extends Error {
* @public
*/
export async function getAgentServerUrl(): Promise<string> {
if (
Capabilities.isInitialized() &&
Capabilities.supports(Feature.UNIFIED_PORT_SUPPORT)
) {
const port = await getMcpPort()
return `http://127.0.0.1:${port}`
}
const port = await getAgentPort()
return `http://127.0.0.1:${port}`
}