Secure AI Engineering

MCP + DevSecOps: Securing AI Agents Inside the Software Lifecycle

MCP servers are now part of how software gets built: developers connect coding agents to repositories, ticketing, CI, cloud consoles and databases. That puts MCP inside the software lifecycle, and inside the DevSecOps programme. This article shows how to treat MCP servers as software, as integrations and as a new control point in delivery.

By EthicalHat Research · · 3 min read
Infographic: Bringing MCP into the DevSecOps lifecycle

In the last few months, MCP has become part of the developer toolchain. Coding agents in IDEs and terminals connect to MCP servers for GitHub or GitLab, issue trackers, CI systems, documentation, databases and cloud consoles. Platform teams are publishing internal MCP servers so agents can query service catalogues, run approved operations and read runbooks.

That puts MCP inside the software lifecycle, with access to source code, pipelines and infrastructure. It needs to be inside the DevSecOps programme too.

Three ways to look at an MCP server

An MCP server used in development is simultaneously:

  1. Software: code with dependencies, vulnerabilities and releases.
  2. An integration: a bridge between an AI agent and a system of record, carrying credentials and data.
  3. Privileged access: a set of capabilities an agent (and anyone who can influence that agent) can use.

Each view calls for a different set of controls.

As software: build internal servers securely

Internal MCP servers should go through the same pipeline as any other service:

  • code review, SAST, dependency and secret scanning,
  • signed, versioned releases from CI,
  • a published changelog of tool changes (because tool definitions change agent behaviour), and
  • security review for servers exposing write operations or sensitive data.
yaml
# Illustrative: an internal MCP server gets the standard service pipeline plus tool-definition checks
include:
  - project: platform/ci-templates
    file: /pipelines/service.yml       # tests, SAST, SCA, secrets, image scan, signing

mcp-tool-contract:
  stage: test
  script:
    - python -m mcp_contract.check --schema tools.schema.json   # tools match reviewed contract
    - python -m mcp_contract.diff --against "$LAST_RELEASE_TAG" # flag new or changed tools
  rules:
    - changes: [src/tools/**, tools.schema.json]

As supply chain: govern third-party servers

For vendor and community servers:

  • Approve before use: review publisher, code (for open source), requested permissions and data flows.
  • Pin versions and hash tool definitions; changes trigger re-review.
  • Distribute through a catalogue with managed client configuration, rather than letting every developer install arbitrary servers.
  • Track advisories for approved servers like any other dependency.

As privileged access: MCP as a control point

The most interesting opportunity is to use MCP to reduce risk. Instead of giving coding agents raw credentials for cloud accounts, databases or CI systems, give them narrow, audited tools:

Instead of…Offer an MCP tool like…
Cloud admin credentials in the agent's shelldescribe_service(name), get_recent_deploys(service) (read-only)
Direct database accessrun_approved_query(query_id, params) against a read replica
CI admin tokenrerun_failed_job(pipeline_id) scoped to the user's projects
Production kubectlget_pod_logs(service, since) with redaction

Each tool enforces the user's permissions, logs every call and exposes only what the task needs. This turns the agent's access into something reviewable and least-privilege, often an improvement over what developers had before.

flowchart LR
  Dev[Developer + coding agent] --> C[Managed MCP client config]
  C --> GW[MCP gateway<br/>allow-list, auth, logging]
  GW --> S1[Internal: service catalogue]
  GW --> S2[Internal: CI operations<br/>scoped tools]
  GW --> S3[Vendor: issue tracker<br/>pinned version]
  GW -.blocked.-> S4[Unapproved server]
  GW --> SIEM[(SIEM)]

Authorisation

  • Remote servers should use OAuth with per-user, audience-bound, short-lived tokens, as the MCP specification's authorisation framework describes.
  • Tools enforce the calling user's permissions; the server's own credentials should be scoped to the minimum.
  • Write tools require confirmation in the client, with full arguments shown.

Pipelines and CI

When agents run in CI, the same principles apply with extra care: CI agents often process untrusted content (issues, pull requests) and run with pipeline tokens. Give CI agents only the MCP tools they need, never deployment tools, and never with credentials that outlive the job.

Monitoring

  • Send tool-call logs (user, agent, server, tool, arguments, outcome) to the SIEM.
  • Alert on new servers, changed tool definitions, first use of write tools and unusual volumes.
  • Include MCP in incident response runbooks: how to disable a server, revoke tokens and review recent calls.

The bottom line

MCP is becoming part of the plumbing of software delivery. Treat internal MCP servers as services built through your secure pipeline, third-party servers as governed supply-chain components, and the MCP layer as an opportunity: a place to give agents narrow, audited capabilities instead of the broad credentials developers have traditionally used.

Our application security testing reviews MCP servers and their pipelines, and our DevSecOps team builds internal MCP servers that give agents safe, scoped access to delivery systems.

EthicalHat Research

The EthicalHat research team: penetration testers, SOC analysts and engineers writing about security, software engineering and AI.

Want an expert opinion on your own systems?

Email info@ethicalhat.com or call +1-844-838-4422. Our security engineers are happy to talk it through.