server_send_command
Send console commands to a running Minecraft server to manage gameplay, permissions, and server settings directly from the MCP interface.
Instructions
Send a command to a running Minecraft server's console. Examples: 'say Hello everyone!', 'op PlayerName', 'whitelist add Player', 'gamemode creative Player', 'time set day', 'weather clear'
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| server_id | Yes | Server ID or UUID | |
| command | Yes | Command to send to the server console (without leading slash) |
Implementation Reference
- src/tools/server-console.ts:6-22 (handler)The `server_send_command` tool is registered using `server.tool` and contains the handler implementation that makes a POST request to the Crafty server's stdin endpoint.
server.tool( "server_send_command", "Send a command to a running Minecraft server's console. Examples: 'say Hello everyone!', 'op PlayerName', 'whitelist add Player', 'gamemode creative Player', 'time set day', 'weather clear'", { server_id: z.string().describe("Server ID or UUID"), command: z.string().describe("Command to send to the server console (without leading slash)"), }, async ({ server_id, command }) => { try { const data = await client.post(`/servers/${server_id}/stdin`, { command }); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true }; } } );