Open
Conversation
Signed-off-by: Kim Christensen <kimworking@gmail.com>
License lives at repo root; subpackages have no own LICENSE files, causing go-licenses to fail. Introduced transitively via github.com/modelcontextprotocol/go-sdk. Signed-off-by: Kim Christensen <kimworking@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds a new porter mcp CLI subcommand that runs a Model Context Protocol (MCP) server over stdio, exposing Porter read-only (and optionally write) operations as MCP tools for AI clients.
Changes:
- Introduces a new
pkg/mcppackage implementing the MCP server and tool handlers (runs/logs, outputs, credentials, parameters, bundle ops, failure analysis). - Wires the new
porter mcpCobra command into the CLI and adds documentation pages describing usage and client configuration. - Adds the MCP Go SDK dependency and updates license-check workflow ignores.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/mcp/server.go | Core MCP server wrapper, stdio transport, output capture/masking helpers. |
| pkg/mcp/tools_bundle.go | Registers bundle + installation tools; adds opt-in write tools with output capture. |
| pkg/mcp/tools_runs.go | Adds run listing and log retrieval tools. |
| pkg/mcp/tools_outputs.go | Adds output listing/get tools, including masking/sensitive blocking. |
| pkg/mcp/tools_creds.go | Adds credential set list/show tools. |
| pkg/mcp/tools_params.go | Adds parameter set list/show tools. |
| pkg/mcp/tools_analyze.go | Adds analyze_failure tool aggregating run/log/output context. |
| cmd/porter/mcp.go | Implements the porter mcp subcommand and --allow-write flag. |
| cmd/porter/main.go | Registers the new mcp subcommand on the root command. |
| docs/content/docs/references/cli/porter.md | Adds porter mcp to the CLI reference index. |
| docs/content/docs/references/cli/mcp.md | Adds CLI reference page for porter mcp. |
| docs/content/docs/how-to-guides/work-with-ai-agents.md | Adds a how-to guide for configuring MCP clients with Porter. |
| docs/content/docs/how-to-guides/_index.md | Adds “Working with AI Agents” to the how-to guide cards. |
| go.mod | Adds github.com/modelcontextprotocol/go-sdk v1.4.1 dependency. |
| go.sum | Updates checksums for new dependencies. |
| .github/workflows/check-licenses.yaml | Updates ignored modules list for license checking. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Validate required args server-side in list_runs, list_outputs (not just via JSON schema) - Validate get_logs requires exactly one of installation or run_id - Handle ok=false from GetInstallationLogs in analyze_failure - Verify run ownership when run_id provided in analyze_failure - Document segmentio/asm license in CI ignore comment - Wrap JSON config example in fenced code block Signed-off-by: Kim Christensen <kimworking@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change
Adds a
porter mcpsubcommand that starts an MCP (Model Context Protocol) server over stdio, allowing AI coding assistants (Claude Code, Cursor, VS Code Copilot, etc.) to interact with Porter using natural language.Read-only tools (always available):
explain_bundle— show bundle parameters, credentials, outputs, and actionslist_installations/show_installation— browse installationslist_runs/get_logs— inspect execution history and logslist_outputs/get_output— read run outputs (sensitive values masked)list_credentials/show_credential— browse credential setslist_parameters/show_parameter— browse parameter setsanalyze_failure— one-shot failure triage: fetches the last (or a specific) failed run's logs and outputs in a single callWrite tools (opt-in via
--allow-write):install_bundle,upgrade_bundle,uninstall_bundle,invoke_bundleExample usage with Claude Code:
Configure in Claude Code:
claude mcp add porter -- porter mcpWhat issue does it fix
Closes # (no existing issue)
This capability was identified as a natural fit for Porter: LLM agents can already reason about CNAB bundles conceptually, and exposing Porter's CLI operations as MCP tools lets them act on real installations with full context (logs, outputs, failure analysis) rather than just generating shell commands.
Notes for the reviewer
github.com/modelcontextprotocol/go-sdk(the official Go SDK, v1.4.1).exec.CommandContext. The MCP SDK cancels per-request contexts after each tool call, which would kill plugin subprocesses between calls. This is fixed by storing the server-lifetime context inMCPServer.ctxand using it for all Porter API calls.porter.Outdefaults toos.Stdout, which would corrupt the stdio JSON-RPC stream. It is redirected toos.StderrinNewMCPServer, with acaptureOutputhelper that temporarily swaps to a buffer when write-tool output should be returned to the client.Checklist