
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@agent-remote/docker
Advanced tools
A TypeScript library for executing commands and managing files on Docker containers. Designed for integration with the Claude Agent SDK to provide AI agents with container access.
npm install @agent-remote/docker
The package includes a standalone MCP server executable that can be run from the command line and communicates over stdio transport. The server is self-contained with all dependencies bundled (except Node.js builtins), making it easy to distribute and run without installing node_modules.
Installation:
npm install -g @agent-remote/docker
Usage with command line arguments:
# With container name
remote-docker-mcp --container my-app
# With custom shell
remote-docker-mcp --container my-app --shell bash
Usage with environment variables:
export DOCKER_CONTAINER=my-app
export DOCKER_SHELL=bash
remote-docker-mcp
Available options:
--container, -c - Docker container name (or DOCKER_CONTAINER env var)--shell, -s - Shell to use for command execution, default 'sh' (or
DOCKER_SHELL env var)--debug - Enable debug outputThe server exposes all remote tools (bash, read, write, edit, grep, glob, etc.) through the MCP protocol.
Configuration in Claude Desktop:
Add to your Claude Desktop configuration:
{
"mcpServers": {
"docker": {
"command": "remote-docker-mcp",
"args": ["--container", "my-app"]
}
}
}
import { Remote } from '@agent-remote/docker';
// Create a remote instance
const remote = new Remote({
container: 'my-app',
shell: 'bash', // optional, defaults to 'sh'
});
// Execute commands
const result = await remote.bash.handler({
command: 'ls -la',
});
console.log(result.content[0].text);
// Read files
const fileContent = await remote.read.handler({
file_path: '/app/config.json',
});
// Write files
await remote.write.handler({
file_path: '/tmp/test.txt',
content: 'Hello, world!',
});
import { Remote } from '@agent-remote/docker';
const remote = new Remote({
container: 'my-app',
shell: 'bash',
});
// Create an MCP server with all tools
const server = remote.createSdkMcpServer();
// Use with Agent SDK...
const remote = new Remote({ container: 'my-app' });
// Each tool is accessible as a property with a handler
const tools = [
remote.bash,
remote.bashOutput,
remote.killBash,
remote.grep,
remote.read,
remote.write,
remote.edit,
remote.glob,
];
// You can use individual tools in your own MCP server
import { createSdkMcpServer, tool } from '@anthropic-ai/claude-agent-sdk';
const customServer = createSdkMcpServer({
name: 'custom-remote-docker',
version: '1.0.0',
tools: [
tool(
remote.bash.name,
remote.bash.description,
remote.bash.inputSchema,
remote.bash.handler,
),
tool(
remote.read.name,
remote.read.description,
remote.read.inputSchema,
remote.read.handler,
),
tool(
remote.write.name,
remote.write.description,
remote.write.inputSchema,
remote.write.handler,
),
],
});
The main class for managing Docker container access and tools.
new Remote(config: RemoteConfig)Creates a new Remote instance for interacting with a Docker container.
Parameters:
config - Docker container configuration (see Configuration below)Returns: A Remote instance
Example:
const remote = new Remote({
container: 'my-app',
shell: 'bash',
});
createSdkMcpServer(name?: string)Creates an MCP server with all remote tools from this Remote instance.
Parameters:
name - Optional name for the MCP server (defaults to 'remote-docker')Returns: An MCP server instance from the Claude Agent SDK
Example:
const server = remote.createSdkMcpServer();
Each tool is accessed via a getter property that returns a tool definition with
name, description, inputSchema, and handler properties.
bash: BashToolDefinitionExecutes commands in a persistent shell session.
Input:
{
command: string; // The command to execute
timeout?: number; // Optional timeout in milliseconds (max 600000)
description?: string; // Description of what the command does
run_in_background?: boolean; // Run in background
}
Output:
{
output: string; // Combined stdout and stderr
exitCode?: number; // Exit code (optional)
signal?: string; // Signal used to terminate the command
killed?: boolean; // Whether the command was killed due to timeout
shellId?: string; // Shell ID if background execution
}
bashOutput: BashOutputToolDefinitionRetrieves output from a running or completed background bash shell.
Input:
{
shell_id: string; // Shell ID to retrieve output from
}
Output:
{
output: string; // New output since last check
status: 'running' | 'completed'; // Shell status
exitCode?: number; // Exit code (when completed)
signal?: string; // Signal (when completed)
}
killBash: KillBashToolDefinitionKills a running background shell by its ID.
Input:
{
shell_id: string; // Shell ID to kill
signal?: string; // Signal to send (e.g., 'SIGTERM', 'SIGKILL')
}
Output:
{
killed: boolean; // Whether the shell was killed
}
grep: GrepToolDefinitionSearches for patterns in files or directories.
Input:
{
pattern: string; // Regular expression pattern
path: string; // File or directory to search
glob?: string; // Glob pattern to filter files
output_mode?: 'content' | 'files_with_matches' | 'count';
'-B'?: number; // Lines of context before match
'-A'?: number; // Lines of context after match
'-C'?: number; // Lines of context before and after
'-n'?: boolean; // Show line numbers
'-i'?: boolean; // Case insensitive
head_limit?: number; // Limit output lines
}
Output:
{
mode: 'content' | 'files_with_matches' | 'count';
content?: string; // Matching lines (if mode is 'content')
filenames?: string[]; // Matching files (if mode is 'files_with_matches')
numFiles?: number; // Number of files (if mode is 'files_with_matches')
numMatches?: number; // Number of matches (if mode is 'count')
}
read: ReadToolDefinitionReads files from the container filesystem using shell commands.
Input:
{
file_path: string; // Absolute path to file
offset?: number; // Line number to start reading from
limit?: number; // Number of lines to read
}
Output:
{
content: string; // File content
numLines: number; // Number of lines read
startLine: number; // Starting line number
totalLines: number; // Total lines in file
}
Implementation:
Uses cat command to read file contents from the container.
write: WriteToolDefinitionWrites content to files on the container filesystem using shell commands.
Input:
{
file_path: string; // Absolute path to file
content: string; // Content to write
}
Output:
{
content: string; // Content that was written
}
Implementation:
Uses printf '%s' '...' with single-quote escaping to safely handle special
characters, newlines, and unicode.
edit: EditToolDefinitionEdits files by replacing text on the container filesystem using shell commands.
Input:
{
file_path: string; // Absolute path to file
old_string: string; // Text to find
new_string: string; // Text to replace with
replace_all?: boolean; // Replace all occurrences
}
Output:
{
replacements: number; // Number of replacements made
diff: StructuredPatch; // Unified diff of changes
}
Implementation:
Uses cat to read, performs replacement locally, then uses printf to write
back.
glob: GlobToolDefinitionSearches for files matching glob patterns.
Input:
{
base_path: string; // Absolute base path to search from
pattern: string; // Glob pattern (e.g., '**/*.ts')
include_hidden?: boolean; // Include hidden files
}
Output:
{
matches: string[]; // List of matching file paths
count: number; // Number of matches
}
The configuration object for creating a Remote instance:
{
container: string; // Name of the Docker container (required)
shell?: string; // Shell to use (default: 'sh')
}
Shell options:
'sh' - Default, uses whatever shell is symlinked as /bin/sh in the
container'bash' - Bash shell (must be available in container)'zsh' - Zsh shell (must be available in container)'dash' - Dash shell (must be available in container)Example:
const remote = new Remote({
container: 'my-app',
shell: 'bash',
});
const remote = new Remote({ container: 'my-app' });
const result = await remote.bash.handler({
command: 'some-command',
});
if (result.isError) {
console.error('Command failed:', result.content[0].text);
} else {
console.log('Success:', result.content[0].text);
}
const remote = new Remote({ container: 'my-app' });
// Start a long-running command in the background
const startResult = await remote.bash.handler({
command: 'npm run build',
run_in_background: true,
description: 'Building project',
});
const { shellId } = startResult.structuredContent;
// Check output periodically
const checkOutput = async () => {
const output = await remote.bashOutput.handler({ shell_id: shellId });
console.log(output.content[0].text);
if (output.structuredContent.status === 'running') {
setTimeout(checkOutput, 1000);
}
};
checkOutput();
const remote = new Remote({ container: 'my-app' });
// Find all TypeScript files
const files = await remote.glob.handler({
base_path: '/app',
pattern: '**/*.ts',
});
// Search for a pattern
const matches = await remote.grep.handler({
pattern: 'TODO',
path: '/app/src',
glob: '*.ts',
output_mode: 'content',
'-n': true,
});
// Edit a file
await remote.edit.handler({
file_path: '/app/config.ts',
old_string: 'localhost',
new_string: 'example.com',
replace_all: true,
});
docker commandApache-2.0
FAQs
Docker remote tools for AI agents
We found that @agent-remote/docker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.