Skip to content

Add mcp command for stdio MCP server mode with deploy tool endpoint#90

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-mcp-server-command
Draft

Add mcp command for stdio MCP server mode with deploy tool endpoint#90
Copilot wants to merge 2 commits intomainfrom
copilot/add-mcp-server-command

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 24, 2026

Adds MCP (Model Context Protocol) server support to the deploy4j CLI, enabling AI agent harnesses to invoke deploy4j operations via the standardized MCP stdio transport.

Changes

  • New McpCliCommand — picocli subcommand deploy4j mcp that starts an MCP sync server over stdio using io.modelcontextprotocol.sdk:mcp:0.9.0
  • deploy MCP tool — exposes the existing deploy logic as an MCP tool endpoint; accepts an optional skipPull boolean parameter, returns success/error text content
  • Lifecycle management — wraps System.in in a FilterInputStream that counts down a CountDownLatch on EOF, blocking the main thread until the client closes the connection, then cleanly closes the server
  • Dependency — added io.modelcontextprotocol.sdk:mcp:0.9.0 to deploy4j-cli/pom.xml
  • RegistrationMcpCliCommand added to the subcommand list in Deploy4jApplicationCommand

Usage

# Start deploy4j as an MCP server (AI agent connects via stdio)
deploy4j mcp -c config/deploy.yml -d staging

The agent can then call the deploy tool:

{
  "name": "deploy",
  "arguments": { "skipPull": false }
}

This is the first tool endpoint; remaining CLI commands (redeploy, rollback, etc.) can be added as follow-on MCP tools using the same pattern.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • central.sonatype.com
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
  • modelcontextprotocol.github.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
  • modelcontextprotocol.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

I'd like to add a command called mcp. This will put the tool into mcp server mode, supporting stdio mcp usage.

Use the offficla java mcp sdk https://modelcontextprotocol.io/sdk/java/mcp-server to implement each of the existing cli commands as a mcp tool endpoint.

The tools will be used within an ai agent harness.

We can create a first impl for the deploy command and the rollout the others after.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Add io.modelcontextprotocol.sdk:mcp:0.9.0 dependency to deploy4j-cli/pom.xml
- Create McpCliCommand that starts deploy4j in stdio MCP server mode
- Expose the deploy command as an MCP tool endpoint
- Register McpCliCommand as a subcommand in Deploy4jApplicationCommand

Co-authored-by: teggr <837787+teggr@users.noreply.github.com>
Copilot AI changed the title [WIP] Add mcp command for server mode implementation Add mcp command for stdio MCP server mode with deploy tool endpoint Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants