A Model Context Protocol (MCP) server that provides AI assistants with SMB share enumeration and interaction capabilities via SMBMap.
This MCP server enables AI assistants like Claude to perform SMB-based security assessments and penetration testing tasks. It executes commands on a remote Kali Linux machine via SSH, providing a secure and isolated execution environment.
[AI Assistant] <-> [MCP Server] <-> [SSH] <-> [Kali Linux] <-> [SMBMap] <-> [Target]
| Tool | Description |
|---|---|
smbmap_enum |
Enumerate SMB shares on a target host |
smbmap_permissions |
Check share permissions (READ, WRITE, NO ACCESS) |
smbmap_list |
List files and directories in shares (supports recursion) |
smbmap_download |
Download files from SMB shares |
smbmap_upload |
Upload files to SMB shares |
smbmap_exec |
Execute commands via SMB (requires admin) |
smbmap_search |
Search for files by name pattern (regex supported) |
smbmap_content_search |
Search file contents (requires admin + PowerShell) |
smbmap_drives |
List all drives on target system |
smbmap_delete |
Delete files from SMB shares |
smbmap_host_file |
Scan multiple hosts from a file |
- Node.js 18+
- SSH access to a Kali Linux machine (passwordless SSH recommended)
- SMBMap installed on Kali (
apt install smbmap)
# Clone the repository
git clone https://github.com/schwarztim/sec-smbmap-mcp.git
cd sec-smbmap-mcp
# Install dependencies
npm install
# Build the project
npm run build| Variable | Default | Description |
|---|---|---|
KALI_HOST |
kali |
SSH hostname or IP of Kali Linux machine |
SSH_OPTIONS |
-o StrictHostKeyChecking=no -o ConnectTimeout=10 |
SSH connection options |
Add to your Claude Desktop configuration file (~/.config/claude/claude_desktop_config.json on Linux or ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"smbmap": {
"command": "node",
"args": ["/path/to/sec-smbmap-mcp/dist/index.js"],
"env": {
"KALI_HOST": "your-kali-host"
}
}
}
}Ensure passwordless SSH access to your Kali machine:
# Generate SSH key if needed
ssh-keygen -t ed25519
# Copy key to Kali machine
ssh-copy-id kali
# Test connection
ssh kali "smbmap --help"{
"tool": "smbmap_enum",
"arguments": {
"host": "192.168.1.100"
}
}{
"tool": "smbmap_enum",
"arguments": {
"host": "192.168.1.100",
"username": "admin",
"password": "password123",
"domain": "CORP"
}
}{
"tool": "smbmap_enum",
"arguments": {
"host": "192.168.1.100",
"username": "admin",
"password": "aad3b435b51404eeaad3b435b51404ee:da76f2c4c96028b7a6111aef4a50a94d"
}
}{
"tool": "smbmap_list",
"arguments": {
"host": "192.168.1.100",
"username": "admin",
"password": "password123",
"path": "C$\\Users",
"recursive": true,
"depth": 2
}
}{
"tool": "smbmap_search",
"arguments": {
"host": "192.168.1.100",
"username": "admin",
"password": "password123",
"pattern": ".*password.*",
"search_path": "C$\\Users"
}
}{
"tool": "smbmap_exec",
"arguments": {
"host": "192.168.1.100",
"username": "admin",
"password": "password123",
"command": "ipconfig /all"
}
}{
"tool": "smbmap_download",
"arguments": {
"host": "192.168.1.100",
"username": "admin",
"password": "password123",
"remote_path": "C$\\Users\\admin\\Desktop\\passwords.txt"
}
}{
"tool": "smbmap_host_file",
"arguments": {
"host_file": "/tmp/targets.txt",
"username": "admin",
"password": "password123",
"domain": "CORP"
}
}This tool is intended for authorized penetration testing and security assessments only.
- Always obtain proper written authorization before scanning any systems
- Follow responsible disclosure practices
- Comply with all applicable laws and regulations
- Never use this tool against systems you do not own or have explicit permission to test
Unauthorized access to computer systems is illegal and unethical.
# Watch mode for development
npm run dev
# Build for production
npm run build
# Start the server
npm start- SMBMap - The underlying enumeration tool
- Model Context Protocol - MCP specification
- Kali Linux Tools - smbmap - Kali documentation
- MCP TypeScript SDK - SDK used for this server
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request