Connect Cortex XDR to ChatGPT: Automate Cases & Threat Intel
Learn how to connect Cortex XDR to ChatGPT using a managed MCP server. Automate incident triage, endpoint isolation, and XQL threat hunting with AI agents.
If you need to connect Cortex XDR to ChatGPT to automate incident response workflows, orchestrate endpoint isolation, or execute complex XQL threat hunts, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between ChatGPT's tool calls and Cortex XDR's highly specialized REST APIs. You can either build, host, and maintain this middleware yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL.
If your team uses Claude, check out our guide on connecting Cortex XDR to Claude or explore our broader architectural overview on connecting Cortex XDR to AI Agents.
Giving a Large Language Model (LLM) read and write access to an enterprise security platform like Palo Alto's Cortex XDR is a massive engineering challenge. You have to handle complex asynchronous query lifecycles, map intricate incident data payloads to MCP tool definitions, and carefully control which API actions an agent is allowed to execute. Every time your security team updates their workflow requirements, your custom server code must be updated, redeployed, and tested.
This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Cortex XDR, connect it natively to ChatGPT, and execute complex Security Operations Center (SOC) workflows using natural language.
The Engineering Reality of the Cortex XDR API
A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, implementing it against Cortex XDR's complex security APIs is exceptionally painful.
If you decide to build a custom MCP server for Cortex XDR, you own the entire API lifecycle. Here are the specific integration challenges that break standard CRUD assumptions when working with Cortex XDR:
Asynchronous XQL Query Lifecycles
Unlike simple REST APIs where a GET request returns immediate data, Cortex XDR's XQL (Cortex XDR Query Language) API operates asynchronously. When an LLM wants to search for a malicious hash, your MCP server must first execute a start_xql_query request, which returns a query ID. The server must then manage the polling state, checking the quota and status until the query completes, and finally fetch the results. If the result set exceeds 1,000 rows, the API requires handling chunked streams. Building a custom MCP server means writing stateful logic to handle this async flow - otherwise, ChatGPT will time out waiting for a response or hallucinate the results.
Complex Nested Incident Data
Cortex XDR incident structures are deeply nested. A single incident contains alerts, and those alerts can contain multiple events, some of which may include PCAP (Packet Capture) triggering packets. When an LLM asks "Get me the full context for Incident 4022", a single API call isn't enough. A custom MCP server must recursively fetch the base incident, the extra incident data, the multi-event alerts, and potentially the PCAP data, normalizing all of this into a single flat context window that ChatGPT can understand without exhausting its token limit.
Strict Rate Limits and Concurrency Caps
Cortex XDR enforces strict rate limits, such as a maximum of 4 parallel XQL queries per tenant and tight per-minute request caps. A custom MCP server needs to interpret these specific Cortex limits and translate them into something the LLM understands.
Note on how Truto handles this: Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream Cortex XDR API returns an HTTP 429, Truto passes that error directly to the caller. Truto normalizes the upstream rate limit info into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF spec. The caller (ChatGPT or your custom agent framework) is responsible for reading these headers and executing its own backoff strategy.
Cortex XDR to ChatGPT Quickstart Guide
If you want the fastest path from a fresh Truto account to ChatGPT calling the Cortex XDR API, follow these steps.
What you need:
- A Truto account with API access.
- A Cortex XDR API Key with the necessary roles (e.g., Instance Administrator, Investigation, Response).
- A ChatGPT Pro, Plus, Business, Enterprise, or Education seat with Developer mode available.
Step 1: Connect Cortex XDR
First, you need to establish the core integration connection. In the Truto dashboard, navigate to Integrated Accounts -> New Integrated Account, select Cortex XDR, and provide your API Key and FQDN. Truto securely stores the credentials.
Step 2: Grab your Integrated Account ID
You can copy the integrated_account_id from the account detail page in the UI, or list it via the API:
curl https://api.truto.one/integrated-account \
-H "Authorization: Bearer $TRUTO_API_TOKEN"Step 3: Generate a Cortex XDR MCP Server
You can generate the MCP server URL using either the Truto UI or the API.
Method A: Via the Truto UI
- Navigate to the integrated account page for your Cortex XDR connection.
- Click the MCP Servers tab.
- Click Create MCP Server.
- Select your desired configuration (e.g., read-only, specific tags for "incidents" or "response").
- Copy the generated MCP server URL.
Method B: Via the API
Make a POST request to scope an MCP endpoint to your Cortex account. You can filter by methods and tags to strictly constrain what ChatGPT can touch:
curl -X POST https://api.truto.one/integrated-account/$INTEGRATED_ACCOUNT_ID/mcp \
-H "Authorization: Bearer $TRUTO_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Cortex XDR for ChatGPT",
"config": {
"methods": ["read", "write", "custom"],
"tags": ["cases", "endpoints", "xql"]
}
}'Both methods return a url field resembling https://api.truto.one/mcp/<token>. This single URL handles all routing and authentication - treat it like a sensitive secret.
Step 4: Connect the MCP Server to ChatGPT
You can connect this server to ChatGPT using either the UI or a local configuration file.
Method A: Via the ChatGPT UI
- Open ChatGPT and navigate to Settings -> Apps -> Advanced settings.
- Enable Developer mode (MCP support requires this flag).
- Under MCP servers / Custom connectors, click add a new server.
- Name: Enter a label (e.g., "Cortex XDR").
- Server URL: Paste the Truto MCP URL you generated in Step 3.
- Save the configuration. ChatGPT will immediately connect, perform the handshake, and list the available Cortex XDR tools.
Method B: Via manual config file (Local ChatGPT Desktop/CLI testing) If you are configuring a local agent or using a framework that reads from an MCP config file, you can use the Server-Sent Events (SSE) transport wrapper:
{
"mcpServers": {
"cortex-xdr": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"https://api.truto.one/mcp/<your-token-here>"
]
}
}
}Hero Tools for Cortex XDR
Truto automatically generates well-structured tools directly from the Cortex XDR API documentation. Here are the highest-leverage tools your AI agent can now use to automate security operations.
Start an XQL Query
Tool Name: cortex_xdr_xql_start_xql_query
This tool allows ChatGPT to execute raw Cortex XDR Query Language (XQL) commands to hunt for threats, analyze network traffic, or parse logs. It returns a query ID that the agent can use to fetch the results.
"Run an XQL query to find all network connections made to IP 198.51.100.45 over the last 24 hours. Return the query ID so we can check the results."
Get XQL Query Results
Tool Name: cortex_xdr_xql_get_query_results
Once an XQL query is started, ChatGPT uses this tool to retrieve the actual data payload. The agent will parse the resulting JSON arrays to identify suspicious activity.
"Fetch the results for XQL query ID '12345-abcde'. Summarize any processes that initiated outbound connections."
Isolate Endpoints
Tool Name: cortex_xdr_endpoints_isolate
This is a critical response action tool. It allows the LLM to immediately cut off network access for a compromised host, preventing lateral movement during an active incident.
"Isolate endpoint ID '02938482' immediately. The host is showing signs of lateral movement and active ransomware execution."
Retrieve Incident Extra Data
Tool Name: cortex_xdr_incidents_get_incident_extra_data
Standard incident queries only return high-level metadata. This tool pulls the deeply nested context required for actual triage, including alerts, key artifacts, and whether the incident contains PCAP data.
"Pull the extra incident data for Incident #4920. I need to see the exact alert names and the associated file hashes."
Add a Case Timeline Record
Tool Name: cortex_xdr_case_timeline_add_record
Security analysts spend hours documenting their findings. ChatGPT can use this tool to automatically inject investigation summaries, notes, and actions directly into the Cortex XDR case timeline.
"Add a timeline record to Case ID 992. Note that the suspicious hash was analyzed, confirmed as a false positive, and the endpoint was released from isolation."
Insert JSON Indicators (IOCs)
Tool Name: cortex_xdr_indicators_insert_jsons
This tool enables automated threat intelligence ingestion. When ChatGPT identifies malicious infrastructure in a report or an analysis feed, it can push those IOCs directly into Cortex XDR's indicator lists.
"Take these three malicious IP addresses and insert them into the Cortex XDR indicator list as high-severity blocklist items."
This is just a small selection of the available tools. Truto dynamically exposes the entire Cortex XDR API surface. For a complete list of endpoints, schemas, and capabilities, view the Cortex XDR integration page.
Workflows in Action
Connecting ChatGPT to Cortex XDR transforms the SOC analyst experience. Instead of clicking through dozens of screens, analysts can execute multi-step investigations using natural language. Here is how that looks in practice.
Scenario 1: Automated Incident Triage and Containment
The User Prompt:
"Analyze the alerts for Incident 8842. If there are signs of lateral movement or credential dumping, immediately isolate the affected endpoints and update the case timeline with your findings."
The Agent Workflow:
- ChatGPT calls
cortex_xdr_incidents_get_incident_extra_datapassing the incident ID8842to retrieve the nested alerts and artifacts. - The model analyzes the returned JSON payload and identifies an alert for "LSASS memory access" (credential dumping) on a specific
endpoint_id. - ChatGPT calls
cortex_xdr_endpoints_isolatepassing the compromisedendpoint_idto sever its network access. - Finally, the agent calls
cortex_xdr_case_timeline_add_recordto inject a detailed summary of the alerts found and the isolation action taken directly into the case file.
sequenceDiagram participant User as SOC Analyst participant Agent as ChatGPT participant Truto as Truto MCP Server participant Cortex as Cortex XDR API User->>Agent: "Analyze Incident 8842..." Agent->>Truto: Call cortex_xdr_incidents_get_incident_extra_data Truto->>Cortex: POST /public_api/v1/incidents/get_incident_extra_data Cortex-->>Truto: Return nested alerts Truto-->>Agent: JSON response Agent->>Truto: Call cortex_xdr_endpoints_isolate Truto->>Cortex: POST /public_api/v1/endpoints/isolate Cortex-->>Truto: Isolation confirmed Truto-->>Agent: Success Agent-->>User: "Incident analyzed. Endpoint isolated successfully."
Scenario 2: Threat Intel Ingestion and Hunting
The User Prompt:
"Take this list of IP addresses from the latest CISA advisory. Insert them as malicious indicators in Cortex, then run an XQL query to see if any of our endpoints have connected to them in the last 7 days."
The Agent Workflow:
- ChatGPT parses the unstructured advisory text and extracts the IP addresses.
- The agent calls
cortex_xdr_indicators_insert_jsonsto push the new IOCs into the tenant's threat intelligence database. - ChatGPT dynamically constructs an XQL query string targeting network connection logs for those specific IPs.
- The agent calls
cortex_xdr_xql_start_xql_queryto execute the hunt. - The agent calls
cortex_xdr_xql_get_query_resultsto retrieve the findings and reports back to the user whether the environment is compromised.
Security and Access Control
Giving an LLM access to your primary XDR platform requires strict guardrails. Truto's MCP servers provide granular, cryptographic control over what the AI can do:
- Method Filtering: Constrain the MCP server to only allow specific operations. You can configure a server to only allow
readmethods (blocking any configuration changes or isolations), or limit it to exact methods likegetandlist. - Tag Filtering: Restrict the AI to specific functional areas. By applying tags like
incidentsorxql, the generated MCP server will only expose tools related to those tags, hiding the rest of the Cortex API. - Secondary Authentication (
require_api_token_auth): By default, possessing the MCP URL grants access. For high-security SOC environments, you can enable this flag. It forces the ChatGPT client to also pass a valid Truto API token in the headers, ensuring only authenticated human analysts can trigger the agent. - Time-to-Live (
expires_at): You can generate ephemeral MCP servers. Set an expiration date, and Truto will automatically destroy the server, the cryptographic tokens, and the KV storage records when time is up - perfect for temporary incident response war rooms. - Rate Limit Transparency: If your agent gets overly aggressive, Truto passes Cortex XDR's HTTP 429 errors directly back to the LLM alongside standard
ratelimit-*headers, ensuring the agent is aware of the limits and can execute proper backoff.
Stop Hand-Coding Security Integrations
Building a custom integration between ChatGPT and Cortex XDR forces your engineering team to maintain complex state logic, handle deeply nested JSON parsing, and manage OAuth or API key lifecycles. With Truto, you rely on dynamic, documentation-driven tool generation.
As Palo Alto updates the Cortex XDR API, Truto automatically updates the MCP tool definitions. Your LLM always has the latest context, your security team always has the latest tools, and your engineers write exactly zero lines of boilerplate API code.
FAQ
- How does the MCP server handle Cortex XDR rate limits?
- Truto does not retry or apply backoff automatically. When Cortex XDR returns an HTTP 429 error, Truto passes it directly to the caller with standard IETF rate-limit headers. The AI agent must handle its own backoff strategy.
- Can I prevent ChatGPT from isolating endpoints?
- Yes. When creating the MCP server in Truto, you can use method filtering to restrict the server to 'read' operations only, ensuring the AI can analyze incidents but cannot execute response actions.
- Do I need to write code to map Cortex XDR's API to ChatGPT tools?
- No. Truto dynamically generates the MCP tools directly from the Cortex XDR API documentation and resource schemas, meaning you don't have to write or maintain custom tool definitions.