MCP_Project

MCP_Project

0

This project provides an implementation of an MCP server in Python to enhance AI systems like GitHub Copilot Labs. It facilitates the use of tools, resources, and prompts to improve context awareness in AI agents. The project is geared towards developers looking to integrate context protocol capabilities into AI-driven applications.

MCP Project: Using MCP Server to Enhance AI Context Window

This project demonstrates how to implement an MCP (Model Context Protocol) server in Python using tools, prompts, and resources to enrich the context window of an AI agent like GitHub Copilot Labs.


🧠 What Is This?

A fully working MCP backend that:

  • βœ… Exposes tools (live API functions)
  • βœ… Serves resources (structured memory like user profiles)
  • βœ… Provides prompts (templates to shape agent behavior)

Designed to integrate directly with GitHub Copilot Labs or any MCP-compatible client.

What you have to know

This figure is a simplified version of the MCP architecture.

Example Tool

πŸ” Workflow Overview

  1. Define your tools, prompts, and resources in server.py.
  2. Start the MCP server.
  3. Launch VSCode with Copilot Labs and connect to your server using mcp.json.
  4. Use tools/resources/prompts right inside your chat agent.

πŸ› οΈ Tools

Tools are dynamic APIs that can be called from within the agent.

Example Tool


πŸ“¦ Resources

Resources provide context like profiles, docs, knowledge snippets.

Example Resource


✨ Prompts

Prompts are templates used by the agent to condition its behavior.

Example Prompt


πŸš€ Setup & Running

1. Clone and install dependencies

git clone https://github.com/YOUR_USERNAME/MCP_Project.git
cd MCP_Project
python3 -m venv venv_fahmi
source venv_fahmi/bin/activate
pip install mcp textblob requests
python -m textblob.download_corpora

2. Run your MCP server

python server.py

You should see a message like:

MCP server is running at http://127.0.0.1:6274

πŸ§ͺ Testing in GitHub Copilot (VSCode)

1. Install Copilot Labs Extension

2. Add an MCP config in VSCode

Create .vscode/mcp.json with the following content:

{
  "servers": {
    "my-mcp-server": {
      "type": "stdio",
      "command": "python3",
      "args": [
        "/Users/your_username/Desktop/MCP_Workspace/MCP_Project/server.py"
      ]
    }
  }
}

βœ… Make sure the path is correct to your server.py.

3. Start MCP Server

From terminal:

source venv_fahmi/bin/activate
python server.py

You should see logs confirming the server is active.


🧠 Example Use Cases

  • Ask the agent: β€œUse the sentiment_analysis_api tool to check if the text β€˜I’m so excited to code’ is positive.”

  • Or test the job board fetch: β€œUse the access_job_board_api to get the latest jobs.”


πŸ“ Project Structure

MCP_Workspace/
β”œβ”€β”€ MCP_Project/
β”‚   β”œβ”€β”€ image/
β”‚   β”‚   β”œβ”€β”€ example-tool.png
β”‚   β”‚   β”œβ”€β”€ example-resource.png
β”‚   β”‚   └── example-prompt.png
β”‚   β”œβ”€β”€ server.py
β”œβ”€β”€ .vscode/
β”‚   └── mcp.json
β”œβ”€β”€ venv_fahmi/
└── README.md

πŸ”— References