Skip to main content
Glama
hifishhe

Synology Docker MCP Server

by hifishhe

synology_project_manage

Manage Docker Compose projects on Synology NAS: start (up -d), stop (down), restart, or pull updates by specifying the project name and action.

Instructions

Manage a docker-compose project (up, down, restart)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_nameYesName of the project folder in NAS_DOCKER_DIR
actionYesDocker compose action

Implementation Reference

  • src/index.ts:155-164 (registration)
    Tool registration with inputSchema for 'synology_project_manage' - defines the tool name, description, and expects project_name (string) and action (enum: up -d, down, restart, pull) as required parameters.
    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"],
    },
  • Handler function for 'synology_project_manage' - validates the project name, checks the compose action is valid, verifies docker-compose.yml exists in the project directory, then executes docker-compose with the given action on the NAS via SSH.
    else if (name === "synology_project_manage") {
      const { project_name, action } = args as { project_name: string; action: string };
      validateProjectName(project_name);
      if (!VALID_COMPOSE_ACTIONS.has(action)) {
        throw new Error(`Invalid compose action: ${action}`);
      }
      const projectPath = `${NAS_DOCKER_DIR}/${project_name}`;
      const checkRes = await execSshCommand(`ls ${shQuote(projectPath + "/docker-compose.yml")}`);
      if (checkRes.code !== 0) {
        return { content: [{ type: "text", text: `Error: docker-compose.yml not found in ${projectPath}` }] };
      }
      const cmd = `cd ${shQuote(projectPath)} && docker-compose -p ${shQuote(project_name)} ${action}`;
      const res = await execSshCommand(cmd);
      return { content: [{ type: "text", text: `Command executed in ${projectPath}.\nExit Code: ${res.code}\nOutput:\n${res.stdout}\n${res.stderr}` }] };
    }
  • Validation helper used by the handler - validateProjectName ensures the project name matches allowed pattern (alphanumeric, underscore, hyphen).
    function validateProjectName(name: string): void {
      if (!/^[a-zA-Z0-9][a-zA-Z0-9_\-]*$/.test(name)) {
        throw new Error(`Invalid project name: ${name}`);
      }
    }
  • Set of valid docker-compose actions used by the handler.
    const VALID_COMPOSE_ACTIONS = new Set(["up -d", "down", "restart", "pull"]);
  • SSH command executor used by the handler to run commands on the Synology NAS via SSH with sudo.
    async function execSshCommand(command: string): Promise<{ stdout: string; stderr: string; code: number }> {
      return new Promise((resolve, reject) => {
        const conn = new Client();
        conn.on("ready", () => {
          // Use printf to avoid shell expansion of password contents.
          const fullCommand = `export PATH=$PATH:/usr/local/bin:/opt/bin:/bin:/usr/bin && printf '%s\\n' ${shQuote(NAS_PASSWORD!)} | sudo -S sh -c ${shQuote(command)}`;
          conn.exec(fullCommand, (err, stream) => {
            if (err) {
              conn.end();
              return reject(err);
            }
    
            let stdout = "";
            let stderr = "";
    
            stream
              .on("close", (code: number) => {
                conn.end();
                resolve({ stdout, stderr, code });
              })
              .on("data", (data: any) => {
                stdout += data;
              })
              .stderr.on("data", (data: any) => {
                stderr += data;
              });
          });
        }).on("error", (err) => {
          reject(err);
        }).connect({
          host: NAS_HOST,
          port: NAS_PORT,
          username: NAS_USER,
          password: NAS_PASSWORD,
          readyTimeout: 30000,
        });
      });
    }
Behavior3/5

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

Lacks disclosure of side effects (e.g., down destroys containers), return behavior, or potential risks. With no annotations, burden is on description, but only actions are listed.

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?

Single sentence, no fluff. Could benefit from slightly more structure, but efficient.

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

Completeness2/5

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

No output schema, and description does not explain return values or success/failure indicators. Incomplete for a management command that may produce logs or status.

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 coverage is 100%, and descriptions for parameters are provided. The description does not add extra meaning beyond the schema; actions are repeated from enum values.

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?

Clearly states verb 'Manage' and resource 'docker-compose project', lists specific actions (up, down, restart, pull). Distinguishes from siblings like synology_docker_manage and synology_docker_ps.

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?

No guidance on when to use this tool vs alternatives such as synology_docker_manage or synology_docker_ps. Does not specify prerequisites or context.

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