This package wraps the dAWShund project in two different servers so you can enumerate AWS IAM data, evaluate effective permissions and obtain a high‑level summary without having to remember a handful of separate scripts. The upstream project describes itself as a way to “put a leash on naughty permissions” and provides three main components: sAWSage – enumerates IAM principals and resource policie
Add this skill
npx mdskills install samvas-codes/dawshund-mcpComprehensive MCP wrapper for AWS IAM analysis with three well-defined tools and excellent setup docs
1# MCP dAWShund Server23This package wraps the [dAWShund project](https://github.com/FalconForceTeam/dAWShund) in two different servers4so you can enumerate AWS IAM data, evaluate effective permissions and5obtain a high‑level summary without having to remember a handful of6separate scripts. The upstream project describes itself as a way to7“put a leash on naughty permissions” and provides three main8components:910* **sAWSage** – enumerates IAM principals and resource policies and11 consolidates them into a single JSON document. Supported resources12 include IAM groups, roles and users and a subset of resource based13 policies such as AWS Backup, EFS, KMS, Lambda, S3, SNS and SQS. The14 consolidated file (`sawsage.json`) is produced under `policies/`15 after running the scrip.16* **Gerakina** – feeds the consolidated policies into AWS’s17 `simulate-principal-policy` API and produces a new JSON file,18 `effective_permissions.json`, listing which actions are allowed,19 explicitly denied or implicitly denied for each principal. This20 step may take some time because it calls the AWS API for every21 unique combination of principal, action and resource.22* **dAWShund** – imports the effective permissions into a Neo4j23 database and builds a graph of principals and resources. It24 generates `permissions4j.json` and `dawshund.json` suitable for25 browsing in Neo4j and BloodHound respectively. Using the Neo4j26 functionality is optional; the HTTP server included here provides a27 lightweight summary instead.2829## Requirements3031dAWShund depends on Python, the AWS CLI and a handful of Python32packages. If you wish to use the Neo4j visualisation then a33running Neo4j instance is also required. At a minimum you need:3435* Python 3.x36* An AWS account with permissions to call IAM APIs (for enumeration)37 and the `simulate-principal-policy` API (for evaluation). You38 should configure your AWS credentials using `aws configure --profile39 <profile_name>`.40* The AWS CLI installed and available on your path.41* **Optional:** a Neo4j server if you plan to use the `dawshund.py`42 script directly (the HTTP server summarises results without Neo4j).4344The `setup.sh` script in this directory will install Python45dependencies (using `pip`) and clone the upstream dAWShund repository.46If you prefer to manage dependencies manually you can see47`setup.sh` for the exact commands.4849## Installation50511. Install the AWS CLI and configure a named profile for the account52 you wish to assess. For example:5354 ```bash55 # install the AWS CLI via your package manager or from https://aws.amazon.com/cli/56 aws configure --profile myprofile57 ```58592. Clone this repository (or copy the `mcp_dawshund_server` folder)60 and run the setup script:6162 ```bash63 cd mcp_dawshund_server64 ./setup.sh65 ```6667 The script installs Python dependencies (`boto3`, `neo4j`, `flask`,68 `flask_cors`) and clones the dAWShund code into a local69 subdirectory. If you wish to use a Python virtual environment you70 can create and activate one before running `setup.sh`.71723. Start the server:7374 ```bash75 python3 server.py76 ```7778 By default the HTTP service listens on port 8000 on all interfaces.79 You can change the port by setting the `PORT` environment variable80 before starting the server, for example:8182 ```bash83 PORT=5000 python3 server.py84 ```8586 If you intend to use the MCP implementation instead of the HTTP API,87 you can run it with:8889 ```bash90 python3 iam_mcp_server.py91 ```9293 The MCP server does not bind to a TCP port; it communicates via94 standard input/output and is typically launched by a client such as95 Claude for Desktop. See [Using the MCP server](#using-the-mcp-server)96 below for details.9798## Using the HTTP server99100The Flask-based server (`server.py`) exposes three endpoints over HTTP.101All requests and responses use JSON. The examples below use `curl`102but any HTTP client will work.103104### 1 – Enumerate IAM policies (`/collect`)105106Trigger enumeration of IAM principals and resource policies via107sAWSage. Provide your AWS CLI profile name and optionally an array of108regions. If no regions are supplied, sAWSage enumerates all known109regions for supported services.110111```bash112curl -X POST http://localhost:8000/collect \113 -H 'Content-Type: application/json' \114 -d '{"profile": "myprofile", "regions": ["us-west-2", "us-east-1"]}'115```116117The response is a large JSON document keyed by AWS ARN. Each entry118includes metadata (friendly name, attached policies) and the raw119statements extracted from inline and managed policies. The same file120is saved to `dAWShund/policies/sawsage.json` for later use.121122### 2 – Evaluate effective permissions (`/evaluate`)123124Simulate the permissions attached to each principal using the AWS125`simulate-principal-policy` API. This endpoint requires only your126profile name:127128```bash129curl -X POST http://localhost:8000/evaluate \130 -H 'Content-Type: application/json' \131 -d '{"profile": "myprofile"}'132```133134The response contains the contents of135`effective_permissions.json` – a dictionary keyed by principal ARN.136Within each entry the `Permissions` key contains lists named137`allowed`, `explicitDeny` and `implicitDeny` listing the (action,138resource) tuples for that principal.139140### 3 – Summarise the evaluation (`/analyze`)141142Retrieve a compact summary of the evaluation. This endpoint reads143`effective_permissions.json` and counts how many actions are allowed,144explicitly denied and implicitly denied for each principal. No145request body is required:146147```bash148curl -X POST http://localhost:8000/analyze -H 'Content-Type: application/json' -d '{}'149```150151The response looks like this (example):152153```json154{155 "arn:aws:iam::123456789012:user/Alice": {156 "allowed": 42,157 "explicitDeny": 0,158 "implicitDeny": 5159 },160 "arn:aws:iam::123456789012:role/AdminRole": {161 "allowed": 128,162 "explicitDeny": 0,163 "implicitDeny": 0164 }165}166```167168This summary can help you quickly identify over‑privileged principals or169those with unexpected implicit denies. For deeper analysis you can170connect to a Neo4j database and run the original `dawshund.py`171script, which will build a graph and create `permissions4j.json` and172`dawshund.json`.173174## Using the MCP server175176In addition to the Flask HTTP API, this package includes a **Model177Context Protocol (MCP) server** implemented with the `fastmcp`178library. MCP servers communicate over JSON‑RPC and are designed to be179consumed by AI assistants like Claude Desktop or custom FastMCP clients180. The MCP server exposes the same operations as the181HTTP API but uses structured tool definitions instead of HTTP182endpoints.183184### 1 – Install FastMCP185186The provided `setup.sh` script installs the `fastmcp` package for you.187If you are managing dependencies manually, install it with:188189```bash190pip install fastmcp191```192193FastMCP requires Python 3.10 or later.194195### 2 – Run the server manually196197To test the MCP server locally, run:198199```bash200python3 iam_mcp_server.py201```202203This launches the server in STDIO mode. It will block and listen for204JSON‑RPC requests on standard input. You can also run the server over205HTTP if you plan to expose it as a remote connector:206207```bash208fastmcp run iam_mcp_server.py:mcp --transport http --port 8000209```210211### 3 – Available tools212213The MCP server exposes three tools. Each tool returns JSON structured214content and is accompanied by a brief summary:215216| Tool name | Description | Input parameters |217|---------------|---------------------------------------------------------------|---------------------------------------------------------------------|218| `collect_iam` | Enumerate IAM principals and resource policies using sAWSage | `profile` (string, required), `regions` (array of strings, optional) |219| `evaluate_iam`| Simulate effective permissions using Gerakina | `profile` (string, required) |220| `analyze_iam` | Summarise allowed, explicit and implicit denies per principal | None |221222The **collect** and **evaluate** tools return a short message and the223path to their respective JSON output files (the full documents can be224hundreds of kilobytes). The **analyze** tool reads the effective225permissions file and returns a dictionary keyed by principal ARN with226counts of allowed and denied actions.227228### 4 – Integrate with Claude Desktop229230Claude Desktop can launch local MCP servers defined in a231`claude_desktop_config.json` file. On macOS this file resides at232`~/Library/Application Support/Claude/claude_desktop_config.json`233. Add a new entry under the `mcpServers` key:234235```json236{237 "mcpServers": {238 "iam-analysis": {239 "command": "/usr/bin/python3",240 "args": [241 "/ABSOLUTE/PATH/TO/iam_mcp_server.py"242 ]243 }244 }245}246```247248Replace the paths with the correct locations on your system. After249saving the file **restart Claude Desktop**; the configuration is read250only on startup. When your natural language prompt251requires IAM enumeration or permission simulation, Claude will call the252appropriate tool. For example, you might say:253254> “Enumerate IAM policies for my default profile and summarise how many255> actions are allowed or denied.”256257Claude will issue a `collect_iam` call, followed by `evaluate_iam` and258finally `analyze_iam`. The results from each tool will be returned259back to Claude and incorporated into the assistant’s final response.260261Alternatively, you can expose the MCP server as a **remote connector**262by running it over HTTP and registering the URL in Claude’s web263interface. For example, start the server via264265```bash266fastmcp run iam_mcp_server.py:mcp --transport http --port 8000267```268269and then add `http://localhost:8000/mcp` as a custom connector in270Claude’s settings.271272## Notes and caveats273274* **Permissions required:** The enumeration step uses IAM APIs such275 as `list_users`, `list_roles` and `get_user_policy`. The276 evaluation step calls `simulate-principal-policy`, which in turn277 evaluates actions against resources. Make sure the AWS profile you278 use has sufficient permissions to perform these operations.279* **Runtime and cost:** Simulating policies can be time consuming280 because it makes one API call per principal/action/resource281 combination. For accounts with many principals and policies this282 may take several minutes. There is no additional AWS cost for the283 simulation API itself, but the enumeration queries are subject to284 normal API rate limits.285* **Neo4j integration:** By default `dawshund.py` connects to a286 Neo4j instance running on `localhost:7687` with username `neo4j`287 and password `dawshund`. If you wish to populate your own Neo4j288 database, edit the `NEO4J_URI` and `NEO4J_AUTH` values in289 `dAWShund/dawshund.py` before running it. The HTTP server290 provided here does not use Neo4j at all; instead it summarises291 the JSON output.292* **Extensibility:** The upstream project currently enumerates293 resource policies for a limited set of services. If you294 need coverage for additional services, consider contributing a295 service enumerator to the upstream repository.296297## License298299This package bundles the dAWShund scripts, which are licensed under300the BSD 3‑Clause license. See the upstream repository for301details. The wrapper code in this folder (the server and setup302scripts) is released into the public domain. Use them however you303like.
Full transparency — inspect the skill content before installing.