SigmaHunting query: tune before alertingMCP servers and agent configuration
New MCP server registered through an agent CLI (claude / codex / gemini mcp add)
Claude Code (`claude mcp add`, which also covers add-json), Codex (`codex mcp add <name> -- <command>`) and Gemini CLI (`gemini mcp add`) register MCP servers from the command line; user-scope servers load in every project. Registrations made by scripts or postinstall hooks, or ones that launch remote or hidden-path commands, deserve a look.
- Log source
- Process creation (EDR / Sysmon / macOS Endpoint Security)
- Techniques
- ASI04 Agentic Supply Chain Vulnerabilities · AML.T0081 Modify AI Agent Configuration · LLM03 Supply Chain
- MITRE ATT&CK
- T1546Event Triggered Execution
- Reviewed
- 2026-11-10
Query
title: MCP Server Registered Via AI Agent CLI
id: 31608b94-77a2-4d5e-8287-f5db62fa5888
status: experimental
description: Detects registration of a new MCP server through the Claude Code, Codex or Gemini CLI.
references:
- https://code.claude.com/docs/en/mcp
- https://learn.chatgpt.com/docs/developer-commands?surface=cli
- https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md
author: ThreatDeck
date: 2026-11-09
modified: 2026-11-10
tags:
- attack.persistence
- attack.t1546
- detection.threat-hunting
logsource:
category: process_creation
detection:
selection_tool:
CommandLine|contains:
- 'claude'
- 'codex'
- 'gemini'
selection_add:
CommandLine|contains: ' mcp add'
condition: all of selection_*
falsepositives:
- Developers adding approved MCP servers
- Onboarding scripts that register the organization's standard servers
level: low Expected false positives
- Developers and onboarding scripts adding approved MCP servers
Sources
- Claude Code docs: MCP (configuration scopes and claude mcp add)
- Codex CLI command reference
- Gemini CLI docs: MCP servers (gemini mcp add)
Reviewed against vendor documentation, not tested in your environment. Defensive use only.