DEV Community

Cover image for MCP Beyond the Basics: Connecting Tools Is Easy. Designing Trust Is Hard.
Rodrigo de Oliveira
Rodrigo de Oliveira

Posted on

MCP Beyond the Basics: Connecting Tools Is Easy. Designing Trust Is Hard.

The Model Context Protocol (MCP) has become an important topic in conversations about AI and software development.

And it's easy to see why.

The idea of connecting language models to external tools, systems, and data sources through a standardized protocol addresses a problem that previously required custom integrations for almost every application.

The first results can be impressive.

With relatively little code, we can build an MCP server, expose a few tools, and allow an AI agent to query a database, read files, or interact with an API.

It feels almost too easy.

But there's a significant difference between making an integration work and designing one that is ready for production.

Once we move beyond local development environments and start dealing with sensitive information, multiple users, permissions, concurrent requests, and availability requirements, the questions become much more interesting.

Who actually authorizes an operation?

What prevents an agent from executing something outside its intended scope?

What happens when a tool fails halfway through a process?

And if an agent makes the wrong decision, how do we investigate what happened?

These are not entirely new problems. In fact, they're quite familiar to anyone who has spent time designing distributed systems.

What's new is the context in which we need to solve them.

MCP simplifies connectivity. It doesn't eliminate architectural responsibility.

And that's where I believe the most interesting discussions should begin.

Understanding MCP's Role in Software Architecture

Before discussing security or scalability, we need to clarify something important.

MCP is not an AI agent.

It's a protocol that standardizes communication between applications using language models and services exposing data or capabilities.

Its architecture revolves around three main components.

The host is the application providing the AI-powered experience. Within that application, clients communicate with MCP servers. The servers, in turn, expose capabilities that applications can use.

These capabilities are primarily organized into tools, resources, and prompts.

Tools make it possible to execute operations, such as retrieving an order or analyzing a document. Resources expose contextual information. Prompts provide reusable templates for specific interactions.

So far, nothing particularly complicated.

But there's a detail worth paying attention to.

In AI-powered applications, the decision to invoke a particular tool may come from a language model interpreting a user's request and the context available to it.

That changes how we think about integrations.

In traditional software, execution paths are generally defined through explicit application logic.

With AI agents, part of the decision-making process may be probabilistic, influenced by prompts, external content, and previous interactions.

The protocol standardizes how tools are discovered and invoked.

It doesn't guarantee that the model will choose the correct tool, understand the user's intention perfectly, or make an appropriate decision.

Those concerns belong to the architecture surrounding the protocol.

MCP Doesn't Replace APIs. And That's a Good Thing.

One question I frequently see in discussions about MCP is whether it represents the next evolution of REST APIs.

I think that's the wrong comparison.

Traditional APIs expose contracts for communication between systems. MCP provides a standardized mechanism for exposing capabilities and context to AI applications.

They serve different purposes, even when they work together.

Imagine a financial platform that already provides an API for retrieving information about a customer agreement.

We could expose that functionality through an MCP tool called get_agreement_status, allowing an AI agent to retrieve the information during a conversation.

Does that mean we should move the business logic into the MCP server?

Not at all.

A reasonable architectural choice would be to preserve business rules, domain validations, and existing integrations within the services that already own those responsibilities.

The MCP server becomes an adapter exposing selected capabilities to AI applications.

This avoids duplicating business logic and reduces the risk of inconsistent behavior across different interfaces.

It also preserves existing investments in authentication, authorization, observability, and API contracts.

A useful way to visualize the relationship is:

AI Application → MCP Server → Application API → Domain Services

This isn't the only possible architecture, of course. Some tools may execute operations directly, and additional components may be required depending on the environment.

The important part is maintaining clear responsibilities.

Introducing AI into an existing system shouldn't become an excuse to abandon established engineering practices.

A Tool's Contract Matters More Than You Think

When designing an API, we usually spend time defining its contract.

We consider operations, parameters, response formats, error handling, and validation rules.

MCP tools deserve the same attention.

But there's an additional complication: a tool's name and description also influence how a language model decides to use it.

Consider a tool named execute_operation.

What exactly does it do?

Now compare it with get_customer_agreement_status.

The second name communicates a much clearer intention.

This distinction isn't merely cosmetic.

Ambiguous descriptions can make tool selection less reliable, particularly when an application exposes multiple tools with overlapping responsibilities.

We should also think carefully about the level of control each tool provides.

Exposing a tool capable of executing arbitrary SQL queries might seem convenient during development.

In a production environment, however, that flexibility creates a much larger attack surface.

In many cases, exposing specific operations with constrained parameters and explicit authorization rules is a better choice.

Responses deserve similar attention.

Returning an entire database record when the agent only needs a status field increases data exposure, context consumption, and unnecessary processing.

Good tool design should favor clear responsibilities, validated inputs, predictable outputs, and well-defined boundaries.

MCP supports structured schemas, including JSON Schema, which helps define these contracts.

But schema validation is only one part of the solution.

A structurally valid request can still represent an unauthorized or logically invalid operation.

Valid JSON doesn't automatically mean valid business behavior.

That's a distinction worth remembering when building tools for increasingly autonomous systems.

Security: Just Because an Agent Can Doesn't Mean It Should

This is probably one of the most important topics when discussing MCP in enterprise environments.

Imagine an agent connected to two tools.

One retrieves customer information. The other updates customer records.

A user asks the agent to retrieve some information.

During the interaction, however, the agent processes content from an external document containing instructions to modify a customer record.

If the application doesn't enforce appropriate boundaries, the agent might attempt an operation the user never intended to authorize.

This is a simplified example of how prompt injection can influence tool usage.

The fundamental issue is treating untrusted content as if it were a legitimate instruction.

A model may interpret instructions found in documents, web pages, or tool responses. That doesn't mean those instructions should have authority over application behavior.

We need to establish clear trust boundaries.

External content should be treated as potentially untrusted data. Authorization decisions must be enforced by reliable application components, not delegated exclusively to a language model.

The official MCP security documentation also discusses risks such as confused deputy attacks, improper token handling, and authorization vulnerabilities.

OAuth-based authorization is an important part of securing protected remote MCP servers, but authentication alone doesn't solve the entire problem.

Knowing who is making a request is different from determining what that identity is allowed to do.

Authorization should consider the operation being requested, the user's permissions, the target resource, and the privileges granted to the client.

Token handling requires particular care.

An MCP server should not blindly forward access tokens to downstream APIs. Each service should validate credentials intended for it, preserving the trust boundaries between components.

And when an operation has significant consequences, such as deleting information, changing account details, or initiating a financial transaction, explicit confirmation may be necessary.

That confirmation should happen through a trusted application mechanism.

An agent can recommend or request an action.

It shouldn't automatically receive the authority to execute it.

AI autonomy should operate within architectural boundaries, not replace them.

Moving From Local Development to Production

Many introductory MCP examples use the stdio transport, where clients and servers communicate through a local process's standard input and output streams.

It's a practical choice for development tools and local integrations.

But things become more interesting when MCP servers need to support multiple users over a network.

Now we need to consider scalability, load balancing, availability, latency, and resource management.

Streamable HTTP provides a transport mechanism for remote communication.

The MCP 2026-07-28 specification introduced an important architectural change: the protocol core became stateless, with self-contained requests rather than protocol sessions maintained across calls.

This makes it easier to distribute requests across server instances using conventional HTTP infrastructure.

However, there's an important distinction here.

A stateless protocol doesn't mean the application itself must be stateless.

Imagine a tool that starts analyzing a large collection of documents.

The analysis might take several minutes.

We still need a way to identify the execution, retrieve its progress, handle cancellation, and eventually access the results.

Application-level state may still be necessary.

Instead of relying on protocol sessions, we can explicitly represent this state through execution identifiers and appropriate persistence mechanisms.

The MCP Tasks extension also provides capabilities for managing long-running operations, although implementations need to support the extension explicitly.

Another concern is compatibility.

Clients and servers won't necessarily adopt new protocol revisions simultaneously.

A production architecture must account for the versions and capabilities actually supported by its components.

And none of these protocol improvements eliminate the traditional challenges of distributed systems.

Requests can time out.

Network connections can fail.

Clients may retry operations.

If a tool performs an action with side effects, we still need to think about idempotency, retries, and protection against duplicate execution.

These concerns existed long before MCP.

They're simply becoming relevant to another category of applications.

Observability: Understanding What Actually Happened

Let's consider a practical scenario.

A developer asks an AI agent to evaluate the architectural impact of a proposed change.

The agent retrieves architecture decision records, queries service dependencies, examines repository information, and invokes an analysis tool.

Eventually, it produces an incorrect recommendation.

Where do we start investigating?

Without proper observability, we might not even know which tools were invoked.

In traditional distributed systems, we rely on logs, metrics, and distributed tracing to understand application behavior.

With AI agents, that foundation remains essential.

But technical execution isn't the whole picture.

A tool can execute successfully and still have been selected for the wrong reason.

An HTTP response returning 200 OK tells us that the request succeeded at the protocol level.

It doesn't tell us whether the model should have made that request in the first place.

That's why observing agent-based systems requires looking at both technical execution and application behavior.

We should be able to correlate requests across the AI application, MCP client, MCP server, and downstream services.

OpenTelemetry can help establish that correlation.

The 2026 MCP specification also documents W3C Trace Context propagation, making distributed tracing more consistent across participating components.

Useful indicators might include tool invocation frequency, execution latency, error rates, authorization failures, retries, and resource consumption.

Cost is another important consideration.

A seemingly simple user interaction may trigger several tool calls, additional model executions, and repeated retrieval operations.

Individually, these requests might appear inexpensive.

At scale, they can become significant.

Of course, observability introduces its own security considerations.

Logging complete prompts, responses, access tokens, or sensitive business data without appropriate controls can create new vulnerabilities.

The objective isn't to record everything.

It's to collect enough reliable information to diagnose failures, investigate behavior, and support auditing without exposing unnecessary data.

Governance: Who Controls What AI Agents Can Access?

As organizations adopt MCP, another challenge starts to emerge.

Who decides which tools should be available?

Who reviews a new integration?

What happens when a tool's behavior changes?

And how do we prevent an organization from accumulating dozens of poorly documented MCP servers with overlapping responsibilities?

These are governance questions.

A practical approach might include an approved catalog of MCP servers and tools, with defined ownership, access policies, versioning practices, and security requirements.

Continuous integration pipelines can help validate schemas, test contracts, identify vulnerable dependencies, and detect potentially breaking changes.

In larger environments, gateways or intermediary services may centralize concerns such as routing, authentication, rate limiting, and telemetry.

But centralized infrastructure shouldn't become a substitute for authorization within the services that own business operations.

There's also a connection worth exploring between MCP and architectural decision-making.

Imagine an organization has an Architecture Decision Record stating that certain categories of customer data must never be sent to external AI providers.

That decision shouldn't exist only as documentation.

Whenever possible, it should influence the implementation through enforceable policies, approved tools, data filtering, and automated validation.

This is where architecture governance becomes operational.

Instead of relying exclusively on developers remembering every documented decision, we create mechanisms that help keep the system aligned with its intended architecture.

The goal isn't to make governance more bureaucratic.

It's to make important architectural constraints easier to understand, verify, and maintain.

A Practical Example: Architectural Impact Analysis

Let's bring several of these ideas together.

Imagine a development team maintaining Architecture Decision Records (ADRs), architecture diagrams, and service dependency information.

The team wants an AI agent to help evaluate the potential impact of proposed architectural changes.

An initial implementation could expose a single MCP tool that receives a change description and returns an analysis.

That might work as a proof of concept.

But we can design something more reliable.

We could separate responsibilities into tools that retrieve relevant ADRs, identify dependencies, and perform a structured impact assessment.

The agent would use those capabilities to gather evidence and construct a recommendation.

The final result could identify affected components, relevant architectural decisions, potential risks, and areas requiring human validation.

Notice what we're not doing.

We're not giving the agent unrestricted authority to modify architectural decisions.

We're allowing it to support the analysis process.

If we later decide to support the creation of new ADR proposals, we could introduce a separate tool with its own authorization requirements and audit trail.

Approving an architectural decision could remain part of the organization's established governance process.

This separation matters because different operations carry different levels of risk.

Reading an ADR is not equivalent to modifying one.

Generating a recommendation is not equivalent to approving it.

And identifying architectural drift is not the same as automatically changing production code to resolve it.

A well-designed MCP integration makes those distinctions explicit.

We don't have to choose between AI autonomy and architectural control.

We can design systems that benefit from AI capabilities while preserving clear accountability.

When MCP Isn't the Right Choice

One of the responsibilities of a software architect is recognizing when a technology isn't necessary.

And MCP is no exception.

If two backend services need to exchange information through a deterministic integration with well-defined contracts, traditional APIs or asynchronous messaging may already be the most appropriate solution.

Introducing MCP into that interaction might add complexity without providing meaningful benefits.

Similarly, we shouldn't expose every internal operation as an MCP tool just because we can.

Every additional capability introduces maintenance requirements, security considerations, and governance responsibilities.

The right question isn't whether a feature can be implemented using MCP.

It's whether MCP provides value for the problem we're trying to solve.

Architecture is about making deliberate trade-offs.

And sometimes the best decision is to avoid introducing another abstraction.

Final Thoughts: The Protocol Simplifies Integration, Not Responsibility

MCP represents an important step forward for AI-powered software.

By standardizing how applications expose tools, resources, and contextual information, it reduces integration friction and enables new possibilities for automation and intelligent workflows.

That's genuinely valuable.

But making an integration easy to implement doesn't automatically make it production-ready.

Security, contracts, authorization, observability, reliability, and governance remain essential.

In fact, the more autonomy we give AI agents, the more important those architectural foundations become.

And perhaps that's the most important point I'd like to leave you with.

The challenge isn't simply enabling AI agents to do more. It's designing systems where we can understand, control, and trust what they're allowed to do.

Regardless of the technology involved, that's still one of the fundamental responsibilities of software architecture.

Further Reading and Learning Resources

If you'd like to explore MCP beyond introductory tutorials, these are some resources worth studying:

Top comments (0)