docker_mcp 0.2.0 → 0.2.5
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.
- checksums.yaml +4 -4
- data/exe/docker_mcp +0 -0
- data/lib/docker_mcp/create_container.rb +15 -12
- data/lib/docker_mcp/exec_container.rb +10 -7
- data/lib/docker_mcp/run_container.rb +12 -9
- data/lib/docker_mcp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efb62c57572aa0d7838b21fb503cc82d4d29b1b7a4b67a56a73403abf95569cd
|
4
|
+
data.tar.gz: 659cee10a2d4bb77b2a4dabe5acf47c63415e17e67b34f3046eb5bbb149ca9a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f24eb8a997aa33b2a4389170fd3d938d9ac0e00fec6f437074497ddfc260d81a8390b61b883caf35901d19f34af271b1d8d32f3b5ff24ca51dea9c885cb9e7c7
|
7
|
+
data.tar.gz: 68672e9b0c1432fa2575aea0034d4d4d74e872d83da97456d2fc0cc698249fd643d9325cfc9ed25223f3832b980926212fc98d228d135a10180c7cdd8ea8e0d5
|
data/exe/docker_mcp
CHANGED
File without changes
|
@@ -47,7 +47,7 @@ module DockerMCP
|
|
47
47
|
# server_context: context,
|
48
48
|
# image: "postgres:13",
|
49
49
|
# name: "database",
|
50
|
-
# env:
|
50
|
+
# env: "POSTGRES_PASSWORD=secret,POSTGRES_DB=myapp",
|
51
51
|
# exposed_ports: {"5432/tcp" => {}},
|
52
52
|
# host_config: {
|
53
53
|
# "PortBindings" => {"5432/tcp" => [{"HostPort" => "5432"}]},
|
@@ -73,14 +73,12 @@ module DockerMCP
|
|
73
73
|
description: 'Container name (optional)'
|
74
74
|
},
|
75
75
|
cmd: {
|
76
|
-
type: '
|
77
|
-
|
78
|
-
description: 'Command to run (optional)'
|
76
|
+
type: 'string',
|
77
|
+
description: 'Command to run as space-separated string (optional, e.g., "npm start" or "python app.py")'
|
79
78
|
},
|
80
79
|
env: {
|
81
|
-
type: '
|
82
|
-
|
83
|
-
description: 'Environment variables as KEY=VALUE (optional)'
|
80
|
+
type: 'string',
|
81
|
+
description: 'Environment variables as comma-separated KEY=VALUE pairs (optional)'
|
84
82
|
},
|
85
83
|
exposed_ports: {
|
86
84
|
type: 'object',
|
@@ -104,8 +102,8 @@ module DockerMCP
|
|
104
102
|
# @param image [String] Docker image name with optional tag (e.g., "nginx:latest")
|
105
103
|
# @param server_context [Object] MCP server context (unused but required)
|
106
104
|
# @param name [String, nil] custom name for the container
|
107
|
-
# @param cmd [
|
108
|
-
# @param env [
|
105
|
+
# @param cmd [String, nil] command to execute as space-separated string
|
106
|
+
# @param env [String, nil] environment variables as comma-separated KEY=VALUE pairs
|
109
107
|
# @param exposed_ports [Hash, nil] ports to expose in {"port/protocol" => {}} format
|
110
108
|
# @param host_config [Hash, nil] Docker host configuration including bindings and volumes
|
111
109
|
#
|
@@ -127,7 +125,7 @@ module DockerMCP
|
|
127
125
|
# server_context: context,
|
128
126
|
# image: "redis:7-alpine",
|
129
127
|
# name: "redis-cache",
|
130
|
-
# env:
|
128
|
+
# env: "REDIS_PASSWORD=secret,REDIS_PORT=6379",
|
131
129
|
# exposed_ports: {"6379/tcp" => {}},
|
132
130
|
# host_config: {
|
133
131
|
# "PortBindings" => {"6379/tcp" => [{"HostPort" => "6379"}]},
|
@@ -139,8 +137,13 @@ module DockerMCP
|
|
139
137
|
def self.call(image:, server_context:, name: nil, cmd: nil, env: nil, exposed_ports: nil, host_config: nil)
|
140
138
|
config = { 'Image' => image }
|
141
139
|
config['name'] = name if name
|
142
|
-
|
143
|
-
|
140
|
+
|
141
|
+
# Parse cmd string into array if provided
|
142
|
+
config['Cmd'] = Shellwords.split(cmd) if cmd && !cmd.strip.empty?
|
143
|
+
|
144
|
+
# Parse env string into array if provided
|
145
|
+
config['Env'] = env.split(',').map(&:strip) if env && !env.strip.empty?
|
146
|
+
|
144
147
|
config['ExposedPorts'] = exposed_ports if exposed_ports
|
145
148
|
config['HostConfig'] = host_config if host_config
|
146
149
|
|
@@ -50,7 +50,7 @@ module DockerMCP
|
|
50
50
|
# cmd: "python manage.py migrate",
|
51
51
|
# working_dir: "/app",
|
52
52
|
# user: "appuser",
|
53
|
-
# env:
|
53
|
+
# env: "DJANGO_ENV=production,DEBUG=false",
|
54
54
|
# timeout: 120
|
55
55
|
# )
|
56
56
|
#
|
@@ -80,9 +80,8 @@ module DockerMCP
|
|
80
80
|
description: 'User to run the command as (optional, e.g., "1000" or "username")'
|
81
81
|
},
|
82
82
|
env: {
|
83
|
-
type: '
|
84
|
-
|
85
|
-
description: 'Environment variables as KEY=VALUE (optional)'
|
83
|
+
type: 'string',
|
84
|
+
description: 'Environment variables as comma-separated KEY=VALUE pairs (optional)'
|
86
85
|
},
|
87
86
|
stdin: {
|
88
87
|
type: 'string',
|
@@ -111,7 +110,7 @@ module DockerMCP
|
|
111
110
|
# @param server_context [Object] MCP server context (unused but required)
|
112
111
|
# @param working_dir [String, nil] working directory for command execution
|
113
112
|
# @param user [String, nil] user to run command as (username or UID)
|
114
|
-
# @param env [
|
113
|
+
# @param env [String, nil] environment variables as comma-separated KEY=VALUE pairs
|
115
114
|
# @param stdin [String, nil] input to send to command via stdin
|
116
115
|
# @param timeout [Integer] maximum execution time in seconds (default: 60)
|
117
116
|
#
|
@@ -135,7 +134,7 @@ module DockerMCP
|
|
135
134
|
# cmd: "bundle exec rails console",
|
136
135
|
# working_dir: "/app",
|
137
136
|
# user: "rails",
|
138
|
-
# env:
|
137
|
+
# env: "RAILS_ENV=production,DEBUG=true",
|
139
138
|
# timeout: 300
|
140
139
|
# )
|
141
140
|
#
|
@@ -149,6 +148,10 @@ module DockerMCP
|
|
149
148
|
|
150
149
|
cmd_array = Shellwords.split(cmd)
|
151
150
|
|
151
|
+
# Parse environment variables from comma-separated string to array
|
152
|
+
env_array = nil
|
153
|
+
env_array = env.split(',').map(&:strip) if env && !env.empty?
|
154
|
+
|
152
155
|
# Build exec options
|
153
156
|
exec_options = {
|
154
157
|
'Cmd' => cmd_array,
|
@@ -157,7 +160,7 @@ module DockerMCP
|
|
157
160
|
}
|
158
161
|
exec_options['WorkingDir'] = working_dir if working_dir
|
159
162
|
exec_options['User'] = user if user
|
160
|
-
exec_options['Env'] =
|
163
|
+
exec_options['Env'] = env_array if env_array
|
161
164
|
exec_options['AttachStdin'] = true if stdin
|
162
165
|
|
163
166
|
# Execute the command
|
@@ -47,7 +47,7 @@ module DockerMCP
|
|
47
47
|
# server_context: context,
|
48
48
|
# image: "postgres:13",
|
49
49
|
# name: "database",
|
50
|
-
# env:
|
50
|
+
# env: "POSTGRES_PASSWORD=secret,POSTGRES_DB=myapp",
|
51
51
|
# host_config: {
|
52
52
|
# "PortBindings" => {"5432/tcp" => [{"HostPort" => "5432"}]},
|
53
53
|
# "Binds" => ["/host/data:/var/lib/postgresql/data"]
|
@@ -72,14 +72,12 @@ module DockerMCP
|
|
72
72
|
description: 'Container name (optional)'
|
73
73
|
},
|
74
74
|
cmd: {
|
75
|
-
type: '
|
76
|
-
|
77
|
-
description: 'Command to run (optional)'
|
75
|
+
type: 'string',
|
76
|
+
description: 'Command to run as space-separated string (optional, e.g., "npm start" or "python app.py")'
|
78
77
|
},
|
79
78
|
env: {
|
80
|
-
type: '
|
81
|
-
|
82
|
-
description: 'Environment variables as KEY=VALUE (optional)'
|
79
|
+
type: 'string',
|
80
|
+
description: 'Environment variables as comma-separated KEY=VALUE pairs (optional)'
|
83
81
|
},
|
84
82
|
exposed_ports: {
|
85
83
|
type: 'object',
|
@@ -96,8 +94,13 @@ module DockerMCP
|
|
96
94
|
def self.call(image:, server_context:, name: nil, cmd: nil, env: nil, exposed_ports: nil, host_config: nil)
|
97
95
|
config = { 'Image' => image }
|
98
96
|
config['name'] = name if name
|
99
|
-
|
100
|
-
|
97
|
+
|
98
|
+
# Parse cmd string into array if provided
|
99
|
+
config['Cmd'] = Shellwords.split(cmd) if cmd && !cmd.strip.empty?
|
100
|
+
|
101
|
+
# Parse env string into array if provided
|
102
|
+
config['Env'] = env.split(',').map(&:strip) if env && !env.strip.empty?
|
103
|
+
|
101
104
|
config['ExposedPorts'] = exposed_ports if exposed_ports
|
102
105
|
config['HostConfig'] = host_config if host_config
|
103
106
|
|
data/lib/docker_mcp/version.rb
CHANGED