Skip to main content
Glama
PraneshASP

Foundry MCP Server

by PraneshASP
stop.ts1.76 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { promisify } from "util"; import { exec } from "child_process"; import * as os from "os"; import { getAnvilInfo } from "../../utils/rpc.js"; const execAsync = promisify(exec); export function registerAnvilStopTool(server: McpServer): void { server.tool( "anvil_stop", "Stop a running Anvil instance", {}, async () => { const anvilInfo = await getAnvilInfo(); if (!anvilInfo.running) { return { content: [{ type: "text", text: "No Anvil instance is currently running." }], isError: true }; } try { // Kill the anvil process if (os.platform() === 'win32') { await execAsync('taskkill /F /IM anvil.exe'); } else { await execAsync('pkill -f anvil'); } // Check if it was stopped successfully await new Promise(resolve => setTimeout(resolve, 500)); const newAnvilInfo = await getAnvilInfo(); if (!newAnvilInfo.running) { return { content: [{ type: "text", text: "Anvil has been stopped successfully." }] }; } else { return { content: [{ type: "text", text: "Failed to stop Anvil. It may still be running." }], isError: true }; } } catch (error) { return { content: [{ type: "text", text: `Error stopping Anvil: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); }

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/PraneshASP/foundry-mcp-server'

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