Real world MCPs in GitHub Copilot Agent Mode — Jon Peck, Microsoft

AI EngineerAbout 4 min readJul 19, 2025Watch original
THE SUMMARYAI-generated

Key Concepts

  • Co-pilot: AI development capabilities integrated into the IDE.
  • Agent Mode: Co-pilot executing complete tasks with deep interaction and permissions.
  • Model Context Protocol (MCP): An open protocol/API for AI, enabling LLMs to connect to external data sources.
  • VS Code: The IDE used in the demonstration.
  • GitHub MCP Server: An MCP server provided by GitHub for interacting with GitHub features.
  • Copilot Instructions: A specially named file (.github/copilot-instructions.md) for pre-injecting instructions into every prompt.

Co-pilot's Evolution: From Code Completion to Agent Mode

The presentation outlines the evolution of Co-pilot from basic code completion to a more advanced "Agent Mode."

  • Code Completion: Micro-level suggestions as you type.
  • Chat: One-hop interactions with complex prompts for file generation or modification.
  • Agent Mode: Complete task execution with deep interaction, allowing Co-pilot to build entire applications or perform complex refactoring.

Agent Mode in Action: Building an Application from a Readme

Agent Mode is demonstrated by building an application from a detailed readme file.

  • The readme includes project structure, environment variable configuration, database schema, API endpoints, and workflow graphs (even as images, leveraging LLM vision capabilities).
  • The user switches Co-pilot to Agent Mode, selects a model, and instructs it to "implement this."
  • Co-pilot builds data models, generates the app.py file, and starts working on the front end.
  • The user grants permissions for terminal interactions when prompted.
  • The result is a basic working application (e.g., a travel reservation system) in approximately 8 minutes.

Model Context Protocol (MCP): Connecting Co-pilot to External Data

MCP is introduced as a way to connect LLMs to external data sources, enhancing Co-pilot's capabilities.

  • MCP is described as an "API for AI."
  • MCP servers can be local (connecting to databases) or remote (accessed via protocols like SSE).
  • The presenter emphasizes that they will not be going through every MCP server due to the sheer number of them.
  • A list of MCP servers can be found at github.com/modelcontextprotocol/servers.
  • The IDE (VS Code) is configured to use specific MCPs.
  • Co-pilot selects the appropriate MCP based on the task.

Using MCP with Postgress: Generating Mock Data for Tests

A practical example demonstrates using the Postgress MCP to generate mock data for testing.

  • The user identifies the need for mock data from a Postgress database.
  • They find and install the Postgress MCP from the GitHub repository, utilizing VS Code's one-click configuration.
  • The user configures the connection string in the settings JSON (including authentication details for remote databases).
  • The local MCP server is started.
  • The user instructs Co-pilot to "use the Postgress MCP to pull the data and then make a mock.json."
  • Co-pilot requests permission to connect to the database.
  • The Postgress MCP operates in read-only mode for safety.
  • Co-pilot generates the mock.json file and proceeds with building tests.

MCP Workflow: A Step-by-Step Breakdown

The process of using MCP is detailed:

  1. The user provides a prompt to Co-pilot.
  2. Co-pilot parses the prompt and identifies the need for an MCP.
  3. Co-pilot requests permission from the user to connect.
  4. Co-pilot calls the MCP server.
  5. The MCP server interrogates the database (e.g., getting the schema, selecting tables, pulling data).
  6. Co-pilot parses the responses and generates output (e.g., creating files).
  7. The process is iterative, requiring multiple prompts to achieve the desired result.

GitHub MCP Server: Automating GitHub Tasks

The GitHub MCP server is presented as a way to automate tasks typically done through the GitHub command line or website.

  • The user adds the GitHub MCP to VS Code and configures it with a personal access token for account-specific access.
  • The user highlights the use of "copilot instructions" (a file named .github/copilot-instructions.md) to pre-inject instructions into every prompt.
  • An example instruction is to "include a change log of everything you've done."
  • The user instructs Co-pilot to "use the GitHub MCP to commit all of these changes to a new branch and make a PR."
  • Co-pilot requests permission to connect and then creates the branch and PR.

Assign Issue to Copilot

  • Assigning issues to copilot is more of an enterprise thing because of the way that it does work autonomously and then you can hand it off and have other developers of fugit sort of team-like interaction.
  • MCP is available there as well and you can configure that in your repo settings under the copilot subset and dump in your co your MCP configs there.

Conclusion

The presentation demonstrates the power of Co-pilot, especially when combined with Agent Mode and MCPs. Agent Mode allows for the automation of complex development tasks, while MCPs enable Co-pilot to access and utilize external data sources. The GitHub MCP server further streamlines the development workflow by automating GitHub-related tasks. The use of copilot instructions is highlighted as a best practice for ensuring consistency and incorporating desired behaviors into every prompt.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.