Skip to main content
Glama

server_update_file

Modify configuration files on a Minecraft server managed by crafty-mcp, such as server.properties or whitelist.json, to adjust server settings or permissions.

Instructions

Write or update a file on the Minecraft server (e.g., server.properties, ops.json, whitelist.json)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
server_idYesServer ID or UUID
pathYesRelative file path
contentsYesNew file contents
overwriteNoOverwrite even if file was modified externally

Implementation Reference

  • Implementation of the server_update_file tool, which uses the client.patch method to update file contents on the Minecraft server.
    server.tool(
      "server_update_file",
      "Write or update a file on the Minecraft server (e.g., server.properties, ops.json, whitelist.json)",
      {
        server_id: z.string().describe("Server ID or UUID"),
        path: z.string().describe("Relative file path"),
        contents: z.string().describe("New file contents"),
        overwrite: z
          .boolean()
          .default(false)
          .describe("Overwrite even if file was modified externally"),
      },
      async ({ server_id, path, contents, overwrite }) => {
        try {
          const data = await client.patch(`/servers/${server_id}/files`, {
            path,
            contents,
            overwrite,
          });
          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 };
        }
      }
    );

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/HadiCherkaoui/crafty-mcp'

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