Skip to main content
Glama
199-mcp

MCP Autostarter

by 199-mcp

restart_mcp

Restart Claude Desktop's MCP handler process for plugin reloading without closing the application, ensuring uninterrupted UI functionality.

Instructions

Intelligently restarts only the MCP handler process without disrupting Claude Desktop UI

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that implements the restart_mcp tool logic: detects MCP handler process, gracefully terminates it, and waits for auto-restart by Claude Desktop.
    async restartMCPHandler(): Promise<RestartResult> {
      try {
        // Step 1: Find the MCP handler process
        const mcpProcess = await this.detector.findMCPHandlerProcess();
        
        if (!mcpProcess) {
          return {
            success: false,
            message: 'Could not find MCP handler process. It may not be running.',
            error: 'MCP_HANDLER_NOT_FOUND'
          };
        }
    
        const oldPid = mcpProcess.pid;
        console.log(`Found MCP handler process: PID ${oldPid}`);
    
        // Step 2: Gracefully terminate the process
        await this.gracefulKill(mcpProcess.pid);
        
        // Step 3: Wait a moment for Claude Desktop to detect the disconnection
        await this.delay(1000);
    
        // Step 4: Verify the process was terminated
        const stillRunning = await this.isProcessRunning(oldPid);
        if (stillRunning) {
          // Force kill if graceful didn't work
          await this.forceKill(oldPid);
          await this.delay(500);
        }
    
        // Step 5: Wait for Claude Desktop to restart the MCP handler
        const newProcess = await this.waitForMCPHandler(5000);
        
        if (newProcess) {
          return {
            success: true,
            message: 'MCP handler restarted successfully',
            oldPid,
            newPid: newProcess.pid
          };
        } else {
          return {
            success: false,
            message: 'MCP handler was terminated but did not restart automatically',
            oldPid,
            error: 'MCP_HANDLER_NOT_RESTARTED'
          };
        }
      } catch (error) {
        return {
          success: false,
          message: 'Failed to restart MCP handler',
          error: error instanceof Error ? error.message : 'UNKNOWN_ERROR'
        };
      }
    }
  • MCP server request handler for call_tool 'restart_mcp', which invokes the process manager's restartMCPHandler and formats the response.
    case 'restart_mcp': {
      try {
        console.error('Restarting MCP handler process...');
        const result = await processManager.restartMCPHandler();
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to restart MCP handler: ${error}`
        );
      }
    }
  • Tool schema definition including name, description, and empty input schema (no parameters required).
    {
      name: 'restart_mcp',
      description: 'Intelligently restarts only the MCP handler process without disrupting Claude Desktop UI',
      inputSchema: {
        type: 'object',
        properties: {},
        required: [],
      },
    },
  • Type definition for the output/result of the restart operation.
    export interface RestartResult {
      success: boolean;
      message: string;
      oldPid?: number;
      newPid?: number;
      error?: string;
    }
  • src/index.ts:30-62 (registration)
    Registration of tool list handler, which advertises the 'restart_mcp' tool to MCP clients.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: 'restart_mcp',
            description: 'Intelligently restarts only the MCP handler process without disrupting Claude Desktop UI',
            inputSchema: {
              type: 'object',
              properties: {},
              required: [],
            },
          },
          {
            name: 'restart_claude',
            description: 'Fully restarts Claude Desktop application (use only if MCP restart fails)',
            inputSchema: {
              type: 'object',
              properties: {},
              required: [],
            },
          },
          {
            name: 'get_mcp_status',
            description: 'Check if MCP handler and Claude Desktop processes are running',
            inputSchema: {
              type: 'object',
              properties: {},
              required: [],
            },
          },
        ],
      };
    });
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses the key behavioral trait that it 'restarts only the MCP handler process without disrupting Claude Desktop UI', which is valuable context about what gets affected. However, it doesn't mention potential side effects, permissions needed, or what 'intelligently' means operationally.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the complete purpose and key constraint. Every word earns its place, with no redundant information or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a parameterless tool with no annotations and no output schema, the description provides adequate context about what the tool does and its scope. However, it could be more complete by mentioning what 'intelligently' entails or what happens after the restart completes.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the baseline is 4. The description appropriately doesn't discuss parameters since none exist, which is correct for a parameterless tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('restarts') and target resource ('MCP handler process'), and distinguishes it from sibling tools by specifying it doesn't disrupt the Claude Desktop UI. It uses precise language that differentiates it from 'restart_claude' which likely restarts the entire application.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool ('restarts only the MCP handler process') and implies it's for targeted restarts. However, it doesn't explicitly state when NOT to use it or mention specific alternatives like 'get_mcp_status' for diagnostics before restarting.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/199-mcp/mcp-autostarter'

If you have feedback or need assistance with the MCP directory API, please join our Discord server