Building and Using MCP Servers in Amazon Q CLI

What is an MCP server? Even if you know that MCP stands for Model Context Protocol, that's no that obvious to understand or see the benefits, at least for me. And, I think the best way to figure this out is to build one, so I started to build the simplest MCP server possible and play with it. After that, I used an existing open source MCP server to understand more. And I wanted to share that experience here. 1) The simplest MCP Server I could ask Amazon Q (or an LLM like Anthropic Claude) to build the simplest MCP server for me, but I didn't get satisfying answers. It was not relevant or too complex already, so I looked for some examples with a web search engine, and I cherry picked some ideas. 1.1) Using FastMCP v2 to create the simplest MCP server I discovered that there was a python library that could handle this protocol: FastMCP v2. Little refresher: a protocol is a set of rules defining how data must be formatted, transmitted, received between systems. In our case how the coding assistant based on LLM (e.g. Q Developer) must communicate with the server and how the server should answer it. FastMCP can be compared to flask for python or express for node. And like flask or express will handle an HTTP request (containing http method, content type, ...) between a web browser and a remote resources like web pages, FastMCP will handle the communication between the LLM and the server tools like python functions. After a little exploration, I took that simple example, that we can find in the FastMCP documentation # server.py from fastmcp import FastMCP mcp = FastMCP("Demo

May 4, 2025 - 18:41
 0
Building and Using MCP Servers in Amazon Q CLI

What is an MCP server? Even if you know that MCP stands for Model Context Protocol, that's no that obvious to understand or see the benefits, at least for me.

And, I think the best way to figure this out is to build one, so I started to build the simplest MCP server possible and play with it. After that, I used an existing open source MCP server to understand more. And I wanted to share that experience here.

1) The simplest MCP Server

I could ask Amazon Q (or an LLM like Anthropic Claude) to build the simplest MCP server for me, but I didn't get satisfying answers. It was not relevant or too complex already, so I looked for some examples with a web search engine, and I cherry picked some ideas.

1.1) Using FastMCP v2 to create the simplest MCP server

I discovered that there was a python library that could handle this protocol: FastMCP v2.

Little refresher: a protocol is a set of rules defining how data must be formatted, transmitted, received between systems. In our case how the coding assistant based on LLM (e.g. Q Developer) must communicate with the server and how the server should answer it.

FastMCP can be compared to flask for python or express for node. And like flask or express will handle an HTTP request (containing http method, content type, ...) between a web browser and a remote resources like web pages, FastMCP will handle the communication between the LLM and the server tools like python functions.

After a little exploration, I took that simple example, that we can find in the FastMCP documentation

# server.py
from fastmcp import FastMCP

mcp = FastMCP("Demo