@@ -19,6 +19,7 @@ type AgentServeCommand struct {
1919 agentName string
2020 host string
2121 port int
22+ mcpServerURI string
2223}
2324
2425type WorkflowServeCommand struct {
@@ -27,10 +28,12 @@ type WorkflowServeCommand struct {
2728 workflowFile string
2829 host string
2930 port int
31+ mcpServerURI string
3032}
3133
3234// NewServeCommand creates a new serve command
3335func NewAgentServeCommand () * cobra.Command {
36+ var mcpServerURI string
3437 agentServeCmd := & AgentServeCommand {}
3538
3639 cmd := & cobra.Command {
@@ -69,6 +72,7 @@ func NewAgentServeCommand() *cobra.Command {
6972 return fmt .Errorf ("invalid port number: %s" , portStr )
7073 }
7174 }
75+ agentServeCmd .mcpServerURI = mcpServerURI
7276
7377 return agentServeCmd .Run ()
7478 },
@@ -77,11 +81,13 @@ func NewAgentServeCommand() *cobra.Command {
7781 cmd .Flags ().String ("agent-name" , "" , "Specific agent name to serve (if multiple in file)" )
7882 cmd .Flags ().String ("host" , "127.0.0.1" , "Host to bind to" )
7983 cmd .Flags ().String ("port" , "8000" , "Port to serve on" )
84+ cmd .Flags ().StringVar (& mcpServerURI , "mcp-server-uri" , "" , "Maestro MCP server URI (overrides MAESTRO_MAESTRO_MCP_SERVER_URI environment variable)" )
8085 return cmd
8186}
8287
8388// NewServeCommand creates a new serve command
8489func NewWorkflowServeCommand () * cobra.Command {
90+ var mcpServerURI string
8591 workflowServeCmd := & WorkflowServeCommand {}
8692
8793 cmd := & cobra.Command {
@@ -116,6 +122,7 @@ func NewWorkflowServeCommand() *cobra.Command {
116122 return fmt .Errorf ("invalid port number: %s" , portStr )
117123 }
118124 }
125+ workflowServeCmd .mcpServerURI = mcpServerURI
119126
120127 return workflowServeCmd .Run ()
121128 },
@@ -124,6 +131,7 @@ func NewWorkflowServeCommand() *cobra.Command {
124131 cmd .Flags ().String ("agent-name" , "" , "Specific agent name to serve (if multiple in file)" )
125132 cmd .Flags ().String ("host" , "127.0.0.1" , "Host to bind to" )
126133 cmd .Flags ().String ("port" , "8000" , "Port to serve on" )
134+ cmd .Flags ().StringVar (& mcpServerURI , "mcp-server-uri" , "" , "Maestro MCP server URI (overrides MAESTRO_MAESTRO_MCP_SERVER_URI environment variable)" )
127135 return cmd
128136}
129137
@@ -159,8 +167,7 @@ func (c *WorkflowServeCommand) serveWorkflow() error {
159167 c .Console ().Print (fmt .Sprintf ("Serving workflow at %s:%d\n " , c .host , c .port ))
160168
161169 // Get MCP server URI
162- // serverURI, _ := common.GetMCPServerURI(mcpServerURI)
163- serverURI , err := common .GetMCPServerURI ("" )
170+ serverURI , err := common .GetMaestroMCPServerURI (c .mcpServerURI )
164171 if err != nil {
165172 if common .Progress != nil {
166173 common .Progress .StopWithError ("Failed to get MCP server URI" )
@@ -275,8 +282,7 @@ func (c *AgentServeCommand) getAgentFramework() (string, error) {
275282// serveContainerAgent serves a container agent
276283func (c * AgentServeCommand ) serveContainerAgent () error {
277284 // Get MCP server URI
278- // serverURI, _ := common.GetMCPServerURI(mcpServerURI)
279- serverURI , err := common .GetMCPServerURI ("" )
285+ serverURI , err := common .GetMaestroMCPServerURI (c .mcpServerURI )
280286 if err != nil {
281287 if common .Progress != nil {
282288 common .Progress .StopWithError ("Failed to get MCP server URI" )
@@ -362,8 +368,7 @@ func (c *AgentServeCommand) serveContainerAgent() error {
362368// serveFastAPIAgent serves a FastAPI agent
363369func (c AgentServeCommand ) serveFastAPIAgent () error {
364370 // Get MCP server URI
365- // serverURI, _ := common.GetMCPServerURI(mcpServerURI)
366- serverURI , err := common .GetMCPServerURI ("" )
371+ serverURI , err := common .GetMaestroMCPServerURI (c .mcpServerURI )
367372 if err != nil {
368373 if common .Progress != nil {
369374 common .Progress .StopWithError ("Failed to get MCP server URI" )
0 commit comments