Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🌦️ CommitWeather

Does rain make developers more productive? CommitWeather correlates weather data with GitHub commit activity using statistical analysis β€” revealing productivity patterns and helping teams pick the best day to deploy.

Built as a hackathon project demonstrating what AI agents can do with MCP integration: real-time correlation of external data sources (weather APIs + GitHub) with Pearson statistics and Bayesian risk scoring.


Project Description

CommitWeather is a custom MCP server that connects Kiro to real-world weather APIs and GitHub, enabling AI-powered analysis of how weather conditions correlate with coding productivity and deployment outcomes. It uses Bayesian statistics to forecast deployment risk based on weather forecasts and historical release failure patterns, giving teams data-driven confidence about when to ship.


How Kiro Was Used

Kiro was used as both the development environment and the primary consumer of this MCP integration. The entire project β€” from requirements through code generation β€” was built using Kiro's AI-DLC (AI-Driven Development Life Cycle) workflow, which guided the process through structured inception, design, and construction phases with approval gates at each step.

The MCP server was designed specifically to enable capabilities that Kiro cannot achieve on its own: real-time correlation of live external data sources (GitHub commit history + Open-Meteo weather data) with statistical analysis (Pearson correlation coefficients, Bayesian probability scoring). Without this MCP integration, Kiro has no way to fetch live weather data, calculate statistical correlations against repository history, or produce a Bayesian deployment risk assessment β€” these require real-time API access and scientific computing libraries (scipy, numpy) that the agent doesn't have natively.

Once connected, Kiro can answer questions like "Should we deploy today?" by chaining the MCP tools: fetching the weather forecast, pulling release history, calculating failure probabilities per weather condition using Beta distributions, and synthesizing a Green/Yellow/Red deployment readiness assessment. This transforms Kiro from a code assistant into a deployment intelligence advisor β€” something impossible without the MCP bridge to live external systems.

The project also includes a web application (FastAPI + AWS Lambda) that uses the same correlation engine with an AWS Bedrock Claude integration for natural language interpretation of the statistical results, demonstrating that one shared analytical core can power both an MCP-connected IDE experience and a standalone cloud-deployed web dashboard.


What's Included

Component Description
MCP Server 4 tools + 1 prompt, FastMCP (stdio transport), runs locally with Kiro
Web Dashboard Single-page app (HTML/CSS/JS) with charts, risk tables, deploy recommendations
REST API FastAPI backend with 6 endpoints (correlation, risk, deploy-window, user-report, chat, health)
AI Chat AWS Bedrock Claude 3 Haiku interprets statistical results in natural language
AWS Deployment SAM template for Lambda + API Gateway (one-command deploy)
Statistical Engine Pearson correlation, Bayesian risk scoring (Beta distribution), composite deploy-window scoring
Test Suite 59 tests including property-based testing (Hypothesis) with invariant, oracle, and round-trip tests
CI Pipeline GitHub Actions workflow for lint (Ruff) + test

Three Ways to Use CommitWeather

Mode What You Get Best For
1. MCP Server (Local) Kiro integration β€” ask natural language questions AI-powered developer workflow
2. Web App (Local) Interactive dashboard with AI chat Visual exploration, demos
3. Deploy to AWS Serverless web app with Bedrock AI Production-ready, shareable URL

1. MCP Server β€” Local, for Kiro

The MCP server runs locally via stdio transport. Kiro talks to it directly β€” no web server needed.

Install

git clone <repo-url>
cd mcp

# Install the package
pip install -e .

Configure Environment (optional)

# Copy example and edit
copy .env.example .env

Add your GitHub token for higher rate limits (optional for public repos):

GITHUB_TOKEN=ghp_your_token_here
LAT=40.7128
LON=-74.0060

Connect to Kiro

Add this to .kiro/settings/mcp.json in your workspace:

{
  "mcpServers": {
    "commit-weather": {
      "command": "python",
      "args": ["-m", "commit_weather.server"],
      "cwd": "C:/Users/yourname/path/to/mcp",
      "env": {
        "GITHUB_TOKEN": "ghp_your_token_here",
        "LAT": "40.7128",
        "LON": "-74.0060"
      }
    }
  }
}

Windows: Use forward slashes in cwd or escaped backslashes (C:\\Users\\...).

Try It

Once connected, ask Kiro:

  • "What's the weather-commit correlation for microsoft/vscode over the last 30 days?"
  • "Is it safe to deploy python/cpython today?"
  • "Show me my commit patterns β€” username: octocat"
  • "What's the optimal deploy window for facebook/react this week?"

MCP Tools Exposed

Tool Description
get_weather_correlation Pearson correlation between weather conditions and commit frequency
get_deployment_risk_forecast Bayesian risk assessment for upcoming deployments
get_commit_weather_report Personal productivity analysis β€” your commits vs weather
get_optimal_deploy_window Best day to deploy this week
deployment_readiness_check πŸŸ’πŸŸ‘πŸ”΄ traffic-light deployment prompt

2. Web App β€” Local

A full-featured dashboard with interactive charts, risk forecasts, and AI-powered chat (requires AWS Bedrock).

Run

# Install dependencies (if not already done)
pip install -e .

# Start the web server
python -m uvicorn commit_weather.web_api:app --reload --host 127.0.0.1 --port 8000

Open http://127.0.0.1:8000 in your browser.

Features

  • Correlation Analysis β€” visualize weather vs commit patterns for any repo
  • Risk Forecast β€” 7-day deployment risk with weather context
  • Optimal Deploy Window β€” ranked days to deploy this week
  • AI Chat β€” ask natural language questions (requires Bedrock credentials)

Requirements

  • .env file with GITHUB_TOKEN (optional for public repos)
  • For AI Chat: AWS credentials configured (aws configure or env vars) with Bedrock Claude 3 Haiku access

3. Deploy to AWS β€” Lambda + API Gateway + Bedrock

Deploy the web app as a serverless application. You get: a public URL, Lambda execution, API Gateway routing, and Bedrock-powered AI chat.

Prerequisites

  • AWS SAM CLI
  • AWS CLI configured with credentials
  • Bedrock model access enabled for Claude 3 Haiku in us-east-1

Enable Bedrock Access

  1. Go to AWS Bedrock Console
  2. Navigate to Model access β†’ Manage model access
  3. Enable Anthropic β†’ Claude 3 Haiku
  4. Wait for access grant (usually instant)

Deploy

# Build the Lambda package
sam build

# First-time deploy (interactive)
sam deploy --guided

# Follow prompts:
#   Stack Name: commit-weather
#   Region: us-east-1
#   GitHubToken: ghp_your_token (or blank for public repos)
#   Confirm changeset: y

After Deploy

SAM outputs your live URLs:

Outputs:
  ApiUrl: https://abc123.execute-api.us-east-1.amazonaws.com
  FunctionUrl: https://xyz789.lambda-url.us-east-1.on.aws/

Open either URL β€” the web dashboard is live with full Bedrock AI chat.

See DEPLOY.md for detailed deployment guide and troubleshooting.


Architecture

commit_weather/
  server.py          β€” MCP server (stdio transport, standalone)
  web_api.py         β€” FastAPI web application
  lambda_handler.py  β€” AWS Lambda adapter (Mangum)
  bedrock_advisor.py β€” Bedrock Claude integration (web app only)
  correlation.py     β€” Statistical engine (Pearson, Bayesian)
  github_client.py   β€” GitHub API client (commits, releases, events)
  weather_client.py  β€” Open-Meteo API client (historical + forecast)
  visualization.py   β€” ASCII charts + matplotlib rendering
  config.py          β€” Pydantic Settings configuration
  models.py          β€” Domain data models
  exceptions.py      β€” Custom error hierarchy
  cache.py           β€” TTL cache decorator
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚           Shared Core                   β”‚
                    β”‚  correlation Β· github Β· weather Β· modelsβ”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                     β”‚                          β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚   MCP Server    β”‚   β”‚   Web App      β”‚   β”‚   Lambda (AWS)         β”‚
     β”‚   server.py     β”‚   β”‚   web_api.py   β”‚   β”‚   lambda_handler.py    β”‚
     β”‚   (stdio)       β”‚   β”‚   (uvicorn)    β”‚   β”‚   + bedrock_advisor.py β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Configuration

Variable Default Used By Description
GITHUB_TOKEN (none) Both GitHub PAT β€” optional for public repos
LAT 40.7128 Both Latitude for weather data
LON -74.0060 Both Longitude for weather data
DEBUG_MODE false Both Verbose error messages
LOG_LEVEL INFO Both Logging level
AWS_REGION us-east-1 Web only AWS region for Bedrock

Tech Stack

  • FastMCP β€” MCP server framework (stdio transport)
  • FastAPI β€” Web application framework
  • httpx β€” Async HTTP client
  • scipy/numpy β€” Statistical analysis (Pearson, Bayesian)
  • matplotlib β€” Chart generation
  • Pydantic Settings β€” Configuration management
  • Mangum β€” Lambda adapter for FastAPI
  • boto3 β€” AWS Bedrock integration
  • Hypothesis β€” Property-based testing

APIs Used

Development

# Install with dev dependencies
pip install -e ".[dev]"

# Run all tests
python -m pytest -v

# Property-based testing with fixed seed
python -m pytest -v --hypothesis-seed=42

# Lint + format
python -m ruff check .
python -m ruff format .

# Coverage report
python -m pytest --cov=commit_weather --cov-report=term-missing

Troubleshooting

Problem Solution
pip install fails on scipy/numpy pip install --prefer-binary -e ".[dev]"
ModuleNotFoundError: commit_weather Run pip install -e . from project root
Rate limit errors from GitHub Add GITHUB_TOKEN to .env (create one)
"Not enough data" messages Try a more active repo (e.g., microsoft/vscode)
AI Chat returns errors Ensure Bedrock Claude 3 Haiku is enabled + AWS creds configured
Weather data seems wrong Verify LAT/LON values (latlong.net)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages