httpkey-python is a Model Context Protocol (MCP) server written in Python. It provides system utility tools to MCP clients (like Gemini) using the HTTP (SSE) transport.
This project allows LLMs to safely query local system information such as CPU usage, memory statistics, and disk space.
- MCP HTTP (SSE) Transport: Communicates via JSON-RPC messages over Server-Sent Events.
- Modern Python: Built with Python 3.11+ and the official
mcpSDK usingFastMCP. - Direct CLI Mode: Can be run directly from the command line for quick reports.
The server exposes the following MCP tools:
-
local_system_info: Generates a comprehensive system report.- System Name, OS Name, Hostname
- CPU Core Count
- Memory Usage (Total, Used, Swap)
- Network Interface Statistics (RX/TX bytes and MAC addresses)
- Includes an authentication status header when run via MCP.
-
disk_usage: Lists usage statistics for all mounted disks.- Mount Point, File System
- Used/Total Space
- Percentage Used
- Python 3.11+
make(optional, for convenience)gcloudCLI (for authentication)
This server requires an MCP API Key for security.
The server will verify the provided key against the "MCP API Key" stored in Google Cloud API Keys. The project ID is automatically detected from the GOOGLE_CLOUD_PROJECT environment variable or your gcloud configuration.
When using HTTP (SSE) transport, the client must provide the API key in the X-Goog-Api-Key header.
You can provide the key to the server in two ways:
- Using the
--keyargument when starting the server. - Setting the
MCP_API_KEYenvironment variable.
The server uses a two-stage verification process:
- It attempts to fetch the valid key using the
gcloudCLI (ideal for local development). - It falls back to the Google Cloud API Keys library using Application Default Credentials (ADC).
Clone the repository and install dependencies:
make installThis project is configured for use with the Gemini CLI. The configuration is located in .gemini/settings.json.
Note: You must provide your API key either via args or env:
{
"mcpServers": {
"httpkey-python": {
"url": "http://localhost:8080/sse",
"env": {
"MCP_API_KEY": "YOUR_SECRET_KEY"
}
}
}
}You can run the tools directly without an MCP client. These commands will also display the verification status of your API key if provided:
System Info:
make info KEY=YOUR_KEY
# OR
python3 main.py info --key YOUR_KEYDisk Usage:
make disk
# OR
python3 main.py diskTo start the server manually:
make run KEY=your-secret-key
# OR
export MCP_API_KEY=your-secret-key
python3 main.pyFor production-like runs where the key is expected to be fetched automatically from the environment or Google Cloud:
make releaseThis project includes a Dockerfile and cloudbuild.yaml for easy deployment to Google Cloud Run.
-
Build and Deploy:
make deploy
This command uses Google Cloud Build to build the container image and deploy it to Cloud Run.
-
Service Configuration: The default service name is
sysutils-manual-python(as defined incloudbuild.yaml).
- Lint:
make lint - Format:
make fmt - Test:
make test - Clean:
make clean