Skip to content

Commit d2d287e

Browse files
authored
Merge pull request #1 from netwrix/hello-world
Hello, world!
2 parents c6604d0 + e675d38 commit d2d287e

File tree

6 files changed

+1302
-0
lines changed

6 files changed

+1302
-0
lines changed

.gitignore

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
116+
# Spyder project settings
117+
.spyderproject
118+
.spyproject
119+
120+
# Rope project settings
121+
.ropeproject
122+
123+
# mkdocs documentation
124+
/site
125+
126+
# mypy
127+
.mypy_cache/
128+
.dmypy.json
129+
dmypy.json
130+
131+
# Pyre type checker
132+
.pyre/
133+
134+
# pytype static type analyzer
135+
.pytype/
136+
137+
# Cython debug symbols
138+
cython_debug/
139+
140+
# macOS
141+
.DS_Store

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

README.md

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
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

Comments
 (0)