@supernova123/docker-mcp-server 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tools/compose.js +1 -1
- package/dist/tools/container.js +1 -1
- package/dist/tools/logs.js +1 -1
- package/package.json +1 -1
- package/src/tools/compose.ts +2 -1
- package/src/tools/container.ts +2 -1
- package/src/tools/logs.ts +2 -1
- package/tests/container.test.ts +3 -1
package/dist/tools/compose.js
CHANGED
|
@@ -84,7 +84,7 @@ export function registerComposeTools(server) {
|
|
|
84
84
|
return { content: [{ type: "text", text: `Error: ${formatError(error)}` }], isError: true };
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
|
-
server.tool("compose_logs", "Tail logs from Docker Compose
|
|
87
|
+
server.tool("compose_logs", "Tail logs from one or more services in a Docker Compose stack defined by docker-compose.yml at path. Use this for multi-service log inspection; for single-container logs use stream_logs instead. The services filter limits output to named services; tail controls how many recent lines to return (default 100); follow=true streams new lines until cancelled. Returns UTF-8 log text with stream headers stripped, or 'No logs found.' when the stack has not produced output. Read-only and safe to call repeatedly. Returns an error string if path does not resolve to a Compose project.", ComposeLogsSchema.shape, { readOnlyHint: true, idempotentHint: true, openWorldHint: false }, async (params) => {
|
|
88
88
|
try {
|
|
89
89
|
const args = ["logs", "--tail", String(params.tail ?? 100)];
|
|
90
90
|
if (params.follow)
|
package/dist/tools/container.js
CHANGED
|
@@ -52,7 +52,7 @@ export function registerContainerTools(server, docker) {
|
|
|
52
52
|
return { content: [{ type: "text", text: `Error: ${formatError(error)}` }], isError: true };
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
-
server.tool("restart_container", "Restart a Docker container by ID or name with optional timeout.", RestartContainerSchema.shape, async (params) => {
|
|
55
|
+
server.tool("restart_container", "Restart a Docker container by ID or name with optional timeout. This tears down the running process and starts a new one — use stop_container for a graceful shutdown or remove_container to delete entirely. The timeout parameter (default 10s) controls how long to wait before force-killing. Returns a confirmation string on success. Idempotent: restarting an already-stopped container starts it again. Returns an error string if the container does not exist or is not running.", RestartContainerSchema.shape, { destructiveHint: true, idempotentHint: true, openWorldHint: false }, async (params) => {
|
|
56
56
|
try {
|
|
57
57
|
const container = docker.getContainer(params.container_id);
|
|
58
58
|
await container.restart({ t: params.timeout ?? 10 });
|
package/dist/tools/logs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StreamLogsSchema, ContainerStatsSchema } from "../types.js";
|
|
2
2
|
import { formatError, formatBytes } from "../docker.js";
|
|
3
3
|
export function registerLogsTools(server, docker) {
|
|
4
|
-
server.tool("stream_logs", "Get logs from a Docker container. Supports tail count, timestamp filtering, and follow mode.", StreamLogsSchema.shape, async (params) => {
|
|
4
|
+
server.tool("stream_logs", "Get logs from a single Docker container by ID or name. Use stream_logs for one container; use compose_logs for multi-service Compose stacks. Supports tail count (default 100 lines), since timestamp for filtering, and follow mode. Returns UTF-8 log text with multiplexed stream headers stripped, or 'No logs found.' when the container has no output. Read-only and safe to call repeatedly. Returns an error string if the container does not exist.", StreamLogsSchema.shape, { readOnlyHint: true, idempotentHint: true, openWorldHint: false }, async (params) => {
|
|
5
5
|
try {
|
|
6
6
|
const container = docker.getContainer(params.container_id);
|
|
7
7
|
const logs = await container.logs({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supernova123/docker-mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"mcpName": "io.github.friendlygeorge/docker-mcp-server",
|
|
5
5
|
"description": "MCP server for Docker — container management, health checks, auto-restart, Compose lifecycle, and log streaming for Claude, Cursor, and AI agents",
|
|
6
6
|
"type": "module",
|
package/src/tools/compose.ts
CHANGED
|
@@ -102,8 +102,9 @@ export function registerComposeTools(server: McpServer): void {
|
|
|
102
102
|
|
|
103
103
|
server.tool(
|
|
104
104
|
"compose_logs",
|
|
105
|
-
"Tail logs from Docker Compose
|
|
105
|
+
"Tail logs from one or more services in a Docker Compose stack defined by docker-compose.yml at path. Use this for multi-service log inspection; for single-container logs use stream_logs instead. The services filter limits output to named services; tail controls how many recent lines to return (default 100); follow=true streams new lines until cancelled. Returns UTF-8 log text with stream headers stripped, or 'No logs found.' when the stack has not produced output. Read-only and safe to call repeatedly. Returns an error string if path does not resolve to a Compose project.",
|
|
106
106
|
ComposeLogsSchema.shape,
|
|
107
|
+
{ readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
107
108
|
async (params) => {
|
|
108
109
|
try {
|
|
109
110
|
const args = ["logs", "--tail", String(params.tail ?? 100)];
|
package/src/tools/container.ts
CHANGED
|
@@ -86,8 +86,9 @@ export function registerContainerTools(server: McpServer, docker: Dockerode): vo
|
|
|
86
86
|
|
|
87
87
|
server.tool(
|
|
88
88
|
"restart_container",
|
|
89
|
-
"Restart a Docker container by ID or name with optional timeout.",
|
|
89
|
+
"Restart a Docker container by ID or name with optional timeout. This tears down the running process and starts a new one — use stop_container for a graceful shutdown or remove_container to delete entirely. The timeout parameter (default 10s) controls how long to wait before force-killing. Returns a confirmation string on success. Idempotent: restarting an already-stopped container starts it again. Returns an error string if the container does not exist or is not running.",
|
|
90
90
|
RestartContainerSchema.shape,
|
|
91
|
+
{ destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
91
92
|
async (params) => {
|
|
92
93
|
try {
|
|
93
94
|
const container = docker.getContainer(params.container_id);
|
package/src/tools/logs.ts
CHANGED
|
@@ -6,8 +6,9 @@ import { formatError, formatBytes } from "../docker.js";
|
|
|
6
6
|
export function registerLogsTools(server: McpServer, docker: Dockerode): void {
|
|
7
7
|
server.tool(
|
|
8
8
|
"stream_logs",
|
|
9
|
-
"Get logs from a Docker container. Supports tail count, timestamp filtering, and follow mode.",
|
|
9
|
+
"Get logs from a single Docker container by ID or name. Use stream_logs for one container; use compose_logs for multi-service Compose stacks. Supports tail count (default 100 lines), since timestamp for filtering, and follow mode. Returns UTF-8 log text with multiplexed stream headers stripped, or 'No logs found.' when the container has no output. Read-only and safe to call repeatedly. Returns an error string if the container does not exist.",
|
|
10
10
|
StreamLogsSchema.shape,
|
|
11
|
+
{ readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
11
12
|
async (params) => {
|
|
12
13
|
try {
|
|
13
14
|
const container = docker.getContainer(params.container_id);
|
package/tests/container.test.ts
CHANGED
|
@@ -32,7 +32,9 @@ import { createDockerClient } from "../src/docker.js";
|
|
|
32
32
|
function createMockServer() {
|
|
33
33
|
const tools: Record<string, { description: string; handler: Function }> = {};
|
|
34
34
|
return {
|
|
35
|
-
tool: (name: string, description: string,
|
|
35
|
+
tool: (name: string, description: string, _schemaOrAnnotations: unknown, _annotationsOrHandler: unknown, _maybeHandler?: Function) => {
|
|
36
|
+
// Support both 4-param (name, desc, schema, handler) and 5-param (name, desc, schema, annotations, handler)
|
|
37
|
+
const handler = typeof _annotationsOrHandler === 'function' ? _annotationsOrHandler : (_maybeHandler as Function);
|
|
36
38
|
tools[name] = { description, handler };
|
|
37
39
|
},
|
|
38
40
|
tools,
|