container-manager-mcp 0.0.2__tar.gz
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.
- container_manager_mcp-0.0.2/LICENSE +20 -0
- container_manager_mcp-0.0.2/MANIFEST.in +1 -0
- container_manager_mcp-0.0.2/PKG-INFO +248 -0
- container_manager_mcp-0.0.2/README.md +220 -0
- container_manager_mcp-0.0.2/container_manager_mcp/__init__.py +24 -0
- container_manager_mcp-0.0.2/container_manager_mcp/container_manager.py +1381 -0
- container_manager_mcp-0.0.2/container_manager_mcp/container_manager_mcp.py +1134 -0
- container_manager_mcp-0.0.2/container_manager_mcp.egg-info/PKG-INFO +248 -0
- container_manager_mcp-0.0.2/container_manager_mcp.egg-info/SOURCES.txt +14 -0
- container_manager_mcp-0.0.2/container_manager_mcp.egg-info/dependency_links.txt +1 -0
- container_manager_mcp-0.0.2/container_manager_mcp.egg-info/entry_points.txt +3 -0
- container_manager_mcp-0.0.2/container_manager_mcp.egg-info/requires.txt +15 -0
- container_manager_mcp-0.0.2/container_manager_mcp.egg-info/top_level.txt +2 -0
- container_manager_mcp-0.0.2/pyproject.toml +49 -0
- container_manager_mcp-0.0.2/requirements.txt +2 -0
- container_manager_mcp-0.0.2/setup.cfg +4 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012-2023 Audel Rouhi
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1 @@
|
|
1
|
+
include README.md include requirements.txt recursive-include container_manager_mcp *.py
|
@@ -0,0 +1,248 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: container-manager-mcp
|
3
|
+
Version: 0.0.2
|
4
|
+
Summary: Container Manager manage Docker, Docker Swarm, and Podman containers as an MCP Server
|
5
|
+
Author-email: Audel Rouhi <knucklessg1@gmail.com>
|
6
|
+
License: MIT
|
7
|
+
Classifier: Development Status :: 5 - Production/Stable
|
8
|
+
Classifier: License :: Public Domain
|
9
|
+
Classifier: Environment :: Console
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
12
|
+
Requires-Python: >=3.8
|
13
|
+
Description-Content-Type: text/markdown
|
14
|
+
License-File: LICENSE
|
15
|
+
Requires-Dist: requests>=2.28.1
|
16
|
+
Requires-Dist: fastmcp>=2.11.3
|
17
|
+
Requires-Dist: podman>=5.6.0
|
18
|
+
Provides-Extra: podman
|
19
|
+
Requires-Dist: podman>=5.6.0; extra == "podman"
|
20
|
+
Provides-Extra: docker
|
21
|
+
Requires-Dist: docker>=7.1.0; extra == "docker"
|
22
|
+
Provides-Extra: all
|
23
|
+
Requires-Dist: requests>=2.28.1; extra == "all"
|
24
|
+
Requires-Dist: fastmcp>=2.11.3; extra == "all"
|
25
|
+
Requires-Dist: docker>=7.1.0; extra == "all"
|
26
|
+
Requires-Dist: podman>=5.6.0; extra == "all"
|
27
|
+
Dynamic: license-file
|
28
|
+
|
29
|
+
# Container Manager MCP Server
|
30
|
+
|
31
|
+

|
32
|
+

|
33
|
+

|
34
|
+

|
35
|
+

|
36
|
+

|
37
|
+

|
38
|
+
|
39
|
+

|
40
|
+

|
41
|
+

|
42
|
+

|
43
|
+
|
44
|
+

|
45
|
+

|
46
|
+

|
47
|
+

|
48
|
+

|
49
|
+

|
50
|
+
|
51
|
+
*Version: 0.0.2*
|
52
|
+
|
53
|
+
Container Manager MCP Server provides a robust interface to manage Docker and Podman containers, networks, volumes, and Docker Swarm services through a FastMCP server, enabling programmatic and remote container management.
|
54
|
+
|
55
|
+
This repository is actively maintained - Contributions are welcome!
|
56
|
+
|
57
|
+
## Features
|
58
|
+
|
59
|
+
- Manage Docker and Podman containers, images, volumes, and networks
|
60
|
+
- Support for Docker Swarm operations
|
61
|
+
- Support for Docker Compose and Podman Compose operations
|
62
|
+
- FastMCP server for remote API access
|
63
|
+
- Comprehensive logging and error handling
|
64
|
+
- Extensible architecture for additional container runtimes
|
65
|
+
|
66
|
+
<details>
|
67
|
+
<summary><b>Usage:</b></summary>
|
68
|
+
|
69
|
+
| Short Flag | Long Flag | Description |
|
70
|
+
|------------|----------------|-----------------------------------------------|
|
71
|
+
| -h | --help | Display help information |
|
72
|
+
| -t | --transport | Transport method (stdio or http, default: stdio) |
|
73
|
+
| -h | --host | Host address for HTTP transport (default: 0.0.0.0) |
|
74
|
+
| -p | --port | Port for HTTP transport (default: 8000) |
|
75
|
+
|
76
|
+
### Available MCP Tools
|
77
|
+
- `get_version`: Retrieve version information of the container runtime
|
78
|
+
- `get_info`: Get system information about the container runtime
|
79
|
+
- `list_images`: List all available images
|
80
|
+
- `pull_image`: Pull an image from a registry
|
81
|
+
- `remove_image`: Remove an image
|
82
|
+
- `list_containers`: List running or all containers
|
83
|
+
- `run_container`: Run a new container
|
84
|
+
- `stop_container`: Stop a running container
|
85
|
+
- `remove_container`: Remove a container
|
86
|
+
- `get_container_logs`: Retrieve logs from a container
|
87
|
+
- `exec_in_container`: Execute a command in a container
|
88
|
+
- `list_volumes`: List all volumes
|
89
|
+
- `create_volume`: Create a new volume
|
90
|
+
- `remove_volume`: Remove a volume
|
91
|
+
- `list_networks`: List all networks
|
92
|
+
- `create_network`: Create a new network
|
93
|
+
- `remove_network`: Remove a network
|
94
|
+
- `compose_up`: Start services defined in a Compose file
|
95
|
+
- `compose_down`: Stop and remove services defined in a Compose file
|
96
|
+
- `compose_ps`: List containers for a Compose project
|
97
|
+
- `compose_logs`: View logs for a Compose project or specific service
|
98
|
+
- `init_swarm`: Initialize a Docker Swarm
|
99
|
+
- `leave_swarm`: Leave a Docker Swarm
|
100
|
+
- `list_nodes`: List nodes in a Docker Swarm
|
101
|
+
- `list_services`: List services in a Docker Swarm
|
102
|
+
- `create_service`: Create a new service in a Docker Swarm
|
103
|
+
- `remove_service`: Remove a service from a Docker Swarm
|
104
|
+
|
105
|
+
</details>
|
106
|
+
|
107
|
+
<details>
|
108
|
+
<summary><b>Example:</b></summary>
|
109
|
+
|
110
|
+
## Use with AI
|
111
|
+
|
112
|
+
Configure `mcp.json`
|
113
|
+
|
114
|
+
```json
|
115
|
+
{
|
116
|
+
"mcpServers": {
|
117
|
+
"container_manager": {
|
118
|
+
"command": "uv",
|
119
|
+
"args": [
|
120
|
+
"run",
|
121
|
+
"--with",
|
122
|
+
"container-manager-mcp",
|
123
|
+
"container-manager-mcp"
|
124
|
+
],
|
125
|
+
"env": {
|
126
|
+
"SILENT": "False",
|
127
|
+
"LOG_FILE": "~/Documents/container_manager_mcp.log"
|
128
|
+
},
|
129
|
+
"timeout": 200000
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
```
|
134
|
+
|
135
|
+
### Deploy MCP Server as a container
|
136
|
+
```bash
|
137
|
+
docker pull knucklessg1/container-manager:latest
|
138
|
+
```
|
139
|
+
|
140
|
+
Modify the `compose.yml`
|
141
|
+
|
142
|
+
```compose
|
143
|
+
services:
|
144
|
+
container-manager-mcp:
|
145
|
+
image: knucklessg1/container-manager:latest
|
146
|
+
environment:
|
147
|
+
- HOST=0.0.0.0
|
148
|
+
- PORT=8015
|
149
|
+
ports:
|
150
|
+
- 8015:8015
|
151
|
+
```
|
152
|
+
|
153
|
+
</details>
|
154
|
+
|
155
|
+
<details>
|
156
|
+
<summary><b>Installation Instructions:</b></summary>
|
157
|
+
|
158
|
+
### Install Python Package
|
159
|
+
|
160
|
+
```bash
|
161
|
+
python -m pip install container-manager-mcp
|
162
|
+
```
|
163
|
+
|
164
|
+
or
|
165
|
+
|
166
|
+
```bash
|
167
|
+
uv pip install --upgrade container-manager-mcp
|
168
|
+
```
|
169
|
+
|
170
|
+
## Test Server
|
171
|
+
|
172
|
+
```bash
|
173
|
+
container-manager-mcp --transport http --host 127.0.0.1 --port 8080
|
174
|
+
```
|
175
|
+
|
176
|
+
This starts the MCP server using HTTP transport on localhost port 8080.
|
177
|
+
|
178
|
+
To interact with the MCP server programmatically, you can use a FastMCP client or make HTTP requests to the exposed endpoints. Example using curl to pull an image:
|
179
|
+
|
180
|
+
```bash
|
181
|
+
curl -X POST http://127.0.0.1:8080/pull_image \
|
182
|
+
-H "Content-Type: application/json" \
|
183
|
+
-d '{"image": "nginx", "tag": "latest", "manager_type": "docker"}'
|
184
|
+
```
|
185
|
+
|
186
|
+
</details>
|
187
|
+
|
188
|
+
<details>
|
189
|
+
<summary><b>Installation Instructions:</b></summary>
|
190
|
+
|
191
|
+
Install the Python package:
|
192
|
+
|
193
|
+
```bash
|
194
|
+
python -m pip install container-manager-mcp
|
195
|
+
```
|
196
|
+
|
197
|
+
### Dependencies
|
198
|
+
- Python 3.7+
|
199
|
+
- `fastmcp` for MCP server functionality
|
200
|
+
- `docker` for Docker support
|
201
|
+
- `podman` for Podman support
|
202
|
+
- `pydantic` for data validation
|
203
|
+
|
204
|
+
Install dependencies:
|
205
|
+
|
206
|
+
```bash
|
207
|
+
python -m pip install fastmcp docker podman pydantic
|
208
|
+
```
|
209
|
+
|
210
|
+
Ensure Docker or Podman is installed and running on your system.
|
211
|
+
|
212
|
+
</details>
|
213
|
+
|
214
|
+
|
215
|
+
<details>
|
216
|
+
<summary><b>Development and Contribution:</b></summary>
|
217
|
+
|
218
|
+
## Development and Contribution
|
219
|
+
|
220
|
+
Contributions are welcome! To contribute:
|
221
|
+
|
222
|
+
1. Fork the repository
|
223
|
+
2. Create a feature branch (`git checkout -b feature/your-feature`)
|
224
|
+
3. Commit your changes (`git commit -am 'Add your feature'`)
|
225
|
+
4. Push to the branch (`git push origin feature/your-feature`)
|
226
|
+
5. Create a new Pull Request
|
227
|
+
|
228
|
+
Please ensure your code follows the project's coding standards and includes appropriate tests.
|
229
|
+
|
230
|
+
</details>
|
231
|
+
|
232
|
+
<details>
|
233
|
+
<summary><b>License:</b></summary>
|
234
|
+
|
235
|
+
## License
|
236
|
+
|
237
|
+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Knuckles-Team/container-manager-mcp/blob/main/LICENSE) file for details.
|
238
|
+
|
239
|
+
</details>
|
240
|
+
<details>
|
241
|
+
<summary><b>Repository Owners:</b></summary>
|
242
|
+
|
243
|
+
<img width="100%" height="180em" src="https://github-readme-stats.vercel.app/api?username=Knucklessg1&show_icons=true&hide_border=true&&count_private=true&include_all_commits=true" />
|
244
|
+
|
245
|
+

|
246
|
+

|
247
|
+
|
248
|
+
</details>
|
@@ -0,0 +1,220 @@
|
|
1
|
+
# Container Manager MCP Server
|
2
|
+
|
3
|
+

|
4
|
+

|
5
|
+

|
6
|
+

|
7
|
+

|
8
|
+

|
9
|
+

|
10
|
+
|
11
|
+

|
12
|
+

|
13
|
+

|
14
|
+

|
15
|
+
|
16
|
+

|
17
|
+

|
18
|
+

|
19
|
+

|
20
|
+

|
21
|
+

|
22
|
+
|
23
|
+
*Version: 0.0.2*
|
24
|
+
|
25
|
+
Container Manager MCP Server provides a robust interface to manage Docker and Podman containers, networks, volumes, and Docker Swarm services through a FastMCP server, enabling programmatic and remote container management.
|
26
|
+
|
27
|
+
This repository is actively maintained - Contributions are welcome!
|
28
|
+
|
29
|
+
## Features
|
30
|
+
|
31
|
+
- Manage Docker and Podman containers, images, volumes, and networks
|
32
|
+
- Support for Docker Swarm operations
|
33
|
+
- Support for Docker Compose and Podman Compose operations
|
34
|
+
- FastMCP server for remote API access
|
35
|
+
- Comprehensive logging and error handling
|
36
|
+
- Extensible architecture for additional container runtimes
|
37
|
+
|
38
|
+
<details>
|
39
|
+
<summary><b>Usage:</b></summary>
|
40
|
+
|
41
|
+
| Short Flag | Long Flag | Description |
|
42
|
+
|------------|----------------|-----------------------------------------------|
|
43
|
+
| -h | --help | Display help information |
|
44
|
+
| -t | --transport | Transport method (stdio or http, default: stdio) |
|
45
|
+
| -h | --host | Host address for HTTP transport (default: 0.0.0.0) |
|
46
|
+
| -p | --port | Port for HTTP transport (default: 8000) |
|
47
|
+
|
48
|
+
### Available MCP Tools
|
49
|
+
- `get_version`: Retrieve version information of the container runtime
|
50
|
+
- `get_info`: Get system information about the container runtime
|
51
|
+
- `list_images`: List all available images
|
52
|
+
- `pull_image`: Pull an image from a registry
|
53
|
+
- `remove_image`: Remove an image
|
54
|
+
- `list_containers`: List running or all containers
|
55
|
+
- `run_container`: Run a new container
|
56
|
+
- `stop_container`: Stop a running container
|
57
|
+
- `remove_container`: Remove a container
|
58
|
+
- `get_container_logs`: Retrieve logs from a container
|
59
|
+
- `exec_in_container`: Execute a command in a container
|
60
|
+
- `list_volumes`: List all volumes
|
61
|
+
- `create_volume`: Create a new volume
|
62
|
+
- `remove_volume`: Remove a volume
|
63
|
+
- `list_networks`: List all networks
|
64
|
+
- `create_network`: Create a new network
|
65
|
+
- `remove_network`: Remove a network
|
66
|
+
- `compose_up`: Start services defined in a Compose file
|
67
|
+
- `compose_down`: Stop and remove services defined in a Compose file
|
68
|
+
- `compose_ps`: List containers for a Compose project
|
69
|
+
- `compose_logs`: View logs for a Compose project or specific service
|
70
|
+
- `init_swarm`: Initialize a Docker Swarm
|
71
|
+
- `leave_swarm`: Leave a Docker Swarm
|
72
|
+
- `list_nodes`: List nodes in a Docker Swarm
|
73
|
+
- `list_services`: List services in a Docker Swarm
|
74
|
+
- `create_service`: Create a new service in a Docker Swarm
|
75
|
+
- `remove_service`: Remove a service from a Docker Swarm
|
76
|
+
|
77
|
+
</details>
|
78
|
+
|
79
|
+
<details>
|
80
|
+
<summary><b>Example:</b></summary>
|
81
|
+
|
82
|
+
## Use with AI
|
83
|
+
|
84
|
+
Configure `mcp.json`
|
85
|
+
|
86
|
+
```json
|
87
|
+
{
|
88
|
+
"mcpServers": {
|
89
|
+
"container_manager": {
|
90
|
+
"command": "uv",
|
91
|
+
"args": [
|
92
|
+
"run",
|
93
|
+
"--with",
|
94
|
+
"container-manager-mcp",
|
95
|
+
"container-manager-mcp"
|
96
|
+
],
|
97
|
+
"env": {
|
98
|
+
"SILENT": "False",
|
99
|
+
"LOG_FILE": "~/Documents/container_manager_mcp.log"
|
100
|
+
},
|
101
|
+
"timeout": 200000
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
```
|
106
|
+
|
107
|
+
### Deploy MCP Server as a container
|
108
|
+
```bash
|
109
|
+
docker pull knucklessg1/container-manager:latest
|
110
|
+
```
|
111
|
+
|
112
|
+
Modify the `compose.yml`
|
113
|
+
|
114
|
+
```compose
|
115
|
+
services:
|
116
|
+
container-manager-mcp:
|
117
|
+
image: knucklessg1/container-manager:latest
|
118
|
+
environment:
|
119
|
+
- HOST=0.0.0.0
|
120
|
+
- PORT=8015
|
121
|
+
ports:
|
122
|
+
- 8015:8015
|
123
|
+
```
|
124
|
+
|
125
|
+
</details>
|
126
|
+
|
127
|
+
<details>
|
128
|
+
<summary><b>Installation Instructions:</b></summary>
|
129
|
+
|
130
|
+
### Install Python Package
|
131
|
+
|
132
|
+
```bash
|
133
|
+
python -m pip install container-manager-mcp
|
134
|
+
```
|
135
|
+
|
136
|
+
or
|
137
|
+
|
138
|
+
```bash
|
139
|
+
uv pip install --upgrade container-manager-mcp
|
140
|
+
```
|
141
|
+
|
142
|
+
## Test Server
|
143
|
+
|
144
|
+
```bash
|
145
|
+
container-manager-mcp --transport http --host 127.0.0.1 --port 8080
|
146
|
+
```
|
147
|
+
|
148
|
+
This starts the MCP server using HTTP transport on localhost port 8080.
|
149
|
+
|
150
|
+
To interact with the MCP server programmatically, you can use a FastMCP client or make HTTP requests to the exposed endpoints. Example using curl to pull an image:
|
151
|
+
|
152
|
+
```bash
|
153
|
+
curl -X POST http://127.0.0.1:8080/pull_image \
|
154
|
+
-H "Content-Type: application/json" \
|
155
|
+
-d '{"image": "nginx", "tag": "latest", "manager_type": "docker"}'
|
156
|
+
```
|
157
|
+
|
158
|
+
</details>
|
159
|
+
|
160
|
+
<details>
|
161
|
+
<summary><b>Installation Instructions:</b></summary>
|
162
|
+
|
163
|
+
Install the Python package:
|
164
|
+
|
165
|
+
```bash
|
166
|
+
python -m pip install container-manager-mcp
|
167
|
+
```
|
168
|
+
|
169
|
+
### Dependencies
|
170
|
+
- Python 3.7+
|
171
|
+
- `fastmcp` for MCP server functionality
|
172
|
+
- `docker` for Docker support
|
173
|
+
- `podman` for Podman support
|
174
|
+
- `pydantic` for data validation
|
175
|
+
|
176
|
+
Install dependencies:
|
177
|
+
|
178
|
+
```bash
|
179
|
+
python -m pip install fastmcp docker podman pydantic
|
180
|
+
```
|
181
|
+
|
182
|
+
Ensure Docker or Podman is installed and running on your system.
|
183
|
+
|
184
|
+
</details>
|
185
|
+
|
186
|
+
|
187
|
+
<details>
|
188
|
+
<summary><b>Development and Contribution:</b></summary>
|
189
|
+
|
190
|
+
## Development and Contribution
|
191
|
+
|
192
|
+
Contributions are welcome! To contribute:
|
193
|
+
|
194
|
+
1. Fork the repository
|
195
|
+
2. Create a feature branch (`git checkout -b feature/your-feature`)
|
196
|
+
3. Commit your changes (`git commit -am 'Add your feature'`)
|
197
|
+
4. Push to the branch (`git push origin feature/your-feature`)
|
198
|
+
5. Create a new Pull Request
|
199
|
+
|
200
|
+
Please ensure your code follows the project's coding standards and includes appropriate tests.
|
201
|
+
|
202
|
+
</details>
|
203
|
+
|
204
|
+
<details>
|
205
|
+
<summary><b>License:</b></summary>
|
206
|
+
|
207
|
+
## License
|
208
|
+
|
209
|
+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Knuckles-Team/container-manager-mcp/blob/main/LICENSE) file for details.
|
210
|
+
|
211
|
+
</details>
|
212
|
+
<details>
|
213
|
+
<summary><b>Repository Owners:</b></summary>
|
214
|
+
|
215
|
+
<img width="100%" height="180em" src="https://github-readme-stats.vercel.app/api?username=Knucklessg1&show_icons=true&hide_border=true&&count_private=true&include_all_commits=true" />
|
216
|
+
|
217
|
+

|
218
|
+

|
219
|
+
|
220
|
+
</details>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
from container_manager.container_manager import (
|
5
|
+
main,
|
6
|
+
ContainerManagerBase,
|
7
|
+
DockerManager,
|
8
|
+
PodmanManager,
|
9
|
+
)
|
10
|
+
from container_manager.container_manager_mcp import container_manager_mcp
|
11
|
+
|
12
|
+
"""
|
13
|
+
container-manager
|
14
|
+
|
15
|
+
Manage your containers using docker, podman, compose, or docker swarm!
|
16
|
+
"""
|
17
|
+
|
18
|
+
__all__ = [
|
19
|
+
"main",
|
20
|
+
"container_manager_mcp",
|
21
|
+
"ContainerManagerBase",
|
22
|
+
"DockerManager",
|
23
|
+
"PodmanManager",
|
24
|
+
]
|