From the course: AI-Powered Development: GitHub Copilot in Visual Studio Code

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Query a database with an MCP server

Query a database with an MCP server

There are hundreds of MCP servers available but let's start with a practical one, a server that lets CoPilot query a SQLite database. I'm in this MCP branch and I have a folder called databases and inside that folder are three SQLite databases. The one I'm using in this chapter is tours.sqlite. We'll start simple to see how to do a simple CoPilot prompt. Later we'll step back and talk about where to find MCP servers, how to configure them, and how Visual Studio Code hosts and runs them. For now, assume the MCP server is already installed and is ready to use. The first step is to enable the server in the tools area. So make sure you're in the agent mode and then click here on the tools icon and then up here you'll see a list of the different tools that are available. They're called tools in this area even though we know it's an MCP server. The one I'm using for this demo is dbhub. It is an MCP server that acts as a database gateway that can expose data from PostgreSQL, MySQL, SQLite…

Contents