Skip to main content
Glama
dhippley

Azure Topology Graph MCP Server

by dhippley

export_topology

Export Azure infrastructure topology graphs in JSON or summary format to analyze resource relationships and connectivity paths.

Instructions

Export the complete topology graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoExport formatsummary

Implementation Reference

  • Handler function that implements the export_topology tool logic. It builds the topology and returns either full JSON or a summary based on the format parameter.
    case 'export_topology': { const { format = 'summary' } = args as { format?: 'json' | 'summary' }; const topology = await buildTopology(); if (format === 'json') { return { content: [ { type: 'text', text: JSON.stringify(topology, null, 2), }, ], }; } else { const resourceTypes = Array.from(new Set(topology.nodes.map(n => n.type))).sort(); const subscriptions = Array.from(new Set(topology.nodes.map(n => n.subscriptionId))).sort(); const resourceGroups = Array.from(new Set(topology.nodes.map(n => n.resourceGroup))).sort(); return { content: [ { type: 'text', text: `Azure Topology Summary:\n\n` + `Total Resources: ${topology.nodes.length}\n` + `Total Connections: ${topology.edges.length}\n\n` + `Subscriptions (${subscriptions.length}):\n${subscriptions.map(s => `• ${s}`).join('\n')}\n\n` + `Resource Groups (${resourceGroups.length}):\n${resourceGroups.map(rg => `• ${rg}`).join('\n')}\n\n` + `Resource Types (${resourceTypes.length}):\n${resourceTypes.map(rt => `• ${rt}`).join('\n')}`, }, ], }; } }
  • Input schema for the export_topology tool, defining the optional format parameter.
    inputSchema: { type: 'object', properties: { format: { type: 'string', enum: ['json', 'summary'], description: 'Export format', default: 'summary', }, }, },
  • src/server.ts:404-417 (registration)
    Registration of the export_topology tool in the tools list returned by ListToolsRequestHandler.
    name: 'export_topology', description: 'Export the complete topology graph', inputSchema: { type: 'object', properties: { format: { type: 'string', enum: ['json', 'summary'], description: 'Export format', default: 'summary', }, }, }, },
  • Key helper function called by the handler to build and cache the topology graph from Azure Resource Graph queries.
    async function buildTopology(): Promise<TopologyGraph> { const now = Date.now(); if (topologyCache && (now - cacheTimestamp) < CACHE_TTL) { return topologyCache; } console.error('Building topology from Azure resources...'); try { // Query all resources const resourcesResult = await resourceGraphClient.resources({ query: RESOURCE_QUERY, subscriptions: subscriptionIds, }); const nodes: GraphNode[] = []; const edges: GraphEdge[] = []; // Process resources into nodes if (resourcesResult.data) { for (const resource of resourcesResult.data as any[]) { const node: GraphNode = { id: resource.id, type: resource.type, name: resource.name, subscriptionId: resource.subscriptionId, resourceGroup: resource.resourceGroup, location: resource.location, tags: resource.tags, properties: resource.properties, }; nodes.push(node); } } // Build relationships/edges await buildResourceRelationships(nodes, edges); const topology: TopologyGraph = { nodes, edges }; topologyCache = topology; cacheTimestamp = now; console.error(`Topology built: ${nodes.length} nodes, ${edges.length} edges`); return topology; } catch (error) { console.error('Error building topology:', error); throw error; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dhippley/azure_mcp_graph'

If you have feedback or need assistance with the MCP directory API, please join our Discord server