Skip to main content
Glama
sganapa

Agentic MCP Microservices

by sganapa

Enterprise BAU Services with MCP and Gemini

An executable proof of concept showing how an AI agent can work with existing Business-as-Usual (BAU) REST microservices through the Model Context Protocol (MCP).

The demonstration uses Google Gemini to discover MCP tools, retrieve customer and order information, and perform a controlled order-cancellation action. The BAU services remain independent REST APIs; MCP provides the integration boundary between those APIs and the agent.

Demonstration

The included scenario asks the agent to:

  1. Retrieve the profile for CUST-1001.

  2. List the customer's orders.

  3. Identify the order in Processing status.

  4. Cancel ORD-9002 with a supplied reason.

  5. Summarize the completed work.

The expected tool sequence is:

Gemini agent
    -> MCP tool discovery over stdio
    -> MCP server
    -> Customer and Order REST APIs
    -> Tool results returned to Gemini
    -> Final user-facing summary

Related MCP server: MCP API Tool Demo

Architecture

+------------------+       stdio        +------------------+       HTTP       +----------------------+
| Gemini agent     | <----------------> | MCP server       | <--------------> | Customer service     |
| agent_runner.py  |                    | server.py        |                  | localhost:8001       |
+------------------+                    +--------+---------+                  +----------------------+
                                                   |
                                                   | HTTP
                                                   v
                                         +----------------------+
                                         | Order service        |
                                         | localhost:8002       |
                                         +----------------------+

MCP tools

Tool

Purpose

get_customer_profile

Retrieves customer profile, tier, status, and credit limit.

get_customer_orders

Lists orders associated with a customer.

cancel_order_by_id

Cancels an order when its status allows cancellation.

Project structure

.
├── agent/
│   └── agent_runner.py          # Gemini agent and MCP client
├── mcp_server/
│   └── server.py                # MCP tools and REST integration
├── services/
│   ├── customer_service.py      # Mock customer REST API
│   └── order_service.py         # Mock order REST API
├── tests/
│   └── test_services.py         # Service behavior tests
├── .env.example                 # Environment variable template
├── requirements.txt             # Python dependencies
└── mcp_microservices_poc_blueprint.md
                                # Detailed design and implementation reference

Prerequisites

  • Python 3.11 or newer

  • A Gemini API key from Google AI Studio

  • Windows PowerShell, macOS/Linux shell, or an equivalent terminal

  • Network access to the Gemini API when running the agent

This project does not require an Anthropic or OpenAI API key.

Quick start on Windows

Open PowerShell in the project directory:

python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
Copy-Item .env.example .env

Open .env and replace your_gemini_api_key_here with your key:

GOOGLE_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-3.6-flash

Never commit .env or place an API key in source code. The selected model must be available to your Gemini account.

Run the demonstration

Use three terminals. Activate .venv in each terminal.

Terminal 1: customer service

python services/customer_service.py

Runs at http://localhost:8001.

Terminal 2: order service

python services/order_service.py

Runs at http://localhost:8002.

Terminal 3: Gemini agent

python agent/agent_runner.py

The agent starts the MCP server as a child process, discovers its tools, and executes the sample workflow.

Verify the local services

Run these commands while the two services are active:

Invoke-RestMethod http://localhost:8001/health
Invoke-RestMethod http://localhost:8002/health
Invoke-RestMethod http://localhost:8001/api/v1/customers/CUST-1001
Invoke-RestMethod http://localhost:8002/api/v1/orders/customer/CUST-1001

Run the tests

With the virtual environment active:

python -m pytest -q

The tests cover case-insensitive customer lookup, missing customers, cancellation of a processing order, and protection against cancelling a shipped order.

Configuration

Variable

Description

Default

GOOGLE_API_KEY

Gemini authentication key.

Required

GEMINI_MODEL

Gemini model used by the agent.

gemini-3.6-flash

CUSTOMER_SERVICE_URL

Customer service base URL.

http://localhost:8001

ORDER_SERVICE_URL

Order service base URL.

http://localhost:8002

Scope and limitations

This is a local, intentionally small POC intended to make the integration pattern easy to inspect and run.

  • Customer and order records are stored in memory and reset when services restart.

  • The services do not implement authentication or authorization.

  • The cancellation operation should be protected by approval and business policy controls in a real system.

  • MCP uses stdio for local process integration. A deployed architecture should use an authenticated network transport.

  • Downstream errors are returned as tool text for visibility; production systems should use structured errors, retries, tracing, and metrics.

  • The sample agent makes a real Gemini API request and requires a valid key.

Troubleshooting

GOOGLE_API_KEY is not set

Confirm that .env exists in the project directory and contains a valid key. Run the agent from the project directory.

404 NOT_FOUND for a Gemini model

Set GEMINI_MODEL in .env to a model enabled for your account. The default in this POC is gemini-3.6-flash.

MCP startup or tool discovery fails

Confirm that dependencies were installed into the active virtual environment:

python -m pip install -r requirements.txt

The project pins MCP to the 1.x API range because the server implementation uses FastMCP.

Connection errors from MCP tools

Confirm both REST services are running on ports 8001 and 8002. If a port is already in use, update the service port and the matching URL in .env.

Further reading

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    B
    maintenance
    MCP server that enables AI platforms to search products, customers, and warehouses, and prepare and submit sales orders to a fixed ERP endpoint with per-session bearer authentication.

View all related MCP servers

Related MCP Connectors

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

  • MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sganapa/agentic-mcp-microservices'

If you have feedback or need assistance with the MCP directory API, please join our Discord server