TL;DR: 53% of MCP servers still rely on static API keys or PATs, only 8.5% use OAuth, and 79% pass API keys through environment variables, leaving AI agent integrations built on exposed, long-lived credentials, according to Astrix Security’s State of MCP Server Security 2025. Hardcoded secrets make MCP adoption an identity governance problem, not just an implementation problem.
NHIMG editorial — based on content published by Astrix Security: State of MCP Server Security 2025
By the numbers:
- The research analyzed over 5,200 public repositories.
- Only 8.5% use OAuth, the preferred delegation framework.
Questions worth separating out
Q: How should security teams handle hardcoded credentials in MCP server deployments?
A: They should remove static secrets from configuration files, environment variables, and code repositories, then replace them with runtime retrieval from a controlled vault.
Q: Why do MCP servers create more NHI risk than ordinary service integrations?
A: MCP servers often sit in front of multiple tools and data sources, so a single exposed secret can grant broad downstream access.
Q: What do security teams get wrong about secret rotation in AI agent environments?
A: They often focus on rotation cadence without first fixing where secrets live and how widely they are reused.
Practitioner guidance
- Eliminate hardcoded MCP secrets from repositories and configs Move credentials out of configuration files, environment variables, and checked-in manifests.
- Scope each MCP credential to a single agent and tool boundary Avoid reusable credentials that can call multiple systems.
- Audit MCP deployments for OAuth coverage and fallback paths Identify where static API keys or PATs are still being used because OAuth is unavailable or unimplemented.
What's in the full report
Astrix Security's full research covers the operational detail this post intentionally leaves for the source:
- Repository-level breakdown of where hardcoded MCP secrets were found and how they were stored
- Credential pattern analysis showing which deployment styles relied on API keys, PATs, or OAuth
- The MCP Secret Wrapper implementation details for fetching secrets at runtime
- The full recommendation set for developers and enterprise teams securing MCP integrations
👉 Read Astrix Security's State of MCP Server Security 2025 research →
MCP server security and hardcoded credentials: what teams need to know?
Explore further
View Full Forum → | NHI Foundation Course → | Our Services →