@@ -364,18 +364,22 @@ def ensure_namespace(name, description=None):
364364 except Exception :
365365 pass
366366
367- def create_endpoint (name , nsref , transport = 'SSE' , extra = None , description = None , update_existing = True ):
367+ def create_endpoint (name , nsref , transport = None , extra = None , description = None , update_existing = True ):
368368 lr = trpc_get ('/trpc/frontend/frontend.namespaces.list?input=%7B%7D' )
369369 nid = None
370370 if lr .ok :
371371 for ns in lr .json ().get ('result' ,{}).get ('data' ,{}).get ('data' ,[]):
372372 if ns .get ('uuid' ) == nsref or ns .get ('name' ) == nsref :
373373 nid = ns .get ('uuid' ); break
374374 if not nid : return
375- # normalize transport
376- tr = (transport or 'SSE' ).upper ()
377- if tr in ('SSE' ,'STREAMABLE' ):
378- tr = 'SSE' if tr == 'SSE' else 'STREAMABLE_HTTP'
375+ # normalize transport if provided (MetaMCP serves both; transport optional)
376+ tr = None
377+ if transport :
378+ t = (transport or '' ).upper ()
379+ if t in ('SSE' ,'STREAMABLE' ):
380+ tr = 'SSE' if t == 'SSE' else 'STREAMABLE_HTTP'
381+ elif t in ('STREAMABLE_HTTP' ,):
382+ tr = t
379383 # find existing endpoint by name
380384 el = trpc_get ('/trpc/frontend/frontend.endpoints.list?input=%7B%7D' )
381385 e_uuid = None
@@ -403,7 +407,9 @@ def create_endpoint(name, nsref, transport='SSE', extra=None, description=None,
403407 log (f"endpoint updated: { name } " )
404408 else :
405409 # create new endpoint
406- body = {'name' : name ,'namespaceUuid' : nid ,'transport' : tr }
410+ body = {'name' : name ,'namespaceUuid' : nid }
411+ if tr :
412+ body ['transport' ] = tr
407413 body .update (flags )
408414 r = trpc_post ('/trpc/frontend/frontend.endpoints.create' , body )
409415 if r .ok : log (f"endpoint created: { name } ({ tr } )" )
0 commit comments