Skip to content

feat(mcp): expand FastMCP tools, prompt templates, and schema export - #33

Merged
dan-petty merged 12 commits into
release/v0.2.11from
feat/mcp-expansion-and-validation
Sep 6, 2026
Merged

dan-petty merged 12 commits into
release/v0.2.11from
feat/mcp-expansion-and-validation

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary & Motivation

Expands the DevOps CLI FastMCP server to achieve 1:1 tool parity across core CLI command groups, increases registered tools from 53 to 72, adds prompt templates and dynamic system resources, and introduces a dedicated devops mcp export-schemas command with automated synchronization to the Antigravity IDE lazy loader.

Key Changes

  1. Tool Parity Expansion (53 → 72 Tools):
    • Security Scanners: scan_trivy, scan_gitleaks, scan_semgrep, scan_checkov, scan_complexity, scan_aibom, scan_sbom
    • Kubernetes Operations: k8s_chaos, k8s_audit, k8s_lint, k8s_validate, k8s_diff_helm
    • HashiCorp Vault: vault_set, vault_sync
    • AI & Benchmarking: benchmark_embeddings, ai_architecture
    • Git & PR Governance: branches_list, pr_list, pr_checks
  2. FastMCP Prompt Templates (@mcp.prompt()):
    • code_review_prompt: Guided multi-persona code review workflow
    • security_audit_prompt: Zero-trust security, CVE, and credential leak audit
    • k8s_diagnostics_prompt: Cluster triage and pod status inspection
    • architecture_analysis_prompt: Structural review and diagram synthesis
  3. Dynamic System Resources (@mcp.resource()):
    • resource://system/info, resource://config/settings, resource://k8s/cluster, resource://review/stats, resource://vault/status, resource://mcp/tools
  4. Schema Export Command & Antigravity IDE Integration:
    • Added devops mcp export-schemas [--output-dir] command
    • Synchronized all 72 JSON schemas and instructions to /home/vscode/.gemini/antigravity-ide/mcp/devops-cli/
  5. Re-Exports & Documentation:
    • Full re-exports in devops_cli.ai.mcp.__all__
    • Generated markdown references in docs/MCP_TOOLS.md, README.md, docs/CLI_REFERENCE.md, and docs/commands/mcp.md
    • Updated docs/ROADMAP.md, docs/LOG.md, docs/PENDING_FEATURES.md, and docs/agent/task.md

Verification

  • Contract and integration tests: tests/test_fastmcp_contracts.py (4/4), tests/test_mcp.py & tests/test_pydantic_ai_mcp.py (27/27)
  • Architectural invariants: tests/test_architectural_invariants.py (6/6)
  • Full CI suite: devops ci — 10/10 quality gates passed with $\ge 90%$ code coverage

Copilot AI lite review requested due to automatic review settings September 6, 2026 13:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Documentation now contradicts the actual MCP resource/tool contracts in a couple of places (notably resource URIs and a parameter type), which should be corrected before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR expands the DevOps CLI FastMCP server toward CLI tool parity by adding new MCP tools, prompts, resources, and a schema export CLI command, while also hardening architectural invariants (complexity/nesting) and standardizing domain exception taxonomy across the codebase.

Changes:

  • Expanded FastMCP surface area (new tools + prompts + dynamic resources) and re-exported the API via devops_cli.ai.mcp.
  • Added devops mcp export-schemas plus tests/contract checks to validate tool/prompt/resource discovery and execution.
  • Enforced repo-wide architectural/style invariants (nesting/complexity, no bare built-in exceptions) and refactored hotspots into helper functions.
File summaries
File Description
tests/test_rag_embeddings.py Adds regression coverage for embedding vector count mismatch error handling.
tests/test_pydantic_ai_mcp.py Tightens MCP toolset discovery expectations and validates prompts/resources are exposed.
tests/test_mcp.py Adds export-schemas CLI test and execution tests for newly added MCP tools/prompts.
tests/test_fastmcp_contracts.py Updates contract expectations for expanded tool set and adds prompt/resource registration checks.
tests/test_architectural_invariants.py Introduces automated gates for exception taxonomy, nesting depth, and complexity.
src/devops_cli/security/vault_broker.py Replaces bare exceptions and extracts Vault KV-v2 fetch helper for clarity.
src/devops_cli/security/complexity.py Extracts findings generation helper to reduce complexity in the scan loop.
src/devops_cli/security/aibom.py Extracts model metadata parsing helpers to flatten and simplify AIBOM extraction.
src/devops_cli/output/formatters/scalars.py Extracts symbol formatting helper for cleaner repo map rendering.
src/devops_cli/lang/en/help.py Adds help text for the new mcp export-schemas command options.
src/devops_cli/k8s/credentials.py Refactors Grafana password lookup using a helper + cartesian product iteration.
src/devops_cli/k8s/chaos_runner.py Replaces bare RuntimeError with domain exception for chaos execution failures.
src/devops_cli/exceptions/vault.py Adds Vault domain exceptions with codes/details.
src/devops_cli/exceptions/k8s.py Adds Kubernetes domain exceptions with codes/details.
src/devops_cli/exceptions/docker.py Adds Docker domain exceptions with codes/details.
src/devops_cli/exceptions/ai.py Adds AI harness/model bundle domain exceptions and exports them.
src/devops_cli/exceptions/init.py Re-exports newly added domain exception types.
src/devops_cli/docker/sandbox.py Replaces bare ValueError with Docker sandbox domain exception.
src/devops_cli/config/constants.py Adds new canonical error code constants used by new exception taxonomy.
src/devops_cli/commands/vault.py Replaces bare ValueError with VaultConfigurationError during validation.
src/devops_cli/commands/mcp.py Adds export-schemas command to emit tool JSON schemas + instructions.
src/devops_cli/commands/k8s/cluster_context.py Replaces bare ValueError with KubernetesContextError in URL/path validation.
src/devops_cli/ai/toolsets/init.py Refactors tool extraction logic into helpers and closes coroutines defensively.
src/devops_cli/ai/response_repair.py Extracts JSON tool-call parsing and function-arg parsing helpers.
src/devops_cli/ai/rag/embeddings.py Introduces DevOpsCLIError-based EmbeddingsError and validates vector count.
src/devops_cli/ai/providers/init.py Converts provider selection into table-driven mappings to reduce branching.
src/devops_cli/ai/model_bundler.py Replaces bare ValueError with ModelBundleError for path validation failures.
src/devops_cli/ai/mcp/server.py Registers new FastMCP tools, resources, and prompt templates.
src/devops_cli/ai/mcp/init.py Re-exports expanded MCP surface area through __all__.
src/devops_cli/ai/harness/workflow.py Replaces bare exceptions with Harness* domain exceptions.
src/devops_cli/ai/harness/skills.py Replaces bare exceptions with HarnessValidationError for parsing/validation errors.
src/devops_cli/ai/harness/shell.py Replaces bare exceptions with HarnessValidationError for config validation.
src/devops_cli/ai/harness/planning.py Replaces bare exceptions with HarnessValidationError for plan/tool validation.
src/devops_cli/ai/harness/os_access.py Replaces bare exceptions with HarnessExecutionError for tool call budget exhaustion.
src/devops_cli/ai/harness/memory.py Aligns memory errors with harness exception taxonomy.
src/devops_cli/ai/harness/filesystem.py Extracts FileSystem tool closures into methods to reduce complexity/nesting.
src/devops_cli/ai/harness/compaction.py Replaces bare exceptions with HarnessValidationError for config validation.
src/devops_cli/ai/durable.py Replaces bare exceptions with HarnessValidationError for path validation.
src/devops_cli/ai/benchmark/embedding_tasks.py Extracts a parser helper to simplify eval-pair parsing.
src/devops_cli/ai/ast_stream.py Extracts AST/token helpers to flatten symbol/token streaming logic.
src/devops_cli/ai/analyze/scanner.py Extracts dependency parsing helpers for maintainability.
src/devops_cli/ai/agents/testing.py Disables pytest collection for TestModel.
src/devops_cli/ai/agents/runner.py Extracts hook dispatch + timeout execution helper to reduce duplication.
src/devops_cli/ai/agents/agent.py Extracts toolset instruction and tool description formatting helpers.
README.md Documents the new devops mcp export-schemas command in the command matrix.
docs/ROADMAP.md Updates roadmap to reflect MCP/tooling milestone details.
docs/PENDING_FEATURES.md Updates active milestone narrative to v0.2.11 and MCP/tooling scope.
docs/MCP_TOOLS.md Extends the generated MCP tools reference for new tools.
docs/LOG.md Logs the MCP expansion + invariant/exception refactor milestone.
docs/ERRORS.md Documents new domain error codes/types.
docs/commands/mcp.md Adds documentation for devops mcp export-schemas.
docs/CLI_REFERENCE.md Adds CLI reference entry for devops mcp export-schemas.
docs/agent/task.md Updates task tracking content to include completed phases and next steps.
AGENTS.md Tightens/clarifies invariants and domain exception policy.
Review details
  • Files reviewed: 54/54 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/MCP_TOOLS.md Resolved
Comment thread docs/ROADMAP.md Resolved
@dan-petty
dan-petty merged commit a6f5a6e into release/v0.2.11 Sep 6, 2026
4 checks passed
@dan-petty
dan-petty deleted the feat/mcp-expansion-and-validation branch September 6, 2026 13:54
dan-petty added a commit that referenced this pull request Sep 6, 2026
…b management (#38)

* feat(k8s): replace redis with valkey across cluster stack manifests (#31)

* feat(k8s): replace redis with valkey across cluster stack manifests

* test(k8s): address copilot feedback on manifest parsing and document assertions

* docs(agent): update task tracking to completed for phase 35

* feat(mcp): expand FastMCP tools, prompt templates, and schema export (#33)

* refactor(exceptions): define domain exception classes and canonical error codes

* test(invariants): author architectural and stylistic invariant test specifications

* fix(exceptions): replace bare generic exceptions with strongly typed domain exceptions

* refactor(complexity): flatten excessive nesting and reduce cyclomatic complexity across modules

* fix(test-hygiene): eliminate pytest collection warning and unawaited coroutines

* docs(standards): update architectural guidelines, task tracking, and roadmap

* docs(agent): update task tracking to monitor PR 32 CI

* fix(review): address copilot feedback on vector validation, invariant checks, and error codes

* test(mcp): author contract and integration test specifications for expanded tools, prompts, and resources

* feat(mcp): expand FastMCP server to 72 tools, prompt templates, and schema export command

* docs(mcp): update MCP_TOOLS, README, ROADMAP, and task tracking for phase 37

* fix(mcp): resolve schema union type parsing and update roadmap resource URIs

* refactor(architecture): codebase stylistic and structural drift remediation (#32)

* refactor(exceptions): define domain exception classes and canonical error codes

* test(invariants): author architectural and stylistic invariant test specifications

* fix(exceptions): replace bare generic exceptions with strongly typed domain exceptions

* refactor(complexity): flatten excessive nesting and reduce cyclomatic complexity across modules

* fix(test-hygiene): eliminate pytest collection warning and unawaited coroutines

* docs(standards): update architectural guidelines, task tracking, and roadmap

* docs(agent): update task tracking to monitor PR 32 CI

* fix(review): address copilot feedback on vector validation, invariant checks, and error codes

* fix(agents): prevent ThreadPoolExecutor blocking on tool timeout in runner

* docs(valkey): expand roadmap and add IT domain knowledge base guide (#34)

* refactor(exceptions): define domain exception classes and canonical error codes

* test(invariants): author architectural and stylistic invariant test specifications

* fix(exceptions): replace bare generic exceptions with strongly typed domain exceptions

* refactor(complexity): flatten excessive nesting and reduce cyclomatic complexity across modules

* fix(test-hygiene): eliminate pytest collection warning and unawaited coroutines

* docs(standards): update architectural guidelines, task tracking, and roadmap

* docs(agent): update task tracking to monitor PR 32 CI

* fix(review): address copilot feedback on vector validation, invariant checks, and error codes

* test(mcp): author contract and integration test specifications for expanded tools, prompts, and resources

* feat(mcp): expand FastMCP server to 72 tools, prompt templates, and schema export command

* docs(mcp): update MCP_TOOLS, README, ROADMAP, and task tracking for phase 37

* fix(mcp): resolve schema union type parsing and update roadmap resource URIs

* feat(kb): add Valkey IT domain knowledge base reference guide and dynamic index counters

* docs(roadmap): expand roadmap and pending features for milestone v0.2.12 Valkey integration

* fix(agents): prevent ThreadPoolExecutor blocking on tool timeout in runner

* docs(roadmap): add library ingestion engine and grounded AI guidance for v0.2.13 (#35)

* refactor(exceptions): define domain exception classes and canonical error codes

* test(invariants): author architectural and stylistic invariant test specifications

* fix(exceptions): replace bare generic exceptions with strongly typed domain exceptions

* refactor(complexity): flatten excessive nesting and reduce cyclomatic complexity across modules

* fix(test-hygiene): eliminate pytest collection warning and unawaited coroutines

* docs(standards): update architectural guidelines, task tracking, and roadmap

* docs(agent): update task tracking to monitor PR 32 CI

* fix(review): address copilot feedback on vector validation, invariant checks, and error codes

* test(mcp): author contract and integration test specifications for expanded tools, prompts, and resources

* feat(mcp): expand FastMCP server to 72 tools, prompt templates, and schema export command

* docs(mcp): update MCP_TOOLS, README, ROADMAP, and task tracking for phase 37

* fix(mcp): resolve schema union type parsing and update roadmap resource URIs

* feat(kb): add Valkey IT domain knowledge base reference guide and dynamic index counters

* docs(roadmap): expand roadmap and pending features for milestone v0.2.12 Valkey integration

* docs(roadmap): expand roadmap and pending features for milestone v0.2.13 library ingestion engine

* fix(mcp): validate integer argument bounds and ensure consistent export-schemas instructions output

* docs(agent): update task tracking for phase 39 completion and pr 35 review resolution

* fix(agents): prevent ThreadPoolExecutor blocking on tool timeout in runner

* feat(sdlc): enterprise SDLC conventions, repository governance, and GitHub automation roadmap (#36)

* feat(governance): establish enterprise SDLC repository templates and community health policies

* docs(sdlc): author enterprise software development life cycle architecture manual

* docs(roadmap): expand roadmap with v0.2.14 enterprise GitHub repository automation

* docs(agent): track phase 40 completion and PR 36 submission

* fix(review): address copilot feedback on private key exclusion, PR template, and task status

* feat(review): executive summary reporting, feedback loop hardening, and findings remediation (#37)

* fix(security): remediate review findings for traversal, protocols, and tool validation

* feat(review): harden self-improvement feedback loop and add report executive summary

* docs(review): synchronize review task manual, SDLC, and working log

* docs(agent): mark phase 41 complete and record PR 37 status

* fix(review): address copilot feedback on secret masking, AST symbol fallback, error message, and dynamic patterns

* docs(agent): note PR 36 merged into release branch

* docs(roadmap): update v0.2.11 completed items and task tracking for merged PR 37

* test

* feat(github): add declarative labels, milestones, projects v2, views and FastMCP tools

* refactor(core): consolidate boilerplate decorators, AST cache, scanners, and table builder

* feat(security): DevSecOps zero-trust hardening, secret sanitizer, fail-closed SSRF, sandbox isolation, and K8s perimeter

* fix(review): address Copilot findings for Checkov exit handling, milestone due_on, gitleaks Windows paths, and symlink semantics

* docs(release): record Phase 47.3 release v0.2.11 PR and Copilot remediation in task tracking and log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants