Skip to main content
Glama
hifishhe

Synology Docker MCP Server

by hifishhe

synology_read_file

Read Docker configuration files from your Synology NAS. Restricted to files under /volume1/docker, provides access to compose YAML and container settings.

Instructions

Read a configuration file from the NAS (restricted to /volume1/docker)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYesAbsolute path to the file on the NAS (must be within /volume1/docker)

Implementation Reference

  • Handler for 'synology_read_file' tool. Extracts filepath from args, validates it via validateRestrictedPath, then executes 'cat' over SSH to read the file content. Returns the file contents on success or an error message on failure.
    else if (name === "synology_read_file") {
      const { filepath } = args as { filepath: string };
      validateRestrictedPath(filepath);
      const res = await execSshCommand(`cat ${shQuote(filepath)}`);
      if (res.code !== 0) {
        return { content: [{ type: "text", text: `Error reading file: ${res.stderr}` }] };
      }
      return { content: [{ type: "text", text: res.stdout }] };
    }
  • Schema registration for 'synology_read_file' tool. Defines the tool name, description, and inputSchema with a required 'filepath' string property.
    {
      name: "synology_read_file",
      description: `Read a configuration file from the NAS (restricted to ${NAS_DOCKER_DIR})`,
      inputSchema: {
        type: "object",
        properties: {
          filepath: { type: "string", description: `Absolute path to the file on the NAS (must be within ${NAS_DOCKER_DIR})` },
        },
        required: ["filepath"],
      },
  • Helper function 'validateRestrictedPath' used by the handler to ensure filepath is absolute, contains no '..' traversal, and starts with NAS_DOCKER_DIR.
    /** Filepath must be absolute, contain no .. segments, and be under NAS_DOCKER_DIR. */
    function validateRestrictedPath(filepath: string): void {
      if (!filepath.startsWith("/")) {
        throw new Error("Path must be absolute");
      }
      if (filepath.split("/").some((p) => p === "..")) {
        throw new Error("Path traversal not allowed");
      }
      const base = NAS_DOCKER_DIR.replace(/\/$/, "");
      if (!filepath.startsWith(base + "/")) {
        throw new Error(`Path must be within ${NAS_DOCKER_DIR}`);
      }
    }
  • src/index.ts:111-191 (registration)
    Tool registration via ListToolsRequestSchema handler. Lists 'synology_read_file' among other tools as part of the available tool set.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: "synology_docker_ps",
            description: "List all docker containers on the Synology NAS",
            inputSchema: {
              type: "object",
              properties: {},
            },
          },
          {
            name: "synology_docker_logs",
            description: "Get logs for a specific docker container",
            inputSchema: {
              type: "object",
              properties: {
                container_name: { type: "string", description: "Name or ID of the container" },
                tail: { type: "number", description: "Number of lines to show from the end of the logs", default: 100 },
              },
              required: ["container_name"],
            },
          },
          {
            name: "synology_docker_manage",
            description: "Manage container lifecycle (start, stop, restart)",
            inputSchema: {
              type: "object",
              properties: {
                action: { type: "string", enum: ["start", "stop", "restart", "rm"], description: "Action to perform" },
                container_name: { type: "string", description: "Name or ID of the container" },
              },
              required: ["action", "container_name"],
            },
          },
          {
            name: "synology_project_list",
            description: "List docker-compose projects in the Synology NAS docker directory",
            inputSchema: {
              type: "object",
              properties: {},
            },
          },
          {
            name: "synology_project_manage",
            description: "Manage a docker-compose project (up, down, restart)",
            inputSchema: {
              type: "object",
              properties: {
                project_name: { type: "string", description: "Name of the project folder in NAS_DOCKER_DIR" },
                action: { type: "string", enum: ["up -d", "down", "restart", "pull"], description: "Docker compose action" },
              },
              required: ["project_name", "action"],
            },
          },
          {
            name: "synology_read_file",
            description: `Read a configuration file from the NAS (restricted to ${NAS_DOCKER_DIR})`,
            inputSchema: {
              type: "object",
              properties: {
                filepath: { type: "string", description: `Absolute path to the file on the NAS (must be within ${NAS_DOCKER_DIR})` },
              },
              required: ["filepath"],
            },
          },
          {
            name: "synology_write_file",
            description: `Write or update a configuration file on the NAS (restricted to ${NAS_DOCKER_DIR})`,
            inputSchema: {
              type: "object",
              properties: {
                filepath: { type: "string", description: `Absolute path to the file on the NAS (must be within ${NAS_DOCKER_DIR})` },
                content: { type: "string", description: "File content to write" },
              },
              required: ["filepath", "content"],
            },
          },
        ],
      };
    });
Behavior2/5

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

No annotations are provided, so the description has the full burden. It only reveals the path restriction but omits other behaviors like what happens if the file is missing or permissions issues.

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

Conciseness4/5

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

The description is a single concise sentence that conveys the essential constraint. It is front-loaded and efficient, though could add slightly more detail without becoming verbose.

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

Completeness3/5

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

For a simple one-parameter tool with no output schema, the description is adequate but lacks details on return type or error conditions. Given the simplicity, it meets a minimum viable completeness.

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

Parameters3/5

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

Schema description coverage is 100% and already explains the 'filepath' parameter fully. The tool description adds no additional parameter meaning beyond the schema.

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 action 'Read' and the resource 'configuration file' with an explicit restriction 'restricted to /volume1/docker'. This distinguishes it from sibling tools like synology_write_file.

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

Usage Guidelines2/5

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

The description does not provide any guidance on when to use this tool versus alternatives. No context about prerequisites, when not to use, or comparison with siblings.

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

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/hifishhe/Synology-Docker-MCP'

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