Secure development

Implementing authenticated and least-privilege MCP services

Bounded actions: agent, tools, gate arranged to illustrate implementing authenticated and least-privilege mcp services.

Implementing authenticated and least-privilege MCP services connects a security requirement to the behaviour of a real feature. The relevant controls need to remain effective across custom code, integrations and the production configuration. Understanding authenticated and least-privilege MCP services helps establish which security property the feature needs and where that property is actually enforced.

What does this involve?

An agent combines a model with tools, identity and the ability to progress through a task. Permissions and approvals need to constrain the actual operations performed, regardless of how convincingly the agent explains its plan.

The Model Context Protocol (MCP), introduced by Anthropic in November 2024, standardizes how AI applications (LLM clients) connect to external tools, data sources, and services. Think of it as a universal interface layer, a "USB-C port for AI", replacing fragmented, custom integrations with a single protocol.

However, MCP introduces a fundamentally new attack surface: AI agents dynamically executing tools based on natural language, with access to sensitive systems. Unlike traditional APIs where developers control every call, MCP lets LLMs decide which tools to invoke, when, and with what parameters. This is creating unique security risks that combine prompt injection, supply chain attacks, and confused deputy problems.

Why it matters

Consider a realistic failure: an MCP tool service accepts a broadly scoped credential and performs an operation outside the current user's permissions.

A broad tool credential can turn an instruction-following failure into access to files, records or business actions. Persistent memory and delegated work can extend the effect beyond the original request or conversation.

Implementation guidance should be applied to a real feature and its deployment. Framework defaults, custom handlers and integrated services all influence whether the intended protection remains effective.

How penetration testers check for it

Trace the relevant feature from its entry point to the data or operation it protects, including custom code and alternate paths.

  • Map tools, identities and delegated capabilities.
  • Compare proposed actions with submitted parameters and effects.
  • Test untrusted inputs and changes to persistent state.
  • Review cancellation, revocation and containment.

How to fix it

Use the appropriate maintained mechanisms and verify the result in the actual production configuration.

  • Data Exfiltration via Legitimate Channels: Attackers use prompt injection to encode sensitive data into seemingly normal tool calls (e.g., search queries, email subjects).
  • Supply Chain Attacks: Untrusted or compromised MCP server packages installed from public registries without review.
  • Use scoped, per-server credentials — never share tokens across servers.
  • Inspect all tool descriptions, parameter names, types, and return schemas before approval.
  • Separate users and trust levels in memory and messaging.
  • Provide independent limits and shutdown mechanisms.

Human approval is useful only when the person can see and verify the consequential operation. A generic confirmation prompt is not a substitute for precise authority and trustworthy action binding.

Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.

Read about our methodology or contact pentested.com to discuss secure development and code review.

See your first test report this week.

Book a 30 minute demo. We will verify one of your targets with you and run a test against it, so you can judge the results on your own systems.

Book a demo