Q Developer CLI: Enhanced with Model Context Protocol

Introduction to Model Context Protocol (MCP) for Amazon Q Developer CLI

The software development world is constantly changing. Developers are always looking for tools that can make their work easier and give them new abilities. In this fast-paced environment, Amazon Web Services (AWS) has made a big improvement to its Amazon Q Developer tool. This improvement is called Model Context Protocol (MCP) support in the command line interface (CLI). This new feature lets developers connect different data sources to the Amazon Q Developer CLI. This makes the tool more aware of the context and able to give smarter responses.

By easily adding MCP tools and prompts to the Q Developer CLI, developers can use a wide range of pre-built integrations and MCP Servers that support stdio. This extra context helps Q Developer create better code, understand complex data structures, make useful unit tests, write detailed database documentation, and run accurate queries. All of this can be done without the need to create custom integration code. By using MCP tools and prompts with Q Developer, developers can speed up their tasks and have a much better experience overall. AWS is dedicated to supporting open-source protocols for agents, like the Model Context Protocol (MCP) that Anthropic supports. This commitment can be seen in the continuous improvements to the Amazon Q Developer IDE plugins.

In the ever-changing world of software development, tools and technologies that make workflows smoother and unlock new possibilities are highly valued. The recent addition of Model Context Protocol (MCP) support to the Amazon Q Developer command line interface (CLI) is a development that shows a lot of promise. MCP is an open protocol that sets a standard for how applications can easily work with Large Language Models (LLMs). It provides a common way to share context, access different data sources, and enable powerful AI-driven features. MCP acts like a bridge between applications and LLMs, allowing them to communicate and work together effectively. It lets applications give LLMs the context they need to do tasks accurately and efficiently. It also allows LLMs to access and use data from various sources.

MCP builds on the existing capabilities of Q Developer, which already has the ability to use tools. Before, Q Developer could do things like run CLI commands and describe AWS resources. With the addition of MCP tools and prompts, the Q Developer CLI can now incorporate even more tools, expanding its capabilities further. For example, Q Developer could previously describe AWS resources, but the ability to describe database schemas and message formats is essential for building comprehensive applications. By configuring MCP, developers can provide this additional context to Q Developer, enabling it to perform tasks more effectively.

In the following sections, we will explore how to configure an MCP server to provide Q Developer with the database schema for a simple Learning Management System (LMS) that is currently under development. While Q Developer excels at writing SQL queries, it lacks inherent knowledge of the database schema. The table structure and relationships are stored within the database itself and are not directly accessible within the source code of the project. To address this limitation, we will employ an MCP server capable of querying the database schema. Specifically, we will leverage the official PostgreSQL reference implementation to connect to an Amazon Relational Database Service (RDS) instance. We will see how this integration significantly enhances Q Developer’s ability to understand and interact with our database.

The Limitations Before Model Context Protocol

Before MCP support was added, the Q Developer CLI had a limited set of built-in tools. It could run bash commands, work with files and the file system, and make calls to AWS services. However, when it came to querying databases, its abilities were limited. It lacked the contextual awareness necessary to generate highly specific and accurate queries.

For example, before configuring the MCP server, a request was made to Q Developer to “Write a query that lists the students and the number of credits each student is taking.” In this situation, Q Developer could only provide a general SQL query because it didn’t have specific knowledge of the database schema for the LMS. It could generate the syntax for a SQL query, but the query would be completely non-functional because it didn’t know what tables and columns existed in the database.