@@ -59,15 +59,7 @@ export async function publishApi(
5959
6060 // Step 3: Publish child resources in parallel
6161 // When a spec was imported, operations and schemas are auto-created by APIM
62- await publishApiChildren (
63- client ,
64- store ,
65- context ,
66- descriptor ,
67- config ,
68- rootResult . specImported ,
69- rootResult . embeddedMcpApplied ,
70- ) ;
62+ await publishApiChildren ( client , store , context , descriptor , config , rootResult . specImported ) ;
7163
7264 return {
7365 descriptor,
@@ -111,26 +103,6 @@ function getImportFormat(specFormat: string, _apiType?: string): string | undefi
111103interface RootApiResult {
112104 status : 'success' | 'skipped' ;
113105 specImported : boolean ;
114- embeddedMcpApplied : boolean ;
115- }
116-
117- function getEmbeddedMcpProperties (
118- json : Record < string , unknown > | undefined
119- ) : Record < string , unknown > | undefined {
120- const properties = json ?. properties as Record < string , unknown > | undefined ;
121- if ( ! properties ) {
122- return undefined ;
123- }
124-
125- const embeddedProperties : Record < string , unknown > = { } ;
126- if ( properties . mcpProperties !== undefined ) {
127- embeddedProperties . mcpProperties = properties . mcpProperties ;
128- }
129- if ( properties . mcpTools !== undefined ) {
130- embeddedProperties . mcpTools = properties . mcpTools ;
131- }
132-
133- return Object . keys ( embeddedProperties ) . length > 0 ? embeddedProperties : undefined ;
134106}
135107
136108/**
@@ -153,33 +125,12 @@ async function publishRootApi(
153125 status : 'skipped' ,
154126 action : 'noop' ,
155127 specImported : false ,
156- embeddedMcpApplied : false ,
157128 } ;
158129 }
159130
160131 // Apply overrides
161132 json = applyOverrides ( descriptor , json , config . overrides ) ;
162133
163- const embeddedMcpProperties = getEmbeddedMcpProperties (
164- await store . readResource ( config . sourceDir , {
165- type : ResourceType . McpServer ,
166- nameParts : [ ...descriptor . nameParts ] ,
167- workspace : descriptor . workspace ,
168- } )
169- ) ;
170- const embeddedMcpApplied = embeddedMcpProperties !== undefined ;
171- if ( embeddedMcpApplied ) {
172- const properties = json . properties as Record < string , unknown > | undefined ;
173- json = {
174- ...json ,
175- properties : {
176- ...( properties ?? { } ) ,
177- ...embeddedMcpProperties ,
178- } ,
179- } ;
180- logger . debug ( `Merged MCP artifact into API payload for "${ getNamePart ( descriptor . nameParts , 0 ) } "` ) ;
181- }
182-
183134 // Try to read the specification file for this API
184135 let specImported = false ;
185136 const specResult = await store . readContent ( config . sourceDir , descriptor , 'specification' ) ;
@@ -227,7 +178,6 @@ async function publishRootApi(
227178 status : 'success' ,
228179 action : 'put' ,
229180 specImported,
230- embeddedMcpApplied,
231181 } ;
232182}
233183
@@ -288,8 +238,7 @@ async function publishApiChildren(
288238 context : ApimServiceContext ,
289239 apiDescriptor : ResourceDescriptor ,
290240 config : PublishConfig ,
291- specImported : boolean = false ,
292- embeddedMcpApplied : boolean = false
241+ specImported : boolean = false
293242) : Promise < void > {
294243 // List all resources from store
295244 const allDescriptors = await store . listResources ( config . sourceDir ) ;
@@ -299,8 +248,7 @@ async function publishApiChildren(
299248 ( d ) =>
300249 API_CHILD_TYPES . includes ( d . type ) &&
301250 getNamePart ( d . nameParts , 0 ) === getNamePart ( apiDescriptor . nameParts , 0 ) &&
302- ! ( specImported && SPEC_MANAGED_CHILD_TYPES . has ( d . type ) ) &&
303- ! ( embeddedMcpApplied && d . type === ResourceType . McpServer )
251+ ! ( specImported && SPEC_MANAGED_CHILD_TYPES . has ( d . type ) )
304252 ) ;
305253
306254 // When a spec was imported, APIM auto-creates operations and schemas but loses
0 commit comments