What is Model Context Protocol (MCP) ?
MCP is an open protocol developed by Anthropic.
Purpose: It is designed to standardize the way applications provide contextual information (like data from files, APIs, or other tools) to Large Language Models (LLMs). Think of it as giving LLMs controlled access to the specific information they need to perform complex tasks accurately.
Analogy: MCP can be compared to a USB-C port for AI applications. Just as USB-C offers a standard connection for various devices and peripherals, MCP provides a standardized interface for connecting AI models to different data sources and tools.
Benefits:
- Aims to unlock more practical AI applications to enhance productivity.
- Enables application vendors to develop "MCP servers".
- Allows users to employ AI applications that consume services and interact with tools provided by these MCP servers.
- In essence, MCP facilitates a standardized communication layer, making it easier for AI models to access and utilize external tools and data sources required for their tasks.
For further details, refer to the official introduction: https://modelcontextprotocol.io/introduction
This protocol has become popular these days as it provides significant values for developers using them in their daily workflow or for GenAI apps.
Basic Components of MCP
The Model Context Protocol relies on two fundamental components:
MCP Server:
- This is the server-side implementation of the protocol.
- It is responsible for exposing relevant tools or data sources.
- The primary purpose of these tools is to provide additional context to the LLM when requested by a client.
Below is the official list of MCP servers available to consume - MCP Servers
MCP Client:
- This is a designated application (like an AI agent or chatbot interface) that interacts with an MCP Server.
- It requests information or tool execution from the server to augment the LLM's context.
- Communication methods between the client and server can be:
- STDIO (Standard Input/Output): For direct process communication.
- SSE (Server-Sent Events): Often used via Web API calls for web-based applications.
Example : Claude Desktop , Amazon Q , VSCode Agent mode
In this post , we will see how to setup Amazon Q Developer and setup one of the MCP servers published by AWS.
Step 1 : Install Amazon Q Developer CLI
Instructions here -Setup
Step 2 : Login to Amazon Q cli
q login
- Then you will be prompted to choose the Licence. For getting started you can choose the Free one.
Then, you will be redirected to Login to AWS Builder account. Please login using the credentials.
Then, allow Q Developer access to the command line as below.
Step 3: Try to interact with Amazon Q Developer on AWS related topics
Type below command to initiate Q developer app.
q chat
Example : Provide best practice to deploy a static website on AWS and services to use
Yeah! it generates the recommendation quite beautifully.
Now let's do some MCP fun
AWS is developing MCP servers to be used relevant to various use cases. List is here
AWS MCP Servers
So, lets load one of them "AWS Documentation MCP Server" , which reads the latest documentation and returns the context to LLM used by Amazon Q.
So below are the things to be done to configure MCP servers for Amazon Q to interact.
Step 1 : Install uv : Fast python package manager built on rust (similar to PIP) **
Step 2 : create mcp.json file and copy Server configuration
Refer to the link AWS Documentation MCP Server
Copy below JSON snippet
{
"mcpServers": {
"awslabs.aws-documentation-mcp-server": {
"command": "uvx",
"args": ["awslabs.aws-documentation-mcp-server@latest"],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR"
},
"disabled": false,
"autoApprove": []
}
}
}
- create mcp.json file in the directory at the path ~/.aws/amazonq/mcp.json
touch ~/.aws/amazonq/mcp.json
then copy the above JSON snippet.
Step 3 : Launch Amazon Q and start fun with MCP
Let's ask a question about AWS service as below.
Suggest me a best service to use in AWS for relational database , this should be with low cost and highly available. Refer to the latest documentation available
It will prompt you to trust all the required tools , you trust them selectively.
You can explore other MCP servers provided by AWS or the wider community to further enhance Amazon Q's capabilities for different tasks.
Hope you got a good idea of what MCP is and how to start using it with Amazon Q Developer. Happy Q'ing!