DEV Community

Cover image for Why AI Won't Replace Your Backend (And How to Integrate It Using MCP & Strands Agents SDK)
Binath Perera
Binath Perera

Posted on

Why AI Won't Replace Your Backend (And How to Integrate It Using MCP & Strands Agents SDK)

The AI era is a huge step above prior technology. But let's clear something up: AI isn't here to replace our existing systems; it's here to complement them.

Why do I say this? because no matter how good the agents become, there are always going to be tasks that are easier and more efficient to do in the traditional way. You know what they say.

Don't buy a Ferrari to drive to the mailbox.

Not every solution needs AI and to the ones that benefit from it, AI works best as an augmentation rather than a wholesale replacement.

That being said, you must also realize that if you do not adapt your systems to be AI consumable, you will be missing out on the Ferrari.

There are several frameworks out there for developing AI agents, but today I want to share with you on how to bridge the gap between traditional apps and AI apps using the Strands Agents SDK by AWS and the Model Context Protocol(MCP).

The Architecture: Connecting Agents to Existing Apps

I'm going to share with you how I developed a inventory operations manager agent to support small business owners.
The application consists of a REACT.js frontend and a SpringBoot backend with functionality served at the '/api' endpoints. For an agent to use this application we need what you call a MCP sever. MCP is a protocol that was introduced by Anthropic to give agents a standardized form to perform efficient operations on systems. The MCP server does not use AI. It is simply a JSON RPC endpoint served at '/mcp' allowing the agent to retrieve the following,

  1. Tools: The specific actions the agent is authorized to execute.
  2. Resources: The context and data that can be retrieved.
  3. Prompts: Guidelines to go with tools and resources.

The Dual-Server Strategy: Reading vs. Writing

When building tools for agent consumption, you quickly realize that creating a custom tool for every possible data request is a bottleneck. If you want the user to be able to access the data and perform analytics on it freely, routing everything through custom application endpoints is inefficient.

Instead, I highly recommend a dual-server approach.

  1. The Database MCP (For Free Exploration & Reads)
    Connect your agent directly to an MCP server provided by your database vendor. I used the MongoDB MCP Server since I stored the data in MongoDB. This equips the agent with all the necessary tools to freely query and explore the data. Crucially, you must provide strict context boundaries to the agent to ensure it only retrieves authorized data(e.g- tenant information, access roles of the user). This ensures flexible analytics without tying you down to hardcoded app tools. The Strands SDK provides methods to easily add context for the agent.

  2. The Application MCP(For Controlled Writes)
    While letting an agent directly query a database is great for read operations, it is incredibly risky for data mutation. For operations that alter data, you must ensure the agent adheres to the business logic already written in you application.

By explicitly instructing the agent to use the Database MCP for exploration and the Application MCP for altering data, you get the best of both worlds: infinite analytical flexibility and ironclad data integrity.

Implementing with the AWS Strands Agents SDK

Writing this all up is surprisingly straightforward using the Strands Agents SDK. The SDK provides everything you need to easily add clients for your MCP servers. You can find my code here

Connecting to Amazon Bedrock models require almost zero configuration. It's just a matter of exposing your AWS credentials(Your access key id and access key secret) in the environment. By default the SDK will seamlessly hook into Anthropic's Claude Sonnet via Bedrock.

And that's it. You have a fully functional AI assistant to support your business activities.

Looking Forward

The evolution of these protocols is happening fast. The rise of WebMCP brings even more functionality to the table, allowing agents to further guide and support users.

AI isn't stripping away our traditional architectures; it's giving us standardized ways to make them infinitely smarter. It is a very exciting future.

Top comments (0)