Back to articles
Part 2 - Connecting AI Agents to Microservices with MCP
How-ToSystems

Part 2 - Connecting AI Agents to Microservices with MCP

via Dev.toPedro Santos

Connecting AI Agents to Microservices with MCP (No Custom SDKs) In the previous post , I showed how LangChain4j lets you build agents with a Java interface and a couple of annotations. But those agents were using @Tool , methods defined in the same JVM. Fine for a monolith, but I’m running 5 microservices. I needed the AI agent in service A to call business logic in service B, C, D, and E. Without writing bespoke HTTP clients for each one. That’s where MCP comes in, and it changed how I think about exposing business logic. The Problem: @Tool Doesn’t Scale Across Services In my saga orchestration system, I have: order-service (port 3000): MongoDB, manages orders and events product-validation-service (port 8090): PostgreSQL, validates catalog payment-service (port 8091): PostgreSQL, handles payments and fraud scoring inventory-service (port 8092): PostgreSQL, manages stock orchestrator (port 8050): coordinates the saga via Kafka And then there’s the ai-saga-agent (port 8099), the service

Continue reading on Dev.to

Opens in a new tab

Read Full Article
2 views

Related Articles