aws-sso-mcp 0.1.0__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.
Files changed (30) hide show
  1. aws_sso_mcp-0.1.0/LICENSE +21 -0
  2. aws_sso_mcp-0.1.0/PKG-INFO +276 -0
  3. aws_sso_mcp-0.1.0/README.md +232 -0
  4. aws_sso_mcp-0.1.0/pyproject.toml +169 -0
  5. aws_sso_mcp-0.1.0/pyproject.toml.orig +151 -0
  6. aws_sso_mcp-0.1.0/src/aws_sso_mcp/__init__.py +19 -0
  7. aws_sso_mcp-0.1.0/src/aws_sso_mcp/audit.py +217 -0
  8. aws_sso_mcp-0.1.0/src/aws_sso_mcp/awscfg.py +200 -0
  9. aws_sso_mcp-0.1.0/src/aws_sso_mcp/cache/__init__.py +0 -0
  10. aws_sso_mcp-0.1.0/src/aws_sso_mcp/cache/accounts.py +305 -0
  11. aws_sso_mcp-0.1.0/src/aws_sso_mcp/cache/db.py +176 -0
  12. aws_sso_mcp-0.1.0/src/aws_sso_mcp/config.py +381 -0
  13. aws_sso_mcp-0.1.0/src/aws_sso_mcp/engine/__init__.py +0 -0
  14. aws_sso_mcp-0.1.0/src/aws_sso_mcp/engine/catalog.py +217 -0
  15. aws_sso_mcp-0.1.0/src/aws_sso_mcp/engine/dag.py +161 -0
  16. aws_sso_mcp-0.1.0/src/aws_sso_mcp/engine/executor.py +375 -0
  17. aws_sso_mcp-0.1.0/src/aws_sso_mcp/errors.py +136 -0
  18. aws_sso_mcp-0.1.0/src/aws_sso_mcp/fanout.py +720 -0
  19. aws_sso_mcp-0.1.0/src/aws_sso_mcp/hardening.py +100 -0
  20. aws_sso_mcp-0.1.0/src/aws_sso_mcp/logging_setup.py +201 -0
  21. aws_sso_mcp-0.1.0/src/aws_sso_mcp/planner.py +226 -0
  22. aws_sso_mcp-0.1.0/src/aws_sso_mcp/py.typed +0 -0
  23. aws_sso_mcp-0.1.0/src/aws_sso_mcp/redact.py +115 -0
  24. aws_sso_mcp-0.1.0/src/aws_sso_mcp/roles.py +111 -0
  25. aws_sso_mcp-0.1.0/src/aws_sso_mcp/server.py +759 -0
  26. aws_sso_mcp-0.1.0/src/aws_sso_mcp/sso/__init__.py +0 -0
  27. aws_sso_mcp-0.1.0/src/aws_sso_mcp/sso/broker.py +115 -0
  28. aws_sso_mcp-0.1.0/src/aws_sso_mcp/sso/device_auth.py +426 -0
  29. aws_sso_mcp-0.1.0/src/aws_sso_mcp/sso/directory.py +95 -0
  30. aws_sso_mcp-0.1.0/src/aws_sso_mcp/state.py +95 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Arnab Das
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,276 @@
1
+ Metadata-Version: 2.4
2
+ Name: aws-sso-mcp
3
+ Version: 0.1.0
4
+ Summary: Query multiple AWS accounts across orgs at once from your AI chat client, via IAM Identity Center SSO. Rule-based role selection, no long-lived keys.
5
+ Keywords: aws,sso,iam-identity-center,mcp,model-context-protocol,multi-account
6
+ Author: Arnab Das
7
+ Author-email: Arnab Das <arnabds991@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: System :: Systems Administration
18
+ Classifier: Typing :: Typed
19
+ Requires-Dist: mcp>=2.0
20
+ Requires-Dist: boto3>=1.34
21
+ Requires-Dist: botocore>=1.34
22
+ Requires-Dist: pip-audit>=2.7 ; extra == 'audit'
23
+ Requires-Dist: zizmor>=1.11 ; extra == 'audit'
24
+ Requires-Dist: pytest>=8.0 ; extra == 'dev'
25
+ Requires-Dist: anyio>=4.16 ; extra == 'dev'
26
+ Requires-Dist: pytest-cov>=5.0 ; extra == 'dev'
27
+ Requires-Dist: pytest-randomly>=3.15 ; extra == 'dev'
28
+ Requires-Dist: hypothesis>=6.100 ; extra == 'dev'
29
+ Requires-Dist: ruff>=0.6 ; extra == 'dev'
30
+ Requires-Dist: mypy>=1.10 ; extra == 'dev'
31
+ Requires-Dist: vulture>=2.11 ; extra == 'dev'
32
+ Requires-Dist: boto3-stubs[sso,sso-oidc,sts,ec2]>=1.34 ; extra == 'dev'
33
+ Requires-Dist: build>=1.2 ; extra == 'dev'
34
+ Requires-Dist: twine>=5.0 ; extra == 'dev'
35
+ Requires-Dist: pre-commit>=3.7 ; extra == 'dev'
36
+ Requires-Python: >=3.12
37
+ Project-URL: Homepage, https://github.com/arnabdas24/aws-sso-mcp
38
+ Project-URL: Repository, https://github.com/arnabdas24/aws-sso-mcp
39
+ Project-URL: Issues, https://github.com/arnabdas24/aws-sso-mcp/issues
40
+ Project-URL: Changelog, https://github.com/arnabdas24/aws-sso-mcp/blob/main/CHANGELOG.md
41
+ Provides-Extra: audit
42
+ Provides-Extra: dev
43
+ Description-Content-Type: text/markdown
44
+
45
+ # aws-sso-mcp
46
+
47
+ **Got more than one AWS account or org? Sign in once, ask in plain English, and get one merged answer from all of them, using the IAM roles your rules choose, never the AI's.**
48
+
49
+ `aws-sso-mcp` is an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server. It plugs
50
+ into a chat assistant such as GitHub Copilot Chat in VS Code or Claude Desktop, and lets that
51
+ assistant query and manage AWS through your **AWS IAM Identity Center (SSO)** login.
52
+
53
+ > *"List all stopped EC2 instances across every prod account in org1."*
54
+ >
55
+ > One sentence in. One combined answer out, from every matching account.
56
+
57
+ ## Contents
58
+
59
+ - [Is this for you?](#is-this-for-you)
60
+ - [Why this exists](#why-this-exists)
61
+ - [What you can do with it](#what-you-can-do-with-it)
62
+ - [How it works in 30 seconds](#how-it-works-in-30-seconds)
63
+ - [Quick start](#quick-start)
64
+ - [Safety model](#safety-model)
65
+ - [Documentation map](#documentation-map)
66
+ - [Project layout](#project-layout)
67
+ - [Requirements and status](#requirements-and-status)
68
+ - [Security](#security)
69
+ - [Contributing](#contributing)
70
+ - [License](#license)
71
+
72
+ ## Is this for you?
73
+
74
+ **If you work in more than one AWS account, yes.** The more accounts and orgs you have, the more it saves you.
75
+
76
+ - **Several orgs.** Keep every org in one config file. Switch between them in chat, or query
77
+ several in a single request. Each org needs its own login, and you never mix them up by accident.
78
+ - **Dozens or hundreds of accounts.** Find accounts by name, id or environment, then ask one
79
+ question of all of them. No account-by-account console hopping, no profile juggling.
80
+ - **A different role per account.** Prod gets `ReadOnlyAccess`, sandboxes get `PowerUserAccess`.
81
+ You write that once, and it is applied everywhere.
82
+ - **Questions that cross accounts.** "Where is this running?", "Which accounts have public
83
+ buckets?", "What is stopped in prod?" Each is one sentence instead of an afternoon of clicking.
84
+
85
+ If you only ever use a single account, it still works, but a plain AWS CLI profile is simpler.
86
+
87
+ ## Why this exists
88
+
89
+ Companies often have tens or hundreds of AWS accounts, spread over several AWS Organizations.
90
+ Answering "where is X running?" normally means logging in to each account in turn.
91
+
92
+ This server removes that grind:
93
+
94
+ | Without it | With it |
95
+ |---|---|
96
+ | Sign in to every account, one by one | Sign in once per organization |
97
+ | Remember which IAM role to use in which account | Roles are chosen by rules **you** write in a config file |
98
+ | Run the same CLI command N times | One request fans out to all N accounts in parallel |
99
+ | Copy and merge the outputs yourself | One merged, sorted, redacted result |
100
+
101
+ ## What you can do with it
102
+
103
+ - **Query any AWS service.** One generic tool (`aws_query`) takes the same `service` and `operation` names
104
+ as the AWS CLI and boto3, for example `ec2` and `DescribeInstances`. There are no per-service tools to
105
+ wait for.
106
+ - **Select accounts flexibly.** Pick by org, exact name, id, name substring, or an *environment*
107
+ (`prod`, `staging`, `dev`) that you define. Exclusions are supported.
108
+ - **Chain steps.** `run_dag` runs a small multi-step plan per account. For example, list the instances,
109
+ then describe their volumes using the first step's output.
110
+ - **Manage sessions.** Log in, switch org, check token status, search the cached account directory.
111
+ - **Audit everything.** Every call is appended to a local JSONL audit log.
112
+
113
+ ## How it works in 30 seconds
114
+
115
+ ```text
116
+ You --plain English--> Chat assistant (Copilot / Claude)
117
+ | MCP tool call over stdio
118
+ v
119
+ aws-sso-mcp
120
+ 1. OIDC device login ------------> AWS IAM Identity Center
121
+ 2. short-lived role credentials <-- AWS IAM Identity Center
122
+ 3. the actual API call, per account, in parallel
123
+ |------------> AWS accounts (EC2, S3, IAM ...)
124
+ v
125
+ merged, redacted result --> Chat assistant --> answer to you
126
+ ```
127
+
128
+ The full, step-by-step explanation (with code references) is in
129
+ [docs/how-it-works.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/how-it-works.md). The detailed connectivity diagrams are in
130
+ [docs/architecture.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/architecture.md).
131
+
132
+ ## Quick start
133
+
134
+ You need Python 3.12+ and [`uv`](https://docs.astral.sh/uv/).
135
+
136
+ **1. Install**
137
+
138
+ ```bash
139
+ uv tool install aws-sso-mcp # or: pipx install aws-sso-mcp
140
+ aws-sso-mcp --version
141
+ ```
142
+
143
+ **2. Create your config** (references only, never secrets)
144
+
145
+ ```bash
146
+ mkdir -p ~/.config/aws-sso-mcp
147
+ curl -fsSL https://raw.githubusercontent.com/arnabdas24/aws-sso-mcp/main/examples/config.example.toml \
148
+ -o ~/.config/aws-sso-mcp/config.toml
149
+ ```
150
+
151
+ Edit it and set your `start_url` and `region` per org. The minimum is:
152
+
153
+ ```toml
154
+ default_org = "org1"
155
+
156
+ [portals.org1]
157
+ start_url = "https://your-org1.awsapps.com/start"
158
+ region = "us-east-1" # where your Identity Center lives, NOT where you query
159
+
160
+ [portals.org1.environments.prod]
161
+ match = "endswith"
162
+ patterns = ["-prod"]
163
+ roles = ["ReadOnlyAccess"]
164
+ ```
165
+
166
+ On Windows, use `%USERPROFILE%\.config\aws-sso-mcp\config.toml`, or point `AWS_SSO_MCP_CONFIG` at any path.
167
+
168
+ **3. Register it with your chat client** (VS Code example, in your user `mcp.json`)
169
+
170
+ ```json
171
+ {
172
+ "servers": {
173
+ "aws-sso-mcp": { "type": "stdio", "command": "aws-sso-mcp" }
174
+ }
175
+ }
176
+ ```
177
+
178
+ Claude Desktop, Claude Code, Cursor, Windsurf and non-default config paths are all covered in
179
+ [docs/setup-guide.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/setup-guide.md).
180
+
181
+ **4. Chat**
182
+
183
+ In Agent mode, try:
184
+
185
+ 1. `Log in to org1.` A browser opens once for approval.
186
+ 2. `Find accounts with "prod" in the name.`
187
+ 3. `List stopped EC2 instances in us-east-1 across every prod account.`
188
+
189
+ More ready-made phrasings, plus mistakes to avoid, are in [docs/prompt-guide.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/prompt-guide.md).
190
+ To see the exact tool call behind each sentence, read [docs/examples.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/examples.md).
191
+
192
+ ## Safety model
193
+
194
+ Read this before pointing the server at real accounts.
195
+
196
+ | Property | What it means |
197
+ |---|---|
198
+ | **IAM is the only gate** | The server does **not** block writes locally. If your SSO role may delete something, a request can delete it. Use read-only roles in your config unless you truly need more. |
199
+ | **Role choice is deterministic** | The AI model never picks a role. Rules in your TOML do (see [roles.py](https://github.com/arnabdas24/aws-sso-mcp/blob/main/src/aws_sso_mcp/roles.py)). |
200
+ | **No surprise browser windows** | Only the `login` tool starts a sign-in. Queries fail with clear instructions instead. |
201
+ | **Blast-radius cap** | A selection wider than `max_accounts` (default 200) is refused until you confirm it. |
202
+ | **Secrets are redacted** | Tokens and keys are scrubbed from logs and tool output ([redact.py](https://github.com/arnabdas24/aws-sso-mcp/blob/main/src/aws_sso_mcp/redact.py)). Credentials are never written to disk. |
203
+ | **Config cannot hold secrets** | The loader rejects keys that look like secrets ([config.py](https://github.com/arnabdas24/aws-sso-mcp/blob/main/src/aws_sso_mcp/config.py)). |
204
+ | **Everything is audited** | One line per call in `audit.jsonl`, with writes flagged. |
205
+
206
+ AWS response data (tags, names, log lines) is untrusted text that reaches the model. This server bounds
207
+ its size but cannot remove prompt-injection attempts. Details in
208
+ [docs/architecture.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/architecture.md#7-security-layers).
209
+
210
+ ## Documentation map
211
+
212
+ | Document | Read it if you want to... |
213
+ |---|---|
214
+ | [docs/how-it-works.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/how-it-works.md) | Understand, step by step and in plain language, what happens from your sentence to the answer |
215
+ | [docs/architecture.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/architecture.md) | See connectivity diagrams, components, threads, storage and security layers |
216
+ | [docs/code-walkthrough.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/code-walkthrough.md) | Understand each Python file step by step: who calls what, and how files link |
217
+ | [docs/technical-deep-dive.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/technical-deep-dive.md) | Internals: authentication, token and credential caching, locks, threads, timeouts, known quirks |
218
+ | [docs/prompt-guide.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/prompt-guide.md) | Learn what to say to your assistant, with copy-paste examples |
219
+ | [docs/tools-reference.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/tools-reference.md) | Look up every tool, argument and response shape |
220
+ | [docs/configuration.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/configuration.md) | Configure orgs, environments, roles and performance |
221
+ | [docs/developer-guide.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/developer-guide.md) | Set up, test, extend and release the project |
222
+ | [docs/adr/README.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/adr/README.md) | Understand *why* a design decision was made, and what it cost |
223
+ | [docs/troubleshooting.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/troubleshooting.md) | Fix a specific error message |
224
+ | [CONTRIBUTING.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/CONTRIBUTING.md) | Contribute code: setup, quality gates, commit conventions |
225
+ | [SECURITY.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/SECURITY.md) | Report a vulnerability, or review the threat model |
226
+ | [examples/README.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/examples/README.md) | Install and wire up the server in various MCP clients |
227
+
228
+ ## Project layout
229
+
230
+ ```text
231
+ src/aws_sso_mcp/
232
+ ├── server.py # MCP tools (thin entry points)
233
+ ├── fanout.py # the shared multi-account pipeline
234
+ ├── planner.py # which accounts? (selectors -> targets)
235
+ ├── roles.py # which role? (deterministic rules)
236
+ ├── state.py # per-process session state
237
+ ├── config.py # TOML loading and validation
238
+ ├── audit.py # append-only JSONL audit log
239
+ ├── redact.py # secret scrubbing
240
+ ├── hardening.py # output size caps + redaction in one pass
241
+ ├── logging_setup.py # stderr + chat-UI logging
242
+ ├── awscfg.py # cached boto3 client factory
243
+ ├── errors.py # clean, user-facing exception types
244
+ ├── sso/ # login (device_auth), credentials (broker), directory
245
+ ├── cache/ # SQLite account/role cache
246
+ └── engine/ # catalog (one AWS call), dag (multi-step), executor (threads)
247
+ ```
248
+
249
+ ## Requirements and status
250
+
251
+ - Python 3.12 or newer, `boto3`, and the `mcp` SDK (see [pyproject.toml](https://github.com/arnabdas24/aws-sso-mcp/blob/main/pyproject.toml)).
252
+ - Alpha (`0.1.x`): interfaces may change.
253
+ - Transport is **stdio**. The server is started by your chat client, one process per session.
254
+
255
+ ## Security
256
+
257
+ Credentials are brokered, never stored on disk; see [Safety model](#safety-model) and the full
258
+ threat model in [SECURITY.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/SECURITY.md). Report vulnerabilities **privately** via
259
+ [GitHub Security Advisories](https://github.com/arnabdas24/aws-sso-mcp/security/advisories/new),
260
+ not public issues.
261
+
262
+ Releases are built by GitHub Actions with PyPI Trusted Publishing and carry a signed SLSA
263
+ build-provenance attestation plus a CycloneDX SBOM:
264
+
265
+ ```bash
266
+ gh attestation verify ./aws_sso_mcp-<version>-py3-none-any.whl --repo arnabdas24/aws-sso-mcp
267
+ ```
268
+
269
+ ## Contributing
270
+
271
+ See [CONTRIBUTING.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/CONTRIBUTING.md). Every change must pass `ruff`, `mypy --strict`, the test
272
+ suite with its global and per-module coverage floors, and `vulture`.
273
+
274
+ ## License
275
+
276
+ [MIT](https://github.com/arnabdas24/aws-sso-mcp/blob/main/LICENSE)
@@ -0,0 +1,232 @@
1
+ # aws-sso-mcp
2
+
3
+ **Got more than one AWS account or org? Sign in once, ask in plain English, and get one merged answer from all of them, using the IAM roles your rules choose, never the AI's.**
4
+
5
+ `aws-sso-mcp` is an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server. It plugs
6
+ into a chat assistant such as GitHub Copilot Chat in VS Code or Claude Desktop, and lets that
7
+ assistant query and manage AWS through your **AWS IAM Identity Center (SSO)** login.
8
+
9
+ > *"List all stopped EC2 instances across every prod account in org1."*
10
+ >
11
+ > One sentence in. One combined answer out, from every matching account.
12
+
13
+ ## Contents
14
+
15
+ - [Is this for you?](#is-this-for-you)
16
+ - [Why this exists](#why-this-exists)
17
+ - [What you can do with it](#what-you-can-do-with-it)
18
+ - [How it works in 30 seconds](#how-it-works-in-30-seconds)
19
+ - [Quick start](#quick-start)
20
+ - [Safety model](#safety-model)
21
+ - [Documentation map](#documentation-map)
22
+ - [Project layout](#project-layout)
23
+ - [Requirements and status](#requirements-and-status)
24
+ - [Security](#security)
25
+ - [Contributing](#contributing)
26
+ - [License](#license)
27
+
28
+ ## Is this for you?
29
+
30
+ **If you work in more than one AWS account, yes.** The more accounts and orgs you have, the more it saves you.
31
+
32
+ - **Several orgs.** Keep every org in one config file. Switch between them in chat, or query
33
+ several in a single request. Each org needs its own login, and you never mix them up by accident.
34
+ - **Dozens or hundreds of accounts.** Find accounts by name, id or environment, then ask one
35
+ question of all of them. No account-by-account console hopping, no profile juggling.
36
+ - **A different role per account.** Prod gets `ReadOnlyAccess`, sandboxes get `PowerUserAccess`.
37
+ You write that once, and it is applied everywhere.
38
+ - **Questions that cross accounts.** "Where is this running?", "Which accounts have public
39
+ buckets?", "What is stopped in prod?" Each is one sentence instead of an afternoon of clicking.
40
+
41
+ If you only ever use a single account, it still works, but a plain AWS CLI profile is simpler.
42
+
43
+ ## Why this exists
44
+
45
+ Companies often have tens or hundreds of AWS accounts, spread over several AWS Organizations.
46
+ Answering "where is X running?" normally means logging in to each account in turn.
47
+
48
+ This server removes that grind:
49
+
50
+ | Without it | With it |
51
+ |---|---|
52
+ | Sign in to every account, one by one | Sign in once per organization |
53
+ | Remember which IAM role to use in which account | Roles are chosen by rules **you** write in a config file |
54
+ | Run the same CLI command N times | One request fans out to all N accounts in parallel |
55
+ | Copy and merge the outputs yourself | One merged, sorted, redacted result |
56
+
57
+ ## What you can do with it
58
+
59
+ - **Query any AWS service.** One generic tool (`aws_query`) takes the same `service` and `operation` names
60
+ as the AWS CLI and boto3, for example `ec2` and `DescribeInstances`. There are no per-service tools to
61
+ wait for.
62
+ - **Select accounts flexibly.** Pick by org, exact name, id, name substring, or an *environment*
63
+ (`prod`, `staging`, `dev`) that you define. Exclusions are supported.
64
+ - **Chain steps.** `run_dag` runs a small multi-step plan per account. For example, list the instances,
65
+ then describe their volumes using the first step's output.
66
+ - **Manage sessions.** Log in, switch org, check token status, search the cached account directory.
67
+ - **Audit everything.** Every call is appended to a local JSONL audit log.
68
+
69
+ ## How it works in 30 seconds
70
+
71
+ ```text
72
+ You --plain English--> Chat assistant (Copilot / Claude)
73
+ | MCP tool call over stdio
74
+ v
75
+ aws-sso-mcp
76
+ 1. OIDC device login ------------> AWS IAM Identity Center
77
+ 2. short-lived role credentials <-- AWS IAM Identity Center
78
+ 3. the actual API call, per account, in parallel
79
+ |------------> AWS accounts (EC2, S3, IAM ...)
80
+ v
81
+ merged, redacted result --> Chat assistant --> answer to you
82
+ ```
83
+
84
+ The full, step-by-step explanation (with code references) is in
85
+ [docs/how-it-works.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/how-it-works.md). The detailed connectivity diagrams are in
86
+ [docs/architecture.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/architecture.md).
87
+
88
+ ## Quick start
89
+
90
+ You need Python 3.12+ and [`uv`](https://docs.astral.sh/uv/).
91
+
92
+ **1. Install**
93
+
94
+ ```bash
95
+ uv tool install aws-sso-mcp # or: pipx install aws-sso-mcp
96
+ aws-sso-mcp --version
97
+ ```
98
+
99
+ **2. Create your config** (references only, never secrets)
100
+
101
+ ```bash
102
+ mkdir -p ~/.config/aws-sso-mcp
103
+ curl -fsSL https://raw.githubusercontent.com/arnabdas24/aws-sso-mcp/main/examples/config.example.toml \
104
+ -o ~/.config/aws-sso-mcp/config.toml
105
+ ```
106
+
107
+ Edit it and set your `start_url` and `region` per org. The minimum is:
108
+
109
+ ```toml
110
+ default_org = "org1"
111
+
112
+ [portals.org1]
113
+ start_url = "https://your-org1.awsapps.com/start"
114
+ region = "us-east-1" # where your Identity Center lives, NOT where you query
115
+
116
+ [portals.org1.environments.prod]
117
+ match = "endswith"
118
+ patterns = ["-prod"]
119
+ roles = ["ReadOnlyAccess"]
120
+ ```
121
+
122
+ On Windows, use `%USERPROFILE%\.config\aws-sso-mcp\config.toml`, or point `AWS_SSO_MCP_CONFIG` at any path.
123
+
124
+ **3. Register it with your chat client** (VS Code example, in your user `mcp.json`)
125
+
126
+ ```json
127
+ {
128
+ "servers": {
129
+ "aws-sso-mcp": { "type": "stdio", "command": "aws-sso-mcp" }
130
+ }
131
+ }
132
+ ```
133
+
134
+ Claude Desktop, Claude Code, Cursor, Windsurf and non-default config paths are all covered in
135
+ [docs/setup-guide.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/setup-guide.md).
136
+
137
+ **4. Chat**
138
+
139
+ In Agent mode, try:
140
+
141
+ 1. `Log in to org1.` A browser opens once for approval.
142
+ 2. `Find accounts with "prod" in the name.`
143
+ 3. `List stopped EC2 instances in us-east-1 across every prod account.`
144
+
145
+ More ready-made phrasings, plus mistakes to avoid, are in [docs/prompt-guide.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/prompt-guide.md).
146
+ To see the exact tool call behind each sentence, read [docs/examples.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/examples.md).
147
+
148
+ ## Safety model
149
+
150
+ Read this before pointing the server at real accounts.
151
+
152
+ | Property | What it means |
153
+ |---|---|
154
+ | **IAM is the only gate** | The server does **not** block writes locally. If your SSO role may delete something, a request can delete it. Use read-only roles in your config unless you truly need more. |
155
+ | **Role choice is deterministic** | The AI model never picks a role. Rules in your TOML do (see [roles.py](https://github.com/arnabdas24/aws-sso-mcp/blob/main/src/aws_sso_mcp/roles.py)). |
156
+ | **No surprise browser windows** | Only the `login` tool starts a sign-in. Queries fail with clear instructions instead. |
157
+ | **Blast-radius cap** | A selection wider than `max_accounts` (default 200) is refused until you confirm it. |
158
+ | **Secrets are redacted** | Tokens and keys are scrubbed from logs and tool output ([redact.py](https://github.com/arnabdas24/aws-sso-mcp/blob/main/src/aws_sso_mcp/redact.py)). Credentials are never written to disk. |
159
+ | **Config cannot hold secrets** | The loader rejects keys that look like secrets ([config.py](https://github.com/arnabdas24/aws-sso-mcp/blob/main/src/aws_sso_mcp/config.py)). |
160
+ | **Everything is audited** | One line per call in `audit.jsonl`, with writes flagged. |
161
+
162
+ AWS response data (tags, names, log lines) is untrusted text that reaches the model. This server bounds
163
+ its size but cannot remove prompt-injection attempts. Details in
164
+ [docs/architecture.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/architecture.md#7-security-layers).
165
+
166
+ ## Documentation map
167
+
168
+ | Document | Read it if you want to... |
169
+ |---|---|
170
+ | [docs/how-it-works.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/how-it-works.md) | Understand, step by step and in plain language, what happens from your sentence to the answer |
171
+ | [docs/architecture.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/architecture.md) | See connectivity diagrams, components, threads, storage and security layers |
172
+ | [docs/code-walkthrough.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/code-walkthrough.md) | Understand each Python file step by step: who calls what, and how files link |
173
+ | [docs/technical-deep-dive.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/technical-deep-dive.md) | Internals: authentication, token and credential caching, locks, threads, timeouts, known quirks |
174
+ | [docs/prompt-guide.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/prompt-guide.md) | Learn what to say to your assistant, with copy-paste examples |
175
+ | [docs/tools-reference.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/tools-reference.md) | Look up every tool, argument and response shape |
176
+ | [docs/configuration.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/configuration.md) | Configure orgs, environments, roles and performance |
177
+ | [docs/developer-guide.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/developer-guide.md) | Set up, test, extend and release the project |
178
+ | [docs/adr/README.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/adr/README.md) | Understand *why* a design decision was made, and what it cost |
179
+ | [docs/troubleshooting.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/docs/troubleshooting.md) | Fix a specific error message |
180
+ | [CONTRIBUTING.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/CONTRIBUTING.md) | Contribute code: setup, quality gates, commit conventions |
181
+ | [SECURITY.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/SECURITY.md) | Report a vulnerability, or review the threat model |
182
+ | [examples/README.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/examples/README.md) | Install and wire up the server in various MCP clients |
183
+
184
+ ## Project layout
185
+
186
+ ```text
187
+ src/aws_sso_mcp/
188
+ ├── server.py # MCP tools (thin entry points)
189
+ ├── fanout.py # the shared multi-account pipeline
190
+ ├── planner.py # which accounts? (selectors -> targets)
191
+ ├── roles.py # which role? (deterministic rules)
192
+ ├── state.py # per-process session state
193
+ ├── config.py # TOML loading and validation
194
+ ├── audit.py # append-only JSONL audit log
195
+ ├── redact.py # secret scrubbing
196
+ ├── hardening.py # output size caps + redaction in one pass
197
+ ├── logging_setup.py # stderr + chat-UI logging
198
+ ├── awscfg.py # cached boto3 client factory
199
+ ├── errors.py # clean, user-facing exception types
200
+ ├── sso/ # login (device_auth), credentials (broker), directory
201
+ ├── cache/ # SQLite account/role cache
202
+ └── engine/ # catalog (one AWS call), dag (multi-step), executor (threads)
203
+ ```
204
+
205
+ ## Requirements and status
206
+
207
+ - Python 3.12 or newer, `boto3`, and the `mcp` SDK (see [pyproject.toml](https://github.com/arnabdas24/aws-sso-mcp/blob/main/pyproject.toml)).
208
+ - Alpha (`0.1.x`): interfaces may change.
209
+ - Transport is **stdio**. The server is started by your chat client, one process per session.
210
+
211
+ ## Security
212
+
213
+ Credentials are brokered, never stored on disk; see [Safety model](#safety-model) and the full
214
+ threat model in [SECURITY.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/SECURITY.md). Report vulnerabilities **privately** via
215
+ [GitHub Security Advisories](https://github.com/arnabdas24/aws-sso-mcp/security/advisories/new),
216
+ not public issues.
217
+
218
+ Releases are built by GitHub Actions with PyPI Trusted Publishing and carry a signed SLSA
219
+ build-provenance attestation plus a CycloneDX SBOM:
220
+
221
+ ```bash
222
+ gh attestation verify ./aws_sso_mcp-<version>-py3-none-any.whl --repo arnabdas24/aws-sso-mcp
223
+ ```
224
+
225
+ ## Contributing
226
+
227
+ See [CONTRIBUTING.md](https://github.com/arnabdas24/aws-sso-mcp/blob/main/CONTRIBUTING.md). Every change must pass `ruff`, `mypy --strict`, the test
228
+ suite with its global and per-module coverage floors, and `vulture`.
229
+
230
+ ## License
231
+
232
+ [MIT](https://github.com/arnabdas24/aws-sso-mcp/blob/main/LICENSE)