Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/azure-cli:1": {
"installBicep": false
}
"installBicep": true
},
"ghcr.io/devcontainers/features/powershell:1": {}
},
"postCreateCommand": "npm ci",
"remoteEnv": {
Expand All @@ -31,7 +32,9 @@
"GitHub.vscode-github-actions",
"ms-azuretools.vscode-azureresourcegroups",
"ms-azure-devops.azure-pipelines",
"vitest.dev"
"vitest.dev",
"ms-vscode.powershell",
"ms-azuretools.vscode-bicep"
]
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ try {
@{ Label = 'Releases'; Suffix = 'releases' }
@{ Label = 'Wikis'; Suffix = 'wikis' }
@{ Label = 'Tag Descriptions'; Suffix = 'tagDescriptions' }
@{ Label = 'MCP Servers'; Suffix = 'mcpServers' }
)

foreach ($apiName in $apiNames) {
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/all-resource-types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ The kitchen sink APIM instance includes **every resource type and API protocol v
| `src-websocket` | WebSocket | None |
| `src-rest-versioned-v1` | REST (versioned) | OpenAPI |
| `src-rest-revisioned` | REST (revisioned) | OpenAPI |
| `src-rest-mcp-style` | REST (MCP-style backend) | None |
| `src-mcp-from-api` | MCP (from existing API) | None |
| `src-mcp-from-external` | MCP (from external MCP server) | None |

### Backend Variations
| Backend | Type |
Expand Down
39 changes: 33 additions & 6 deletions tests/integration/all-resource-types/expected-structure.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@
]
},
"apis": {
"minCount": 8,
"minCount": 9,
"expected": [
{
"name": "src-rest-openapi",
Expand Down Expand Up @@ -569,16 +569,43 @@
"notes": "Revision 2 of src-rest-revisioned"
},
{
"name": "src-rest-mcp-style",
"files": ["apiInformation.json"],
"name": "src-mcp-from-api",
"files": ["apiInformation.json", "mcpServerInformation.json"],
"spotChecks": {
"apiInformation.json": {
"properties.displayName": "KS MCP-Style REST API",
"properties.path": "ks/mcp",
"properties.displayName": "KS MCP from Existing API",
"properties.path": "ks/mcp-from-api",
"properties.type": "mcp",
"properties.subscriptionRequired": false
},
"mcpServerInformation.json": {
"properties.mcpTools": "exists"
}
},
"children": {
"operations": {
"minCount": 1,
"notes": "Explicit operation for ApiOperation BVT coverage"
}
},
"notes": "MCP API exposing REST backend operations as MCP tools; has explicit operation and mcpServerInformation.json"
},
{
"name": "src-mcp-from-external",
"files": ["apiInformation.json", "mcpServerInformation.json"],
"spotChecks": {
"apiInformation.json": {
"properties.displayName": "KS MCP from External Server",
"properties.path": "ks/mcp-external",
"properties.type": "mcp",
"properties.subscriptionRequired": false
},
"mcpServerInformation.json": {
"properties.mcpProperties": "exists",
"properties.mcpProperties.serverUrl": "https://api.githubcopilot.com/mcp"
}
},
"notes": "REST API with explicitly defined operation (no operation-level policies, so no operations directory)"
"notes": "MCP API repackaging a public external MCP server; has mcpServerInformation.json with mcpProperties.serverUrl"
}
]
},
Expand Down
80 changes: 65 additions & 15 deletions tests/integration/all-resource-types/source-apim.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,12 @@ var productPolicyXml = '''
var resolverPolicyXml = '''
<http-data-source>
<http-request>
<set-method>GET</set-method>
<set-url>https://src-graphql-backend.example.com/api/hero</set-url>
<set-method>POST</set-method>
<set-url>https://countries.trevorblades.com/graphql</set-url>
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>{"query":"{ countries { name code } }"}</set-body>
</http-request>
</http-data-source>
'''
Expand Down Expand Up @@ -786,7 +790,7 @@ resource apiGraphqlSynthetic 'Microsoft.ApiManagement/service/apis@2024-05-01' =
description: 'Kitchen sink synthetic GraphQL API with inline schema'
path: 'ks/graphql'
protocols: ['https']
serviceUrl: 'https://src-graphql-backend.example.com/graphql'
serviceUrl: 'https://countries.trevorblades.com/graphql'
Comment thread
EMaher marked this conversation as resolved.
Outdated
type: 'graphql'
apiType: 'graphql'
}
Expand All @@ -813,7 +817,7 @@ resource apiGraphqlPassthrough 'Microsoft.ApiManagement/service/apis@2024-05-01'
description: 'Kitchen sink pass-through GraphQL API'
path: 'ks/graphql-pt'
protocols: ['https']
serviceUrl: 'https://src-graphql-pt-backend.example.com/graphql'
serviceUrl: 'https://countries.trevorblades.com/graphql'
type: 'graphql'
apiType: 'graphql'
}
Expand All @@ -840,7 +844,7 @@ resource apiWebsocket 'Microsoft.ApiManagement/service/apis@2024-05-01' = {
description: 'Kitchen sink WebSocket API'
path: 'ks/ws'
protocols: ['wss']
serviceUrl: 'wss://src-ws-backend.example.com/socket'
serviceUrl: 'wss://echo.websocket.events'
type: 'websocket'
apiType: 'websocket'
}
Expand Down Expand Up @@ -897,18 +901,35 @@ resource apiRevisionedRev2 'Microsoft.ApiManagement/service/apis@2024-05-01' = {
}
}

// 8. REST API linked to backend (MCP-style HTTP backend)
resource apiMcpStyle 'Microsoft.ApiManagement/service/apis@2024-05-01' = {
// 8. MCP API created from an existing REST API in the instance
resource apiMcpFromApi 'Microsoft.ApiManagement/service/apis@2024-05-01' = {
parent: apim
name: 'src-rest-mcp-style'
name: 'src-mcp-from-api'
properties: {
displayName: 'KS MCP-Style REST API'
description: 'REST API configured with MCP-style backend pattern'
path: 'ks/mcp'
displayName: 'KS MCP from Existing API'
description: 'MCP server created by exposing an existing REST API in the instance as MCP tools'
path: 'ks/mcp-from-api'
protocols: ['https']
serviceUrl: 'https://src-mcp-server.example.com/mcp/v1'
serviceUrl: 'https://src-mcp-from-api-backend.example.com/api'
subscriptionRequired: false
apiType: 'http'
type: 'mcp'
apiType: 'mcp'
}
}

// 9. MCP API created from an existing (external) public MCP server
resource apiMcpFromExternal 'Microsoft.ApiManagement/service/apis@2024-05-01' = {
Comment thread
EMaher marked this conversation as resolved.
Outdated
parent: apim
name: 'src-mcp-from-external'
properties: {
displayName: 'KS MCP from External Server'
description: 'MCP server repackaging a public external MCP server via APIM'
path: 'ks/mcp-external'
protocols: ['https']
serviceUrl: 'https://api.githubcopilot.com/mcp'
subscriptionRequired: false
type: 'mcp'
apiType: 'mcp'
}
}

Expand Down Expand Up @@ -1033,9 +1054,9 @@ resource apiRestOpPolicy 'Microsoft.ApiManagement/service/apis/operations/polici
}
}

// --- Explicit API Operation (on MCP-style API for full coverage) ---
// --- Explicit API Operation (on MCP from-API API for full coverage of ApiOperation resource type) ---
resource apiMcpOperation 'Microsoft.ApiManagement/service/apis/operations@2024-05-01' = {
parent: apiMcpStyle
parent: apiMcpFromApi
name: 'src-mcp-invoke'
properties: {
displayName: 'Invoke MCP Tool'
Expand All @@ -1051,6 +1072,35 @@ resource apiMcpOperation 'Microsoft.ApiManagement/service/apis/operations@2024-0
}
}

// --- MCP Server (from existing API) ---
resource mcpServerFromApi 'Microsoft.ApiManagement/service/apis/mcpServers@2024-05-01' = {
parent: apiMcpFromApi
name: 'default'
properties: {
mcpTools: [
{
name: 'httpGet'
description: 'Perform a GET request via the underlying REST API backend'
}
{
name: 'httpPost'
description: 'Perform a POST request via the underlying REST API backend'
}
]
}
}

// --- MCP Server (from external MCP server) ---
resource mcpServerFromExternal 'Microsoft.ApiManagement/service/apis/mcpServers@2024-05-01' = {
parent: apiMcpFromExternal
name: 'default'
properties: {
mcpProperties: {
serverUrl: 'https://api.githubcopilot.com/mcp'
}
}
}

// --- Explicit API Schema (on REST API for full coverage) ---
resource apiRestSchema 'Microsoft.ApiManagement/service/apis/schemas@2024-05-01' = {
parent: apiRestOpenapi
Expand Down
Loading