Skip to content

[CLI] Implement OpenContext CLI for setup, configuration, and cost estimation #62

@thealphacubicle

Description

@thealphacubicle

Overview

Add a developer-facing CLI to streamline the setup, configuration, and operational management of an OpenContext MCP server deployment. The CLI reduces friction for municipal forkers by replacing manual file editing and AWS console work with guided, interactive commands.

Background

Prior to this work, deploying OpenContext required manually editing config.yaml, running Terraform commands directly, and checking AWS credentials out-of-band. For non-expert municipal IT staff attempting to fork and deploy their own instance, this was a significant barrier.

Scope of Work

Three commands were implemented under cli/commands/:

authenticate

  • Checks for required local prerequisites: Python 3.11+, uv, AWS CLI, and Terraform
  • Attempts auto-installation where possible
  • Verifies AWS credentials are configured and valid
  • Outputs results in a formatted table with actionable remediation guidance

configure

  • Interactive guided wizard for full deployment configuration
  • Covers: organization details, plugin selection (CKAN / Socrata / ArcGIS), plugin-specific settings, AWS deployment parameters, and optional custom domain
  • Writes out config.yaml and Terraform variable files
  • Manages Terraform workspace initialization
  • Prints a final configuration summary before applying

cost

  • Fetches live CloudWatch metrics for Lambda invocations and API Gateway requests
  • Calculates estimated AWS costs using public pricing tiers
  • Presents a breakdown table with projected monthly cost

Acceptance Criteria

  • authenticate command correctly identifies missing prerequisites and guides remediation
  • configure wizard produces a valid config.yaml and Terraform vars file
  • cost command retrieves CloudWatch data and renders a cost summary table
  • All three commands integrated into the main CLI entrypoint
  • Supports CKAN, Socrata, and ArcGIS plugin configuration paths

Implementation Notes

  • Implemented in Python using the existing project toolchain (uv)
  • CloudWatch metric fetching uses boto3 with public Lambda + API Gateway pricing constants
  • Plugin selection in configure is menu-driven and maps directly to the three supported DMS plugins
  • Delivered as part of the MCP v3 major update (see Major update: MCP v3 with multiple DMS support + CLI #36)

Related

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions