Learn how to set up and use MCP servers with GitHub Copilot CLI on Windows, Linux, or Mac. This guide includes configuring Context 7 API, integrating AI documentation, and generating architecture diagrams for Next.js projects.
On this tutorial, we’ll going to walk you through how to use the GitHub Copilot CLI on Windows, Linux (via WSL), or a Mac. The goal is to set up an MCP server, which stands for Model Context Protocol. Think of it as a universal connector for AI tools, similar to how USB ports work for hardware. MCP allows you to plug in various AI services, like an orchestrator for Aspire, documentation access for Microsoft Learn, or browser automation with Playwright. There are countless MCP servers available, but one of my favorites is Context 7, a platform that aggregates up-to-date documentation for AI tools.
In this example, I’m working on the administrative backend of a podcast dashboard built with Next.js. To make sure Copilot has access to the latest Next.js documentation, I’ll integrate Context 7 into the workflow. Here’s how you do it: First, open the GitHub Copilot CLI and type the slash command `/mcp` to see the list of configured servers. To add a new server, use the command `mcp add` and name it `context7`. When prompted, select HTTP as the server type. Next, paste the remote server URL from Context 7’s documentation. For authentication, you’ll need to provide your API key as a header in JSON format. It should look something like `{“Authorization”: “Bearer YOUR_API_KEY”}`. Replace `YOUR_API_KEY` with your actual key from Context 7. Save the configuration, and the server will be ready to use immediately—no restarts required.
Once Context 7 is configured, you can use it to fetch documentation, resolve dependencies, or even generate architecture diagrams. For example, if you’re working on a Next.js project, you can ask Copilot to create a visual diagram of the application’s structure. It’ll analyze your code, check the available tools, and map out the data flow, middleware, and libraries. This is especially useful for projects like my speech-to-text app, Handy, which sometimes struggles with speech impediments. The diagram will show the integration of TypeScript, JavaScript, and other tools in real time.
Another cool feature is sharing these diagrams. Using the `/share` command in Copilot, you can export the architecture as a Gist and share it with your team. This works seamlessly with MCP servers like Context 7, which can be added, removed, or toggled on/off without disrupting your workflow. Some servers might be local, while others are hosted remotely, but the CLI handles them all with ease.
If you’re new to GitHub Copilot CLI, this process is straightforward. You can either configure servers directly from the command line or manually edit the `mcp.config.json` file. Just make sure your API keys and server URLs are correctly formatted. For advanced users, Context 7’s dashboard offers additional customization options, like filtering specific documentation sources or prioritizing certain libraries.
In summary, setting up MCP servers with GitHub Copilot CLI is a powerful way to streamline AI development. Whether you’re working on a Next.js project, automating documentation access, or creating visual diagrams, tools like Context 7 make the process efficient and intuitive. Give it a try and see how it enhances your workflow. Thanks for watching, and don’t forget to check out the official GitHub Copilot documentation at copilot.github.com for more details.
