
Microsoft Graph Security
STDIOMCP server for Microsoft Graph Security APIs with intelligent field selection and optimization.
MCP server for Microsoft Graph Security APIs with intelligent field selection and optimization.
A Model Context Protocol (MCP) server implementation for Microsoft Graph Security APIs, providing intelligent field selection and token optimisation for AI assistant interactions.
This server implements the Model Context Protocol to expose Microsoft Graph Security APIs (alerts, incidents) to MCP-compatible AI assistants. It includes intelligent field selection using native Graph API $select
parameters to reduce response sizes and token usage.
$select
parameters┌─────────────────┐ ┌──────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ MCP Client │ │ MCP Server │ │ Universal │ │ Microsoft │
│ (AI Assistant) │◄──►│ (This Tool) │◄──►│ Graph Client │◄──►│ Graph Security │
└─────────────────┘ └──────────────┘ └─────────────────┘ └─────────────────┘
internal/mcp
): Handles JSON-RPC 2.0 protocol communicationinternal/graph/framework
): Graph API abstraction with field selectioninternal/entities
): Schema definitions with field priority metadatainternal/context
): TTL-based context optimizationinternal/auth
): Azure AD credential handlinggit clone https://github.com/LaurieRhodes/MCP-GraphSecurityIncidents.git cd MCP-GraphSecurityIncidents go build -o graph-security-incidents.exe ./cmd/server
Grant these Microsoft Graph permissions to your Azure AD application:
SecurityAlert.Read.All
SecurityAlert.ReadWrite.All
SecurityIncident.Read.All
SecurityIncident.ReadWrite.All
Create config.json
:
{ "auth": { "type": "app", "tenant": "your-tenant-id", "clientId": "your-client-id", "clientSecret": "your-client-secret" }, "graph": { "apiVersion": "beta", "endpoint": "https://graph.microsoft.com", "requestTimeout": 30, "security": { "alertsApiVersion": "v2", "incidentsApiVersion": "v1" } }, "server": { "name": "mcp-graph-security-incidents", "version": "1.0.0" } }
Add to your MCP client configuration:
{ "mcpServers": { "graph-security": { "command": "/path/to/graph-security-incidents", "args": [] } } }
Note that Claude is a poor LLM for management of Security data due to its safety protocols preventing sensitive data to be divulged. LLM Testing Results: Provides detailed analysis of current LLM with tool using capabilities against this MCP server.
Tool | Description | Parameters |
---|---|---|
graph_entity_list | List security entities | entityType , filter , top , orderBy , intent |
graph_entity_get | Get specific entity | entityType , entityId , expand |
graph_entity_update | Update entity properties | entityType , entityId , properties |
graph_entity_comment | Add comment to entity | entityType , entityId , comment |
graph_entity_navigate | Navigate entity relationships | sourceEntityType , sourceEntityId , targetEntityType |
graph_entity_list_next | Get next page of results | nextLink |
graph_entity_schema | Get entity schema info | entityType , operation |
Tool | Description | Parameters |
---|---|---|
context_discover | Discover entity capabilities | entityType , focusArea |
context_stats | Get context usage statistics | None |
context_configure | Configure context behavior | action , level , seconds , toolName |
alert
: Microsoft Graph Security alertsincident
: Microsoft Graph Security incidentsThe server automatically detects query intent and selects appropriate fields:
type QueryIntent string const ( IntentOverview QueryIntent = "overview" // Essential fields only IntentStandard QueryIntent = "standard" // Essential + operational fields IntentComplete QueryIntent = "complete" // All fields )
Fields are categorized by priority for selection optimization:
Context is provided based on time-to-live (TTL) settings:
├── cmd/server/ # Main server entry point
├── internal/
│ ├── auth/ # Authentication implementations
│ ├── config/ # Configuration management
│ ├── context/ # Smart context management
│ ├── entities/ # Entity system and schemas
│ ├── graph/ # Microsoft Graph client
│ ├── mcp/ # MCP protocol implementation
│ ├── schemas/ # Legacy schema definitions
│ ├── tools/ # Tool registration and schemas
│ └── utils/ # Utility functions
├── docs/ # Documentation
└── config.example.json # Example configuration
internal/entities/
Entity
interfaceinit()
functiongo build -o graph-security-incidents ./cmd/server
This is a personal development and I doubt there is much interest in extending this framework to a full community development project.
This project is licensed under the MIT License - see LICENSE file for details.