{"id":"9cef45c4-4c56-44b3-8707-d1dad9b0016f","slug":"greencomputing-tp4","kind":"mcp","name":"GreenComputing-TP4","summary":"Model Context Protocol (MCP) with Claude Desktop, FastMCP and CodeCarbon","owner":"gauravchugh2006","repoUrl":"https://github.com/gauravchugh2006/GreenComputing_TP4","license":"GPL-3.0","licenseTier":"strong-copyleft","trust":"community","stars":0,"match":null,"fewStars":true,"format":"mcp","createdAt":"2025-10-31T10:43:13.000Z","addedAt":"2026-10-21T19:58:11.105Z","logoUrl":"https://avatars.githubusercontent.com/u/12575505?u=b7659f4733942389e7af3b8daf8e2210ea1a4879&v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["memory-knowledge"],"tags":[],"runtime":"binary","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-24T03:59:04.557Z","sample":false,"url":"https://conduits.dev/tools/greencomputing-tp4","language":"Python","transports":["stdio"],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# GreenComputing_TP4\nModel Context Protocol (MCP) with Claude Desktop, FastMCP and CodeCarbon\n# 🚀 AI & Data Pipeline Sustainability Benchmark\n\nThis project is a detailed benchmark study comparing the **Cost, Energy Consumption, and Performance** of Large Language Models (LLMs) with the sustainability and efficiency of different data pipeline technologies (File Formats and Processing Frameworks). All energy and CO2 emissions are measured using the **CodeCarbon** library.\n\n---\n\n## 1. LLM Performance and Cost Analysis (TP1: Compar'IA)\n\nThe goal of this phase is to evaluate LLMs of varying sizes across a range of tasks, focusing on the trade-off between output quality and operational cost (time, energy, and money).\n\n### 1.1. Models Benchmarked\n\n| Size Category | Models Tested (6 total) |\n| :--- | :--- |\n| **Small** | [cite_start]Meta LLaMA 3.1 8B, Gemma 8B [cite: 5] |\n| **Medium** | [cite_start]Mistral Small, GPT-OSS 20B [cite: 6] |\n| **Large** | [cite_start]GPT-5, DeepSeek R1 [cite: 7] |\n\n### 1.2. Tasks Covered (30 Prompts)\nTasks are categorized by complexity:\n* [cite_start]**Easy Factual & Rewriting:** (1-10) [cite: 31]\n* [cite_start]**Reasoning & Quantitative:** (11-15) (e.g., math problems, conversions) [cite: 42, 43, 47]\n* [cite_start]**Programming & Debugging:** (16-20) (e.g., Python code, Big-O complexity) [cite: 48, 49, 53]\n* [cite_start]**Harder Knowledge & Reasoning:** (21-25) (e.g., complex comparisons, explaining architecture) [cite: 54, 55, 58]\n* [cite_start]**Advanced/Creative & Multi-step:** (26-30) (e.g., project planning, drafting legal disclaimers) [cite: 60, 61, 63]\n\n### 1.3. Deliverables for TP1\n* [cite_start]**Spreadsheet:** Contains all collected metrics (Quality, Latency, Energy, CO2, Cost) for all 6 models across 30 tasks[cite: 68].\n* **Dashboard Visualisations:**\n    * [cite_start]`Quality vs Energy` graph[cite: 70].\n    * [cite_start]`Quality vs Cost` graph[cite: 71].\n    * [cite_start]`Latency vs Model size` comparison[cite: 72].\n    * [cite_start]Final `best trade-off` ranking table[cite: 73].\n* [cite_start]**Slide Deck:** 2-3 slides summarizing key findings and recommending which model is best for specific use-cases[cite: 74].\n\n---\n\n## 2. Data Pipeline Efficiency Benchmark\n\n[cite_start]This phase compares different frameworks and file formats for data processing, measuring runtime and emissions for an identical pipeline (merging books and reviews data [cite: 227, 235, 250]).\n\n### 2.1. Framework Comparison (TP2: Pandas vs. PySpark)\n[cite_start]We compare two pipelines performing identical steps (Load, Clean, Join, Compute Metrics, Text Processing, Save) [cite: 273] using Pandas and PySpark.\n\n| Metric | [cite_start]Pandas Baseline [cite: 288, 290] | [cite_start]PySpark (Local Mode) [cite: 299, 302] |\n| :--- | :--- | :--- |\n| **Duration** | [cite_start]Measured with CodeCarbon Tracker [cite: 292] | [cite_start]Measured with CodeCarbon Tracker [cite: 302] |\n| **CO2 / Energy** | [cite_start]Emissions Tracker output [cite: 296, 297] | [cite_start]Emissions Tracker output [cite: 302] |\n\n**Analysis Focus:**\n* [cite_start]Compare runtime and CO2 emissions per framework[cite: 308, 312, 314].\n* [cite_start]Discuss the impact of parallelism on sustainability[cite: 315].\n* [cite_start]Compute and analyze the **Efficiency Ratio** (Data Processed / CO2 emitted)[cite: 309, 310].\n* [cite_start]**Eco-Design Experiment:** Implement and re-measure emissions after one optimization (e.g., filtering columns, caching)[cite: 317, 318, 320, 321].\n\n### 2.2. File Format Comparison (TP3: CSV vs. Parquet)\n[cite_start]We compare the entire ETL pipeline when reading/writing **CSV** files versus **Parquet** files (using Snappy compression)[cite: 389, 390, 420].\n\n| Metric | [cite_start]CSV Pipeline [cite: 404] | [cite_start]Parquet Pipeline (Snappy) [cite: 419] |\n| :--- | :--- | :--- |\n| **Performance** | [cite_start]`pd.read_csv()`, `df.to_csv()` [cite: 411, 416] | [cite_start]`pd.read_parquet()`, `df.to_parquet()` [cite: 430, 435] |\n| **Storage Footprint** | Measured file size | [cite_start]Measured file size (expected $5-10\\times$ reduction) [cite: 467] |\n| **Sustainability** | [cite_start]CO2 and Energy measured via CodeCarbon [cite: 406] | [cite_start]CO2 and Energy measured via CodeCarbon [cite: 427] |\n\n**Analysis Focus:**\n* [cite_start]Compare runtime, energy, and CO2 for I/O operations (Load/Save)[cite: 440, 446].\n* [cite_start]Quantify storage savings achieved by the columnar format (Parquet)[cite: 449].\n* [cite_start]Discuss the trade-offs between readability, performance, and sustainability of the formats[cite: 464].\n\n### 2.3. Deliverables for TP2 & TP3\n* [cite_start]**Code:** `tp_codecarbon_books.ipynb` (TP2) and `tp_codecarbon_parquet.ipynb` (TP3)[cite: 327, 461].\n* [cite_start]**Logs:** `emissions_pandas.csv`, `emissions_spark.csv`, `emissions_csv.csv`, `emissions_parquet.csv`[cite: 328, 329, 462].\n* [cite_start]**Figures:** Comparison charts for emissions and runtime for both frameworks and file formats[cite: 330, 463].\n* [cite_start]**Reflection:** Short written reflections on the comparison of frameworks (TP2) and file formats (TP3)[cite: 331, 464].\n\n---\n\n## 3. LLM Tooling and Environmental Cost (TP4: Model Context Protocol)\n\nThis final phase investigates the environmental impact of offloading tasks from the LLM's \"reasoning\" (internal inference) to external **Model Context Protocol (MCP)** tool calls, instrumented with CodeCarbon.\n\n### 3.1. Tools to Implement\n[cite_start]The server must implement at least three tools using the `fastmcp` and `codecarbon` packages[cite: 194, 195]:\n\n| Exercise | Tool Description | Tool Goal |\n| :--- | :--- | :--- |\n| **A** | [cite_start]`add(a: int, b: int)` [cite: 114] | [cite_start]Compare model internal computation vs. tool call for a large sum[cite: 145, 146]. |\n| **B** | [cite_start]`factorial(n: int)` [cite: 155] | [cite_start]Compare model internal computation vs. tool call for a recursive math function[cite: 162]. |\n| **C** | [cite_start]`analyze_file(path: str)` [cite: 172] | [cite_start]Tool for reading a local file, counting words, and returning a JSON summary[cite: 167, 168, 169]. |\n\n### 3.2. Metrics & Comparison\nYou must fill a comparative table for each task, measuring:\n* [cite_start]**Approach:** Model Reasoning (Prompt-only) vs. MCP Tool Call[cite: 178].\n* [cite_start]**Metrics:** Latency (s), Energy (kWh), Emissions (kgCO2eq)[cite: 178].\n\n### 3.3. Key Analysis Questions (Required in Slide Deck)\n* In which scenario does the MCP approach reduce **hallucination risk**? [cite_start]Why? [cite: 186]\n* [cite_start]Does tool latency outweigh energy savings? [cite: 187]\n* [cite_start]Which tasks are better done by tools instead of models? [cite: 189]\n* [cite_start]If deployed at scale, which approach is more **sustainable** (model-only vs. tool-assisted)? [cite: 190]\n\n### 3.4. Deliverables for TP4\n* [cite_start]**Code:** `server.py` with the MCP server, at least three implemented and instrumented tools, and `CodeCarbon` integration[cite: 193, 194, 195].\n* [cite_start]**Spreadsheet:** The comparative table with latency, energy, and emissions results[cite: 196, 197, 198].\n* [cite_start]**Slide Deck (4-6 slides):** Includes screenshots of Claude Desktop tool calls, emissions logs, comparison charts, and final recommendations based on both **environmental cost** and **operational reliability**[cite: 202, 203, 204, 205, 206, 214, 215]."}