
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
Convert a Model Context Protocol (MCP) server to a CLI application.
This is useful if you want to use an MCP server's tools, resources, and prompts outside an MCP client. The mcp-2-cli library acts as a MCP client with the CLI as the interface.
You may want to use an MCP server's tools inside an Agent Skill or in a programmatic script.
Currently, mcp-2-cli only supports stdio MCP servers.
Support for Streamable HTTP servers coming soon!
You must first create a JSON configuration file with the following schema:
{
"command": "<root command>", // Required
"args": ["--additional", "args"] // Optional
"transport": "stdio" // Required. currently only "stdio" supported
"cliName": "<name>" // Optional. defaults to "mcp-cli"
}
For example:
{
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
"transport": "stdio",
"cliName": "fs-cli"
}
mcp-2-cli will first look for this file in the environment variable MCP_2_CLI_CONFIG_PATH.
If the environment variable is not provided, mcp-2-cli will look for a
file named mcp-2-cli.config.json in the current directory.
To run the MCP CLI, you can use npx:
MCP_2_CLI_CONFIG_PATH="path/to/config.json" npx mcp-2-cli <args...>
An mcp-2-cli CLI automatically get commands for all available prompts, resources, and tools.
The generated CLI follows CLI best practices, with nested actions and --help commands.
The CLI commands use the following pattern:
mcp-cli <action> <name> --arg1 val1 --arg2 val2 ...
For example, to use the server-filesystem MCP's read_text_file tool:
server-filesystem tools read_text_file --path path/to/file.ext
If there are not any available actions for one of the prompts, resources or tools action categories, those actions categories will not be listed. For example, if your server supports only tools but no prompts and resources, only mcp-cli tools would be a valid command.
# List all available prompts
mcp-cli prompts -help
# Get a specific prompt
mcp-cli prompts <prompt-name>
# Get help with specific prompt
mcp-cli prompts <prompt-name> --help
# List all available resources
mcp-cli resources -help
# Get a specific resource
mcp-cli resources <resource-uri>
# Get help with a specific resource
mcp-cli resources <resource-uri> --help
# List all available tools
mcp-cli tools --help
# Call a tool (with optional arguments as JSON)
mcp-cli tools <tool-name>
# Get help with a specific tool
mcp-cli tools <tool-name> --help
npm install mcp-2-cli
import { createMcpCli } from 'mcp-2-cli';
const config = {
command: 'npx',
args: ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'],
transport: 'stdio',
name: "filesystem-cli"
};
const cli = await createMcpCli(config);
await cli.parseAsync();
FAQs
Convert any MCP server to a CLI application
We found that mcp-2-cli 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
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.