1. Conduid
  2. RAG
  3. SoftwareEnergyEfficiency MCP Server
MCP server · RAG

SoftwareEnergyEfficiency MCP Server

This containerized MCP server written in Python and using FastMCP provides tools for increasing the energy efficiency of multiple computer languages and can be imported for use by multiple AI agents (including Copilot) concurrently. Its energy optimization dataset, currently supporting Java, is stored as a JSON file or in a Qdrant vector database.

34Low

Scored 6 months ago · breakdown

About SoftwareEnergyEfficiency MCP Server

SoftwareEnergyEfficiency MCP Server is an MCP server in the RAG category: this containerized MCP server written in Python and using FastMCP provides tools for increasing the energy efficiency of multiple computer languages and can be imported for use by multiple AI agents (including Copilot) concurrently. Its energy optimization dataset, currently supporting Java, is stored as a JSON file or in a Qdrant vector database.

Install

From source
git clone https://github.com/mmeinhar/SoftwareEnergyEfficiency-MCP-Server

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about SoftwareEnergyEfficiency MCP Server

Powered by Claude · Grounded in docs

I know everything about SoftwareEnergyEfficiency MCP Server. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ✓README presentThe repository ships documentation.

5 checks have not been run yet.

README

Software Energy Efficiency MCP Server

The MCP (Model Context Protocol) Server enables developers to write energy-efficient code, minimizing software’s environmental and operational costs. Its research dataset currently supports Java but is architected to support additional languages by expanding the dataset. It integrates with AI agents like GitHub Copilot to suggest sustainable optimizations.

The server enhances LLM-based code optimization by delivering customized, high-quality energy-efficiency research data to an AI agent. This agent incorporates the data into LLM prompts, prioritizing effective code optimization for reduced energy consumption. Using semantic search, the server analyzes energy efficiency observations, providing research-backed suggestions (e.g., from energy optimization studies; see Acknowledgments).

Written in Python with FastMCP 2.x, it supports local or remote operation and scalable data storage (JSON or cloud-hosted Qdrant). Configurable authentication and Docker-based deployment ensure secure, flexible operation.

White Paper Supplement

This software project supplements the white paper "Energy-Efficiency Tactics in Software Architecture and Implementation" (author: Max Meinhardt), which is a software energy-efficiency tactic reference guide for software architecture and implementation of cloud and non-cloud Web and IoT software applications.

Features

  • Supports any computer language. Current available data sets: Java.
  • Semantic search for relevant energy efficiency suggestions based on code snippets.
  • Conditional storage: JSON for simple setups and small energy efficiency datasets, Qdrant with scalable vector search for large data sets.
  • Scripted migration from JSON to Qdrant vector database
  • Configurable levels of server authentication depending on the deployment environment (Production: JWKS-based JWT verification, Staging: Static public key JWT verification, Development: Static token verification, and None)).
  • Centralized configuration in '.env' file for server settings.
  • Unit tests for core functionality.
  • Containerized for easy deployment and development.

Tested with the following MCP Clients

  • GitHub Copilot in Visual Studio Code

Project Structure

  • .devcontainer/: GitHub Codespaces configuration (devcontainer.json).
  • data/: Software energy efficiency dataset JSON file.
  • src/: Source code for the server.
  • src/tools/: Scripts for the JSON to database migration and test token generation.
  • tests/: Unit tests.
  • example_code_for_testing/: Examples of energy-inefficient code in multiple languages that is used for testing the MCP server.
  • Dockerfile: Defines the Docker image for the server.
  • .env.example: Example environment configuration file. Renamed to '.env' to use it.
  • LICENSE: MIT License for the project.

Settings

The MCP server is configured via the following environment variables that are set in the '.env' file or passed in as arguments when running the Docker container. Example values are provided in the '.env.example' file. The server can be run in different environments (Development, Staging, Production) with varying configurations for database usage, transport method, and authentication.:

Variable Name Description Environment
USE_DB Set to true to use Qdrant vector DB, false for JSON file in data/efficiency-data.json Development, Staging, Production
TRANSPORT Transport: stdio for local, sse for remote Development, Staging, Production
QDRANT_URL For Qdrant (required if USE_DB=true) Development, Staging, Production
QDRANT_API_KEY For Qdrant (required if USE_DB=true) Development, Staging, Production
MCP_SERVER_LOG_LEVEL Logging level: DEBUG, INFO, WARNING, ERROR, CRITICAL Development, Staging, Production
FASTMCP_SERVER_AUTH Authentication type: JWT (production), STATIC_JWT (staging), STATIC_TOKEN (development), or none (no auth) Development, Staging, Production
FASTMCP_SERVER_AUTH_JWT_JWKS_URI JWKS endpoint URL for fetching public keys (for JWT authentication in production) Production
FASTMCP_SERVER_AUTH_JWT_ISSUER Token issuer for JWT authentication (production) Production
FASTMCP_SERVER_AUTH_JWT_AUDIENCE Expected audience for JWT tokens (production) Production
FASTMCP_SERVER_AUTH_JWT_REQUIRED_SCOPES Comma-separated list of required scopes for JWT authentication (production) Production
FASTMCP_SERVER_AUTH_JWT_PUBLIC_KEY Static public key in PEM format for JWT verification (for STATIC_JWT authentication in staging) Staging
FASTMCP_SERVER_AUTH_JWT_ISSUER Token issuer for static JWT authentication (staging) Staging
FASTMCP_SERVER_AUTH_JWT_AUDIENCE Expected audience for static JWT authentication (staging) Staging
FASTMCP_SERVER_AUTH_JWT_REQUIRED_SCOPES Comma-separated list of required scopes for static JWT authentication (staging) Staging

NOTES:

  • QDRANT_URL and QDRANT_API_KEY are required only if USE_DB is set to 'true'.
  • FASTMCP_SERVER_AUTH_JWT_* variables apply based on the FASTMCP_SERVER_AUTH setting: JWT for production, STATIC_JWT for staging, and STATIC_TOKEN for development.
  • The FASTMCP_SERVER_AUTH_JWT_ISSUER and FASTMCP_SERVER_AUTH_JWT_AUDIENCE variables appear twice, as they are used for both JWT (production) and STATIC_JWT (staging) authentication with potentially different values.

Container Setup

To build and run locally, follow these steps:

  1. Clone the repository (if not already done):
    git clone https://github.com/mmeinhar/SoftwareEnergyEfficiency-MCP-Server.git
    cd SoftwareEnergyEfficiency-MCP-Server
    
  2. Copy the '.env.example' file to '.env'. Customize the environment variables in it to fit your requirements. These will be the default settings for the server:
    cp .env.example .env
    
  3. If you have set FASTMCP_SERVER_AUTH = STATIC_JWT for the Staging environment's authentication setup, you can create a public key for testing.
    docker run --rm agile7-software-energy-efficiency-mcp-server python src/tools/generate_mcp_server_test_token.py
    
    Assign the generated public key to the FASTMCP_SERVER_AUTH_JWT_PUBLIC_KEY environment variable in the '.env' file or as its assigned argument when running the container:
  4. Change the permissions of the '.env' file to ensure it is only readable and writable by the owner:
    chmod 600 .env
    
  5. Build the Docker image:
    docker build -t agile7-software-energy-efficiency-mcp-server .
    
  6. Check that the Docker image has been created successfully:
    docker images
    
  7. If you want to use Qdrant instead of the efficiency-data.json file to store the energy optimization data, migrate it from the JSON file to Qdrant by running the data migration script:
       docker run --rm agile7-software-energy-efficiency-mcp-server python src/tools/migrate_data_from_json_to_db.py
    
  8. Run the Docker container:
    docker run -it -p 8000:8000 agile7-software-energy-efficiency-mcp-server
    
    To run the Docker container in Debug mode, you can use the following command:
    docker run -it -e MCP_SERVER_LOG_LEVEL=DEBUG -p 8000:8000 agile7-software-energy-efficiency-mcp-server
    

Integration with GitHub Copilot

Configure GitHub Copilot to use this MCP server as a custom provider. When a Copilot user selects some code in their IDE and prompts CoPilot to optimize the code to be energy efficient, Copilot will associate the prompt to the MCP server's 'optimize_energy_efficiency' tool and send the selected code as strings to its input arguments. The tool then returns suggestions from its energy optimization database which the LLM used to apply to apply changes or generate new code, depending on the context which Copilot utilizes. When the MCP server's tool is invoked by Copilot, Copilot will ask the user to authorize the tool's use before applying the prompt's result.

Prompts to Ensure Copilot Uses the MCP Server

If a prompt is not created properly, the MCP server's tool may not be invoked by Copilot and will instead use the LLM to answer the prompt which may result in incomplete or innaccurate energy optimization results. To force a call to the optimize_energy_efficiency tool from GitHub Copilot, select some code in the IDE and then open the Copilot inline chat and enter "#optimize_energy_efficiency: analyze this Java code".

Dataset

The dataset is in data/efficiency_data.json. Add more observations as needed. Any language can be added, but it currently contains only Java data. Format:

[
  {"lang": "java", "component": "Variables", lang_keywords": "keyword1, keyword2", "observation": "..."}
]

Acknowledgments

This project's Java dataset in the efficiency-data.json file uses some data from the following academic research papers and industry publications:

License

This project is licensed under the MIT License. See the LICENSE file for details. The efficiency-data.json file contains some data derived from third-party research papers, which may be subject to separate licensing terms. See the Acknowledgments section for details.

README copy captured when this server was indexed; it may lag the repository. The original is authoritative.

Questions

About SoftwareEnergyEfficiency MCP Server

How do I install SoftwareEnergyEfficiency MCP Server?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is SoftwareEnergyEfficiency MCP Server safe to use with an AI agent?

Its trust score is 34 out of 100 (low). It passes 1 of the 1 static security checks run so far. It has no ConduID identity yet, so agent calls to it are not receipted.

Is SoftwareEnergyEfficiency MCP Server still maintained?

Conduid hasn't recorded a commit date for this repository yet. Check the repository directly for recent activity.