mcp-aws-manager 0.1.1 → 0.3.0

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.
@@ -1,19 +1,49 @@
1
1
  # MCP Client Setup (stdio)
2
2
 
3
- This project now includes an MCP stdio server wrapper.
3
+ This project provides an MCP stdio wrapper around the SSM-only CLI.
4
4
 
5
5
  - Preferred CLI command: `mcp-aws-manager`
6
6
  - Preferred MCP server command: `mcp-aws-manager-mcp`
7
- - Compatibility aliases still available: `mcp-aws-discover`, `mcp-aws-discover-mcp`
7
+ - Compatibility aliases: `mcp-aws-discover`, `mcp-aws-discover-mcp`
8
8
 
9
- The MCP server exposes these tools:
9
+ Exposed MCP tools:
10
10
 
11
- - `discover_public_ec2_with_pem`
11
+ - `discover_ec2_with_ssm` (primary)
12
+ - `discover_public_ec2_with_pem` (compatibility alias, same behavior)
12
13
  - `mcp_aws_discover_cli_help`
13
14
 
14
- ## 1) Local Repo (recommended for development)
15
+ ## Recommended (Install Once)
15
16
 
16
- Use this when running directly from this repository.
17
+ ```bash
18
+ npm install -g mcp-aws-manager
19
+ mcp-aws-manager
20
+ ```
21
+
22
+ `mcp-aws-manager` (no args) runs bootstrap and registers the MCP server for detected clients (`codex`, `claude`).
23
+
24
+ Verification:
25
+
26
+ ```bash
27
+ mcp-aws-manager doctor
28
+ ```
29
+
30
+ ## Explicit Registration
31
+
32
+ ```bash
33
+ mcp-aws-manager setup
34
+ ```
35
+
36
+ Custom name/command:
37
+
38
+ ```bash
39
+ mcp-aws-manager setup --name mcp-aws-manager --mcp-command mcp-aws-manager-mcp --clients codex,claude
40
+ ```
41
+
42
+ ## Manual Configuration (Fallback)
43
+
44
+ Use only when automatic registration is unavailable in your environment.
45
+
46
+ ### 1) Local Repo (development)
17
47
 
18
48
  ```json
19
49
  {
@@ -29,15 +59,7 @@ Use this when running directly from this repository.
29
59
  }
30
60
  ```
31
61
 
32
- ## 2) Global npm Install
33
-
34
- After publishing/installing globally:
35
-
36
- ```bash
37
- npm install -g mcp-aws-manager
38
- ```
39
-
40
- Client config:
62
+ ### 2) Global npm Install
41
63
 
42
64
  ```json
43
65
  {
@@ -49,9 +71,7 @@ Client config:
49
71
  }
50
72
  ```
51
73
 
52
- ## 3) npx (without global install)
53
-
54
- This can be useful for clients that support `npx` commands.
74
+ ### 3) npx (no global install)
55
75
 
56
76
  ```json
57
77
  {
@@ -71,8 +91,7 @@ This can be useful for clients that support `npx` commands.
71
91
 
72
92
  ## Notes
73
93
 
74
- - The current discovery tool is PEM-based and accepts `pemPath` or `pemPaths` (array).
75
- - If neither is provided, it auto-discovers `.pem` files from the working directory.
76
- - AWS credentials/profiles must be available on the machine running the MCP server.
77
- - Do not pass PEM contents through chat; use a local file path in tool arguments.
78
- - For scoped public npm packages, publish with `npm publish --access public` (or set `publishConfig.access`).
94
+ - Discovery is SSM-only; PEM path arguments are no longer required.
95
+ - Keep AWS credentials/profiles available on the host running MCP.
96
+ - When `requiresUserAction=true` is returned, surface `requiredActions` to the user and retry after intervention.
97
+ - For auto remediation, pass `autoRemediateSsm` and an instance profile name/arn.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # mcp-aws-manager
2
2
 
3
- AWS operations CLI and MCP server package (currently discovery-focused).
3
+ AWS operations CLI and MCP server package (SSM-only mode).
4
4
 
5
5
  ## What It Provides
6
6
 
@@ -9,11 +9,13 @@ AWS operations CLI and MCP server package (currently discovery-focused).
9
9
 
10
10
  Current implementation focuses on:
11
11
 
12
- - EC2 public IPv4 inventory discovery
13
- - PEM fingerprint-based EC2 KeyPair matching
14
- - Optional SSH reachability checks
12
+ - EC2 inventory discovery (multi profile / multi region)
13
+ - SSM management and online-state visibility
14
+ - Optional SSM runtime snapshot collection (`RunCommand`)
15
+ - Optional SSM auto-remediation (instance profile association)
16
+ - Human-in-the-loop guidance via `ACTION_REQUIRED` messages
15
17
  - JSON/CSV output (CLI)
16
- - MCP tool wrapper for AI clients (stdio)
18
+ - Codex/Claude MCP registration bootstrap helpers
17
19
 
18
20
  ## Install
19
21
 
@@ -21,67 +23,71 @@ Current implementation focuses on:
21
23
  npm install -g mcp-aws-manager
22
24
  ```
23
25
 
24
- ## Quick Start
25
-
26
- Ensure AWS credentials/profile and a PEM file are available on your machine.
26
+ ## One-Time Bootstrap (Recommended)
27
27
 
28
- Run a CLI check (explicit PEM path(s) or auto-discovery from current folder):
28
+ After install, run once:
29
29
 
30
30
  ```bash
31
- # explicit PEM path
32
- mcp-aws-manager --pem-path /path/to/key.pem --profiles default
33
-
34
- # multiple explicit PEM paths (comma-separated)
35
- mcp-aws-manager --pem-path /path/to/key1.pem,/path/to/key2.pem --profiles default
36
-
37
- # no args: auto-uses all *.pem in current directory
38
- cd /path/that/contains/pem
39
31
  mcp-aws-manager
40
32
  ```
41
33
 
42
- For LLM clients, register the MCP command:
34
+ This ensures `mcp-aws-manager` is registered in detected clients (`codex`, `claude`).
43
35
 
44
- ```json
45
- {
46
- "mcpServers": {
47
- "mcp-aws-manager": {
48
- "command": "mcp-aws-manager-mcp"
49
- }
50
- }
51
- }
52
- ```
36
+ ## Prerequisites
37
+
38
+ - Node.js `>=18`
39
+ - AWS credentials/profile (or IAM role) on the machine running the CLI/MCP server
40
+ - For runtime snapshots: SSM permissions (`ssm:SendCommand`, `ssm:GetCommandInvocation`)
41
+ - For auto remediation: EC2/IAM permissions (`ec2:AssociateIamInstanceProfile`, optionally `ec2:ReplaceIamInstanceProfileAssociation`, `iam:PassRole`)
53
42
 
54
- ## CLI Usage
43
+ ## Quick Start
44
+
45
+ Bootstrap / setup / doctor:
55
46
 
56
47
  ```bash
57
- mcp-aws-manager --pem-path /path/to/key.pem --profiles default
48
+ mcp-aws-manager # bootstrap (default command)
49
+ mcp-aws-manager setup # register/re-register MCP server
50
+ mcp-aws-manager doctor # verify install + registration
51
+ ```
58
52
 
59
- # if current directory contains .pem files, pemPath is optional
60
- mcp-aws-manager
53
+ Basic discovery:
54
+
55
+ ```bash
56
+ mcp-aws-manager discover --profiles default
61
57
  ```
62
58
 
63
- Windows PowerShell example:
59
+ Only public IP instances:
64
60
 
65
- ```powershell
66
- mcp-aws-manager --pem-path C:\Users\<you>\.ssh\mykey.pem --profiles default
61
+ ```bash
62
+ mcp-aws-manager discover --profiles default --public-only
67
63
  ```
68
64
 
69
- Output format examples:
65
+ Collect runtime snapshots:
70
66
 
71
67
  ```bash
72
- # JSON (default)
73
- mcp-aws-manager --pem-path /path/to/key.pem --profiles default
68
+ mcp-aws-manager discover --profiles default --runtime-snapshot
69
+ ```
74
70
 
75
- # CSV
76
- mcp-aws-manager --pem-path /path/to/key.pem --profiles default --format csv
71
+ Try automatic remediation for unmanaged instances:
72
+
73
+ ```bash
74
+ mcp-aws-manager discover \
75
+ --profiles default \
76
+ --auto-remediate-ssm \
77
+ --ssm-instance-profile-name MySsmInstanceProfile
77
78
  ```
78
79
 
79
- Optional SSH reachability check:
80
+ Output CSV file:
80
81
 
81
82
  ```bash
82
- mcp-aws-manager --pem-path /path/to/key.pem --profiles default --ssh-check
83
+ mcp-aws-manager discover --profiles default --format csv --out ./inventory.csv
83
84
  ```
84
85
 
86
+ Compatibility note:
87
+
88
+ - Legacy invocation without subcommand still works for discovery when options are passed.
89
+ - Example: `mcp-aws-manager --profiles default --public-only`
90
+
85
91
  ## MCP (LLM Tool) Usage
86
92
 
87
93
  Run as an MCP stdio server:
@@ -90,43 +96,43 @@ Run as an MCP stdio server:
90
96
  mcp-aws-manager-mcp
91
97
  ```
92
98
 
93
- Then configure your MCP-compatible client (Claude Desktop, Cursor, Cline, etc.) to launch that command.
94
-
95
- See `MCP_CLIENT_SETUP.md` for ready-to-copy config examples.
96
-
97
- ### Exposed MCP Tools
99
+ Exposed MCP tools:
98
100
 
99
- - `discover_public_ec2_with_pem`
101
+ - `discover_ec2_with_ssm` (primary)
102
+ - `discover_public_ec2_with_pem` (compatibility alias, same SSM-only behavior)
100
103
  - `mcp_aws_discover_cli_help`
101
104
 
102
105
  Example tool arguments:
103
106
 
104
107
  ```json
105
108
  {
106
- "pemPaths": [
107
- "C:\\Users\\<you>\\.ssh\\key1.pem",
108
- "C:\\Users\\<you>\\.ssh\\key2.pem"
109
- ],
110
109
  "profiles": ["default"],
110
+ "publicOnly": true,
111
+ "runtimeSnapshot": true,
112
+ "autoSsoLogin": true,
111
113
  "noProgress": true
112
114
  }
113
115
  ```
114
116
 
115
- ## Requirements
117
+ ## Human-in-the-loop Behavior
116
118
 
117
- - Node.js `>=18`
118
- - AWS credentials/profile on the machine running the CLI/MCP server
119
- - Local PEM file path(s) (current discovery tool is PEM-based)
119
+ When fully automatic execution is not possible, the CLI/MCP returns actionable guidance:
120
+
121
+ - `ACTION_REQUIRED: [SSO_LOGIN_NEEDED] ...`
122
+ - `ACTION_REQUIRED: [SSM_ROLE_OR_AGENT_REQUIRED] ...`
123
+ - `ACTION_REQUIRED: [IAM_PROFILE_ASSOCIATION_FAILED] ...`
124
+
125
+ The MCP wrapper surfaces these in a structured `requiredActions` list.
120
126
 
121
127
  ## Security Notes
122
128
 
123
- - Do not paste PEM contents into LLM chats.
124
- - Pass only local file paths (`pemPath` or `pemPaths`) to the MCP tool.
125
- - Keep AWS credentials and PEM keys on the machine running the tool.
129
+ - Prefer IAM role + SSM over SSH key based access.
130
+ - Restrict RunCommand scopes with IAM policies and resource conditions.
131
+ - Review remediation permissions before enabling `--auto-remediate-ssm`.
126
132
 
127
133
  ## Compatibility Aliases
128
134
 
129
- These legacy commands are also available:
135
+ These legacy commands are still available:
130
136
 
131
137
  - `mcp-aws-discover`
132
138
  - `mcp-aws-discover-mcp`