Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions internal/cmd/mcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/klaassen-consulting/jc/internal/config"
"github.com/klaassen-consulting/jc/internal/mcp"
"github.com/klaassen-consulting/jc/internal/recipe"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -263,6 +264,14 @@ func runMcpServe(rateLimit int, readOnly bool, transport, addr string, port int,
}
}

// Wire the recipe dispatcher so the recipe_run tool can actually
// execute (Execute: true) and the recipe_runner_view MCP App can
// drive end-to-end runs. Mirrors the TUI wiring at
// `screen.RecipeDispatcher = recipe.NewDispatcher(...)`. Plan-mode
// (Execute: false) doesn't need this, so the assignment is safe
// even on servers that never run recipes.
mcp.RecipeDispatcher = recipe.NewDispatcher(newRootCmdForRecipeStep)

server := mcp.NewServer(mcp.Options{
RateLimit: rateLimit,
ReadOnly: readOnly,
Expand Down
14 changes: 14 additions & 0 deletions internal/mcp/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ var dashboardHTML string
//go:embed apps_html/compliance.html
var complianceHTML string

//go:embed apps_html/recipe_runner.html
var recipeRunnerHTML string

//go:embed apps_html/common.js
var appCommonJS string

Expand Down Expand Up @@ -81,6 +84,17 @@ var appSpecs = []appSpec{
return fetchComplianceData(ctx)
},
},
{
Name: "recipe_runner_view",
Description: "Show an interactive JumpCloud recipe runner: browse built-in and user recipes, fill in parameters via an auto-generated form, preview the plan, and (with operator approval) execute the recipe end-to-end. Initial payload is the recipe catalog (same shape as recipe_list); the iframe drives subsequent plan/execute calls via recipe_run.",
ResourceURI: "ui://jc/recipe-runner",
ResourceName: "Recipe Runner App",
ResourceDescription: "Interactive jc recipe runner (browse → parameter form → plan/execute)",
HTML: recipeRunnerHTML,
Handler: func(ctx context.Context) (any, error) {
return fetchRecipeListData()
},
},
}

// renderAppHTML returns the app's HTML with the common.js scaffolding injected
Expand Down
Loading
Loading