MCP Host CLI MCP server

Command-line tool for creating and managing MCP hosts with streamlined setup for developers integrating AI capabilities into applications.
Back to servers
Setup instructions
Provider
Liu Jilong
Release date
Mar 15, 2025
Language
TypeScript
Package
Stats
681 downloads
7 stars

MCP-Host-CLI is a Node.js-based Model Context Protocol (MCP) host application that connects and manages multiple MCP servers. It provides a unified interface allowing clients to interact with multiple MCP servers through HTTP APIs, accessing and invoking tools (or resources). You can use it to quickly test and run your MCP Servers.

Installation

Using NPM Package (Recommended)

The simplest way to install and run MCP-Host-CLI is using npx:

npx mcp-host-cli

Local Build

Alternatively, you can clone the repository and build it locally:

  1. Clone the repository:

    git clone https://github.com/liujilongObject/mcp-host-cli.git
    
  2. Install dependencies:

    npm install
    
  3. Run in development mode:

    npm run dev
    
  4. Or build and run in production mode:

    npm run build
    node dist/index.js
    

Configuration

MCP-Host-CLI reads a configuration file named mcp_servers.config.json from the current working directory. The file format is as follows:

{
    "mcp_servers": [
        {
            "enabled": true,
            "type": "stdio",
            "server_name": "server-puppeteer",
            "command": "npx",
            "args": [
                "-y",
                "@modelcontextprotocol/server-puppeteer"
            ]
        },
        {
            "enabled": true,
            "type": "sse",
            "server_name": "server-everything-sse",
            "sse_url": "http://localhost:3001/sse"
        },
        {
            "enabled": true,
            "type": "stdio",
            "server_name": "github",
            "command": "npx",
            "args": [
                "-y",
                "@modelcontextprotocol/server-github"
            ],
            "env": {
                "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
            }
        }
    ]
}

Usage

The server runs on port 17925 by default. Here are the available API endpoints:

Tools API

Get All Tools

Retrieve a list of all available tools from all connected servers:

GET http://localhost:17925/api/tools

Response:

{
  "code": 0,
  "data": [
    {
      "server_name": "server1",
      "tools": [
        {
          "name": "toolName",
          "description": "Tool description",
          "inputSchema": { /* schema */ }
        }
      ]
    }
  ]
}

Call a Tool

Execute a specific tool on a server:

POST http://localhost:17925/api/tools/toolCall
Content-Type: application/json

{
  "server_name": "serverName",
  "tool_name": "toolName",
  "tool_args": { /* arguments */ }
}

Response:

{
  "code": 0,
  "data": {
    "result": "Tool execution result"
  }
}

Resources API

Get All Resources

Retrieve a list of all available resources from all connected servers:

GET http://localhost:17925/api/resources

Response:

{
  "code": 0,
  "data": [
    {
      "server_name": "server1",
      "resources": [
        {
          "uri": "resourceURI",
          "mimeType": "resourceType",
          "name": "resourceName"
        }
      ]
    }
  ]
}

Read a Specific Resource

Retrieve a specific resource from a server:

POST http://localhost:17925/api/resources/read
Content-Type: application/json

{
  "server_name": "serverName",
  "resource_uri": "resourceURI"
}

Response:

{
  "code": 0,
  "data": [
    {
      "mimeType": "resourceType",
      "text": "text resource",
      "blob": "blob resource"
    }
  ]
}

Connections API

Update Server Connections

Update server connections without restarting the Host service. The Host will read the updated configuration file and create/restart/delete server connections accordingly:

POST http://localhost:17925/api/connections/update

Response will show the updated server configurations.

Important Notes

  • The server runs on port 17925 by default
  • Ensure the server information in the configuration file is correct
  • For STDIO transport, make sure the command is executable
  • For SSE transport, ensure the URL is accessible
  • When using npx commands, the system's Node.js environment is used by default, but you can also use a custom Node.js runtime

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "mcp-host-cli" '{"command":"npx","args":["mcp-host-cli"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "mcp-host-cli": {
            "command": "npx",
            "args": [
                "mcp-host-cli"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "mcp-host-cli": {
            "command": "npx",
            "args": [
                "mcp-host-cli"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later