Overview
Concrete tool implementing the standalone Python MCP server for the reverse-shell listener and command tools, provided by the mcp-servers/reverse_shell package.
Description
Uses the mcp Python SDK to implement a stdio MCP server exposing 5 tools (start/stop listener, status, send_command, disconnect). Manages a TCP listener in a background thread, tracks the connected client, and relays command output back to the MCP caller. Configurable listener port. The standalone reverse-shell MCP server — adds interactive reverse-shell capability via MCP federation.
Usage
- Federate via MCP: register this server as an external MCP server; CyberStrikeAI federates its tools.
- Interactive shell: start a listener, wait for a client connection, then send commands and read output.
Code Reference
Source Location
Signature
# stdio MCP server exposing 5 tools:
# start_listener(port) -> starts a TCP listener in a background thread
# stop_listener() -> stops the listener and disconnects client
# status() -> listener/client connection state
# send_command(command) -> sends a command to the connected client, returns output
# disconnect() -> drops the connected client
def main() -> None # MCP server entry; uses mcp.server.stdio
Import
# Run as a standalone script (python mcp_reverse_shell.py)
# Registered by CyberStrikeAI as an external MCP server.
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| port |
int |
Yes (start) |
Listener port
|
| command |
string |
Yes (send) |
Shell command to relay
|
Outputs
| Name |
Type |
Description
|
| status returns |
dict |
Listener + client state
|
| send_command returns |
string |
Command output from connected client
|
Usage Examples
Start and Relay Commands
# Federated as MCP tools by CyberStrikeAI:
start_listener(port=4444) # agent waits for a victim to connect
status() # "client connected"
send_command("whoami") # returns "uid=0(root)..."
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.