CC

codenjoyme/copilot-mcp-langchain

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

5 stars 6 forks 品質 47 トレンド 13

This project demonstrates how to extend GitHub Copilot capabilities using Python, Langchain, and the Model Context Protocol (MCP), allowing for more deterministic and powerful interactions with the...

概要

This project demonstrates how to extend GitHub Copilot capabilities using Python, Langchain, and the Model Context Protocol (MCP), allowing for more deterministic and powerful interactions with the LLM. As a GitHub Copilot trainer, I've observed its impressive evolution. However, I've always wanted to access GitHub Copilot's internals to build more complex transformation chains. This project shows how to achieve that goal by leveraging MCP (Model Context Protocol) and Langchain. While GitHub Copilot repository custom instructions feature improved customization options, the introduction of the MCP protocol opened new possibilities for extending Copilot's functionality through custom MCP servers. Instruction files are not always deterministic - they need to be fine-tuned when new LLM versions are released to reduce hallucinations. LLMs often struggle with precise text manipulations, sometimes creatively reinterpreting tasks and adding unwanted artifacts.

README

以下は原文 README の抜粋です。原文を見る。

Extending GitHub Copilot with Python and Langchain via MCP

This project demonstrates how to extend GitHub Copilot capabilities using Python, Langchain, and the Model Context Protocol (MCP), allowing for more deterministic and powerful interactions with the LLM.

Project Overview

As a GitHub Copilot trainer, I’ve observed its impressive evolution. However, I’ve always wanted to access GitHub Copilot’s internals to build more complex transformation chains. This project shows how to achieve that goal by leveraging MCP (Model Context Protocol) and Langchain.

While GitHub Copilot repository custom instructions feature improved customization options, the introduction of the MCP protocol opened new possibilities for extending Copilot’s functionality through custom MCP servers.

The Problem

Instruction files are not always deterministic - they need to be fine-tuned when new LLM versions are released to reduce hallucinations. LLMs often struggle with precise text manipulations, sometimes creatively reinterpreting tasks and adding unwanted artifacts. What we need is a way to inject deterministic logic into our instructions.

The Solution

This project demonstrates a solution through:

  1. Python scripts installed on the local machine.
  2. Custom MCP server configuration through .vscode/mcp.json
  3. Custom tools defined in the mcp_server/tools directory

With this setup, GitHub Copilot gains access to new, well-documented tools that it can see as part of your project. When you ask Copilot to “create a tool that does X”, it can generate a solution very close to what you need. You simply accept its changes and restart MCP to get a new deterministic tool for your specific logic.

Data Security

⚠️ Important: Please review the Security Disclaimer before using this tool in production environments.

This document outlines potential data leak scenarios and provides guidance on risk mitigation when working with this tool.

Key Components

  • Simple Examples (mcp_server/simple/): Demonstrates integration with different LLM providers and key LangChain concepts

    • query_openai.py - OpenAI integration
    • query_azure.py - Azure OpenAI integration
    • prompt_template.py - Prompt template management and usage
    • rag.py - Retrieval-Augmented Generation (RAG) with vector search
    • agent.py - AI Agent with specialized tools (character counting, MD5 hashing, regex matching)
    • structured_output.py - Structured data extraction in multiple formats (JSON, YAML, Markdown)
    • chain_of_thought.py - Step-by-step problem solving with transparent reasoning
    • color.py - Helper module for colored terminal output
  • MCP Implementation:

GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →