Skip to content

Conversation

@codebycarson
Copy link
Collaborator

Add docker tool

This tool gives the MCP server the ability to spin up its own chain from the official releases when an environment variable is configured properly.

…g docker

- Added environment variable requirement to turn it on
@changeset-bot
Copy link

changeset-bot bot commented Sep 8, 2025

🦋 Changeset detected

Latest commit: de49cce

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sei-js/mcp-server Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2025

Codecov Report

❌ Patch coverage is 4.29043% with 290 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.93%. Comparing base (0dc3751) to head (de49cce).

Files with missing lines Patch % Lines
packages/mcp-server/src/docker/tools.ts 4.34% 176 Missing ⚠️
packages/mcp-server/src/core/services/chain.ts 0.00% 91 Missing ⚠️
packages/mcp-server/src/docker/initialize.ts 6.25% 15 Missing ⚠️
packages/mcp-server/src/docker/releases.ts 11.11% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #292       +/-   ##
===========================================
- Coverage   79.29%   64.93%   -14.36%     
===========================================
  Files          82       87        +5     
  Lines        1280     1583      +303     
  Branches      212      249       +37     
===========================================
+ Hits         1015     1028       +13     
- Misses        259      555      +296     
+ Partials        6        0        -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codebycarson codebycarson requested a review from Copilot September 8, 2025 16:32

This comment was marked as outdated.

@codebycarson codebycarson requested a review from Copilot September 8, 2025 16:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds Docker-based tools to the MCP server that enable users to spin up and manage local Sei blockchain containers. The implementation provides comprehensive container lifecycle management for local development and testing.

  • Docker integration with environment variable gating (SEI_DOCKER_ENABLED)
  • Six new tools for complete container management (get releases, start, stop, restart, delete, list)
  • GitHub API integration to fetch official Sei chain releases

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/mcp-server/src/server/server.ts Registers Docker tools with the MCP server
packages/mcp-server/src/docker/tools.ts Main Docker tool implementations with container management
packages/mcp-server/src/docker/releases.ts GitHub API integration for fetching Sei releases
packages/mcp-server/src/docker/initialize.ts Container creation and initialization logic
packages/mcp-server/src/docker/index.ts Module exports
packages/mcp-server/src/core/services/chain.ts Additional chain service utilities
packages/mcp-server/package.json Added dockerode dependency
package.json Added optional dependencies
docs/mcp-server/troubleshooting.mdx Docker troubleshooting documentation
docs/mcp-server/tools.mdx Documentation for new Docker tools
docs/mcp-server/quickstart.mdx Updated quickstart with Docker setup
docs/mcp-server/introduction.mdx Updated feature descriptions
docs/mcp-server/environment-variables.mdx Docker configuration documentation
packages/mcp-server/.env.example Added Docker environment variable
.changeset/cold-sites-hear.md Changeset for the feature
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

packages/mcp-server/src/docker/tools.ts:1

  • This shell script embedded in the container command is very long and complex. Consider extracting it to a separate shell script file or breaking it into smaller, more maintainable functions. This would improve readability and make debugging easier.
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +153 to +157
const seiContainers = containers.filter(container =>
container.Names.some(name => name.includes('sei-chain')) ||
container.Image.includes('sei-protocol/sei') ||
container.Image.includes('ghcr.io/sei-protocol/sei')
);
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

The container filtering logic is duplicated across multiple tools (lines 152-156, 278-283, 450-454, 584-589). Consider extracting this into a reusable helper function to reduce code duplication and ensure consistent filtering behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +181 to +190
Cmd: [
'seid', 'start',
'--chain-id', chainId,
'--moniker', moniker,
'--rpc.laddr', 'tcp://0.0.0.0:26657',
'--api.enable', 'true',
'--api.address', 'tcp://0.0.0.0:1317',
'--grpc.address', '0.0.0.0:9090',
'--evm-rpc.address', '0.0.0.0:8545'
],
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

This file appears to duplicate functionality already implemented in the docker/tools.ts file but with different container initialization logic. Consider consolidating these implementations or clearly documenting the different use cases to avoid confusion.

Copilot uses AI. Check for mistakes.
@codebycarson codebycarson requested a review from besated September 8, 2025 16:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@besated besated left a comment

Choose a reason for hiding this comment

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

what is the purpose of this? is this for users to spin up a local node when vibe coding?

@@ -0,0 +1,5 @@
---
"@sei-js/mcp-server": minor
Copy link
Contributor

Choose a reason for hiding this comment

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

does this have to be minor or is patch fine? doesn't seem like it breaks existing integrations?

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.

4 participants