Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:1mcp app Agent restartCommand

From Leeroopedia
Knowledge Sources
Domains CLI, MCP_Protocol
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete CLI command for restarting a specific MCP server in a running 1MCP runtime via the admin API with idempotency support.

Description

The restartCommand function restarts a specific MCP server in a running 1MCP runtime. It resolves the runtime target, connects via the admin API, and sends a restart request with an idempotency key. It supports restarting all instances of a server and requires a running background runtime.

Usage

Import this function when you need to:

  • Restart a specific MCP server in a running runtime
  • Restart all instances of a template server
  • Use idempotency keys to avoid duplicate restart operations

Code Reference

Source Location

  • Repository: 1MCP Agent
  • File: src/commands/mcp/restart.ts (L89-139)

Signature

export interface RestartCommandArgs extends GlobalOptions {
  name: string;
  instance?: string;
  allInstances?: boolean;
  idempotencyKey?: string;
}

export function buildRestartCommand(yargs: Argv): Argv;
export async function restartCommand(argv: RestartCommandArgs): Promise<void>;

Import

import { restartCommand, buildRestartCommand } from '@src/commands/mcp/restart.js';

I/O Contract

Inputs

Name Type Required Description
name string Yes Server name to restart
instance string No Specific instance ID
allInstances boolean No Restart all instances
idempotencyKey string No Idempotency key

Outputs

Name Type Description
stdout text Restart result

Usage Examples

Restart a Server

1mcp mcp restart my-server
1mcp mcp restart my-server --all-instances

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment