Skip to content

Conversation

@savageops
Copy link
Contributor

Add Close and Get Deployment Tools to Akash MCP Server

Summary

This PR adds two essential tools to the Akash MCP server for improved deployment lifecycle management:

  • close-deployment - Terminate deployments on the Akash Network
  • get-deployment - Query deployment details including status, groups, and escrow

Motivation

The Akash MCP server previously lacked critical deployment management capabilities. Users could create and update deployments but had no programmatic way to:

  1. Close/terminate deployments when no longer needed
  2. Query detailed deployment information for monitoring and debugging

These gaps prevented complete deployment lifecycle management through the MCP interface.

Changes

New Tools Added

1. Close Deployment Tool (src/tools/close-deployment.ts)

  • Sends MsgCloseDeployment transaction to the Akash blockchain
  • Accepts deployment sequence number (dseq) parameter
  • Triggers cascade cleanup: lease termination, bid cancellation, escrow refund
  • Returns transaction hash and confirmation details

2. Get Deployment Tool (src/tools/get-deployment.ts)

  • Queries deployment details via RPC
  • Accepts deployment sequence number (dseq) parameter
  • Returns comprehensive deployment data:
    • Deployment status and metadata
    • Group specifications and states
    • Escrow account balance and payment details

Files Modified

  • src/tools/close-deployment.ts - New file (48 lines)
  • src/tools/get-deployment.ts - New file (51 lines)
  • src/tools/index.ts - Added exports for both tools
  • src/AkashMCP.ts - Registered both tools in registerTools() method

Implementation Details

Both tools follow the established patterns in the codebase:

  • Use Zod for parameter validation
  • Leverage existing wallet/client context
  • Return standardized output via createOutput() utility
  • Handle errors consistently with other tools
  • Match code style and structure of existing tools

Testing

  • Successfully builds with TypeScript compiler
  • Tested deployment closure on Akash mainnet
  • Verified deployment queries return accurate data
  • Confirmed escrow refunds process correctly

Impact

These additions complete the core deployment management capabilities, enabling:

  • Full CRUD operations for deployments
  • Proper resource cleanup and cost management
  • Enhanced monitoring and debugging capabilities
  • Better integration with infrastructure automation tools

Breaking Changes

None. These are additive changes that maintain backward compatibility.

Checklist

  • Code follows project style guidelines
  • TypeScript compilation successful
  • Tools tested on Akash mainnet
  • Documentation in tool descriptions
  • Consistent error handling
  • No breaking changes to existing tools

@zJuuu zJuuu self-requested a review August 19, 2025 20:45
@zJuuu zJuuu changed the title Added Close/Get Deployment feat: Add Close/Get Deployment Aug 28, 2025
@zJuuu zJuuu merged commit dd570da into akash-network:main Aug 28, 2025
1 check failed
@zJuuu
Copy link
Collaborator

zJuuu commented Aug 28, 2025

Thanks for your PR, @savageops! Much appreciated!

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