|
| 1 | +# MCP Server for Claude Desktop |
| 2 | + |
| 3 | +A FastMCP-based server for Netwrix Access Analyzer data analysis, designed to integrate with Claude Desktop for enhanced data analysis capabilities. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- SQL Server integration with automatic connection on startup |
| 8 | +- Dynamic database schema exploration |
| 9 | +- SQL query execution |
| 10 | +- Netwrix Access Analyzer File System tools |
| 11 | + |
| 12 | +## Dependencies |
| 13 | + |
| 14 | +This MCP server requires the following dependencies: |
| 15 | + |
| 16 | +- Python 3.12 or higher |
| 17 | +- MCP SDK |
| 18 | +- pyodbc 4.0.39 or higher (for SQL Server connectivity) |
| 19 | +- python-dotenv 1.0.0 or higher (for environment variable management) |
| 20 | +- ODBC Driver 17 for SQL Server or later (must be installed on your system) |
| 21 | + |
| 22 | +### Netwrix Access Analyzer (NAA) Dependencies |
| 23 | + |
| 24 | +This MCP Server requires Netwrix Access Analyzer (NAA) File System scans to be completed. |
| 25 | + |
| 26 | +## Installation |
| 27 | + |
| 28 | +### System Dependencies |
| 29 | + |
| 30 | +First, ensure you have the ODBC Driver for SQL Server installed: |
| 31 | + |
| 32 | +- **macOS**: Install using Homebrew: `brew install microsoft/mssql-release/msodbcsql17` |
| 33 | +- **Windows**: Download and install from the [Microsoft ODBC Driver page](https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server) |
| 34 | +- **Linux**: Follow [Microsoft's instructions](https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server) for your distribution |
| 35 | + |
| 36 | +### Python Dependencies |
| 37 | + |
| 38 | +Install required Python packages using `uv` |
| 39 | + |
| 40 | +### Database Setup |
| 41 | + |
| 42 | +For development or testing purposes only: |
| 43 | + |
| 44 | +1. Create a `.env` file in your project directory with your SQL Server connection details: |
| 45 | + |
| 46 | +``` |
| 47 | +# Database Connection Information |
| 48 | +DB_SERVER=your_server_name # e.g., 192.168.50.220 |
| 49 | +DB_NAME=your_database_name # e.g., StealthAudit |
| 50 | +DB_USER=your_username # e.g., sa |
| 51 | +DB_PASSWORD=your_password # e.g., PASSWORD |
| 52 | +DB_USE_WINDOWS_AUTH=FALSE # Set to TRUE to use Windows Authentication |
| 53 | +``` |
| 54 | + |
| 55 | +2. Replace the example values with your actual database connection information. |
| 56 | + |
| 57 | +## Integration with Claude Desktop |
| 58 | + |
| 59 | +To make this MCP server available in Claude Desktop: |
| 60 | + |
| 61 | +1. Open Claude Desktop |
| 62 | +2. Navigate to the Claude Desktop configuration file: |
| 63 | + - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json` |
| 64 | + - Windows: `%APPDATA%\Claude\claude_desktop_config.json` |
| 65 | +3. Add the following configuration to the `mcpServers` section. |
| 66 | +4. Restart Claude Desktop |
| 67 | + |
| 68 | +### Example Configuration |
| 69 | + |
| 70 | +```json |
| 71 | +"NetwrixAccessAnalyzer": { |
| 72 | + "command": "/path/to/your/uv", |
| 73 | + "args": [ |
| 74 | + "run", |
| 75 | + "--with", |
| 76 | + "pyodbc,fastmcp", |
| 77 | + "fastmcp", |
| 78 | + "run", |
| 79 | + "/path/to/mcp/main.py" |
| 80 | + ], |
| 81 | + "env": { |
| 82 | + "DB_SERVER": "your_server_address", |
| 83 | + "DB_NAME": "your_database_name", |
| 84 | + "DB_USER": "your_username", |
| 85 | + "DB_PASSWORD": "your_password", |
| 86 | + "DB_USE_WINDOWS_AUTH": "FALSE" |
| 87 | + } |
| 88 | +} |
| 89 | +``` |
| 90 | + |
| 91 | +1. Replace `/path/to/your/uv` with the actual path to your `uv` executable (find with `which uv` or `where uv`), and update the path to your `main.py` file as well as the database connection information. |
| 92 | +2. Restart Claude Desktop to apply the changes |
| 93 | + |
| 94 | +## Available Tools and Sample Prompts |
| 95 | + |
| 96 | +The MCP server provides the following tools for interacting with database systems and analyzing access data: |
| 97 | + |
| 98 | +### Database Connection Tools |
| 99 | + |
| 100 | +#### connect_database |
| 101 | + |
| 102 | +Connect to a MS SQL Server database. |
| 103 | + |
| 104 | +**Parameters:** |
| 105 | +- `server`: SQL Server address |
| 106 | +- `database`: Database name |
| 107 | +- `username`: SQL Server username (optional if using Windows auth) |
| 108 | +- `password`: SQL Server password (optional if using Windows auth) |
| 109 | +- `trusted_connection`: Boolean flag for Windows Authentication |
| 110 | + |
| 111 | +**Example prompt:** |
| 112 | +"Connect to our SQL Server database at [DBSERVER] with the name [DBNAME] using the [USERNAME] user and [PASSWORD] password." |
| 113 | + |
| 114 | +#### show_connection_status |
| 115 | + |
| 116 | +Check the current database connection status. |
| 117 | + |
| 118 | +**Example prompt:** |
| 119 | +"Is the database currently connected? Show me the connection status." |
| 120 | + |
| 121 | +### Data Query and Schema Tools |
| 122 | + |
| 123 | +#### run_query |
| 124 | + |
| 125 | +Execute a custom SQL query on the connected database. |
| 126 | + |
| 127 | +**Parameters:** |
| 128 | +- `query`: SQL query string |
| 129 | + |
| 130 | +**Example prompt:** |
| 131 | +"Run this SQL query: SELECT TOP 10 * FROM Permissions ORDER BY LastAccessTime DESC" |
| 132 | + |
| 133 | +#### explain_table |
| 134 | + |
| 135 | +Get a detailed explanation of a database table's schema. |
| 136 | + |
| 137 | +**Parameters:** |
| 138 | +- `table_name`: Name of the table to explain |
| 139 | + |
| 140 | +**Example prompt:** |
| 141 | +"Explain the schema of the Permissions table. What columns does it have?" |
| 142 | + |
| 143 | +#### get_table_schema |
| 144 | + |
| 145 | +Retrieves the schema information for a specific table. |
| 146 | + |
| 147 | +**Parameters:** |
| 148 | +- `table_name`: Name of the table to get schema for. |
| 149 | + |
| 150 | +**Example prompt:** |
| 151 | +"Show me the schema for the Users table." |
| 152 | + |
| 153 | +#### get_table_sample |
| 154 | + |
| 155 | +Retrieves a sample of 10 rows from the specified table. |
| 156 | + |
| 157 | +**Parameters:** |
| 158 | +- `tablename`: Name of the table to sample |
| 159 | + |
| 160 | +**Example prompt:** |
| 161 | +"Give me a sample of 10 rows from the Permissions table." |
| 162 | + |
| 163 | +### Access Analysis Tools |
| 164 | + |
| 165 | +#### get_sensitivedata |
| 166 | + |
| 167 | +Identify locations containing sensitive data. |
| 168 | + |
| 169 | +**Example prompt:** |
| 170 | +"Find all shares that contain sensitive data in our environment." |
| 171 | + |
| 172 | +#### get_trustee_access |
| 173 | + |
| 174 | +Identify where a specific user or group has access. |
| 175 | + |
| 176 | +**Parameters:** |
| 177 | +- `trustee`: Domain\Username format |
| 178 | +- `levelsdown`: How many directory levels to traverse (default: 0) |
| 179 | + |
| 180 | +**Example prompt:** |
| 181 | +"Where does DOMAIN\JohnDoe have access in our file systems?" |
| 182 | + |
| 183 | +#### get_permission_source |
| 184 | + |
| 185 | +Determine the source of a user's permissions for a specific resource. |
| 186 | + |
| 187 | +**Parameters:** |
| 188 | +- `trustee`: Domain\Username format |
| 189 | +- `resourcepath`: Path to the resource |
| 190 | + |
| 191 | +**Example prompt:** |
| 192 | +"Why does DOMAIN\JaneDoe have access to \\server\share\folder? What's the source of this permission?" |
| 193 | + |
| 194 | +#### get_resource_access |
| 195 | + |
| 196 | +Show who has access to a specific resource. |
| 197 | + |
| 198 | +**Parameters:** |
| 199 | +- `resource`: Path to the resource |
| 200 | + |
| 201 | +**Example prompt:** |
| 202 | +"Who has access to \\server\finance? Show me all users and groups." |
| 203 | + |
| 204 | +#### get_unused_access |
| 205 | + |
| 206 | +Find users with unused access to a specific resource. |
| 207 | + |
| 208 | +**Parameters:** |
| 209 | +- `resource`: Path to the resource |
| 210 | + |
| 211 | +**Example prompt:** |
| 212 | +"Find all users who haven't accessed \\server\hr in the last year." |
| 213 | + |
| 214 | +#### get_shadow_access |
| 215 | + |
| 216 | +Find users with shadow access to critical resources. |
| 217 | + |
| 218 | +**Example prompt:** |
| 219 | +"Find all users who have shadow access to credit cards" |
| 220 | +"Find sbcloudlab\admins shadow access" |
| 221 | + |
| 222 | +### Operational Tools |
| 223 | + |
| 224 | +#### get_running_jobs |
| 225 | + |
| 226 | +Check currently running Netwrix Access Analyzer jobs. |
| 227 | + |
| 228 | +**Example prompt:** |
| 229 | +"Are there any Access Analyzer jobs running right now? Show me the status." |
| 230 | + |
| 231 | +## Troubleshooting |
| 232 | + |
| 233 | +### Connection Issues |
| 234 | + |
| 235 | +If you encounter connection issues: |
| 236 | + |
| 237 | +1. Verify your SQL Server is running and accessible from your network |
| 238 | +2. Check your credentials in the `.env` file |
| 239 | +3. Ensure the ODBC driver is correctly installed |
| 240 | +4. Check the logs for detailed error messages |
| 241 | + |
| 242 | +### Claude Desktop Integration |
| 243 | + |
| 244 | +If Claude Desktop can't find the `uv` command: |
| 245 | + |
| 246 | +1. Use the full path to `uv` in your configuration (use `which uv` or `where uv` to find it) |
| 247 | +2. Make sure you've restarted Claude Desktop after configuration changes |
| 248 | +3. Check the Claude logs for any error messages related to the MCP server |
0 commit comments