Introducing MCP Tools: A Command-Line Inspector for Model Context Protocol Servers

Open LLM-readable version of this post

Discover MCP Tools, a powerful CLI for interacting with Model Context Protocol servers using stdio transport. Learn how to discover and call tools, list resources, and interact with MCP-compatible services.

Introducing MCP Tools: A Command-Line Inspector for Model Context Protocol Servers

View on GitHub

After developing several Model Context Protocol (MCP) servers in my previous blog posts, I realized we needed a standardized way to interact with these servers from the command line. Today, I’m excited to introduce MCP Tools - a command-line interface I’ve built specifically for working with MCP servers using stdio transport.

What is MCP Tools?

MCP Tools is a Go-based CLI application that makes it easy to discover and interact with Model Context Protocol servers. It provides a unified interface for listing available tools, resources, and prompts, as well as calling these capabilities directly from your terminal.

The most exciting feature is the interactive shell mode, which allows you to maintain a persistent connection to an MCP server and execute multiple commands in sequence:

mcp shell npx -y @modelcontextprotocol/server-filesystem ~/Code

This will open an interactive shell that looks like this:

MCP Tools Screenshot

Installation Options

You can install MCP Tools in two ways:

Using Homebrew

brew tap f/mcptools
brew install mcp

From Source

go install github.com/f/mcptools/cmd/mcptools@latest

Key Features

MCP Tools provides several commands for working with MCP servers:

  • tools: List available tools on the MCP server
  • resources: List available resources on the MCP server
  • prompts: List available prompts on the MCP server
  • call: Call a tool, resource, or prompt on the MCP server
  • shell: Start an interactive shell for executing multiple MCP commands
  • version: Print the version information

Transport

MCP Tools uses stdin/stdout to communicate with an MCP server via JSON-RPC 2.0. This is perfect for command-line tools that implement the MCP protocol:

mcp tools npx -y @modelcontextprotocol/server-filesystem ~/Code

Output Formats

MCP Tools supports three output formats to match your needs:

  1. Table Format (Default): Displays the output in a tabular view for better readability
  2. JSON Format: Displays the output as compact JSON
  3. Pretty Format: Displays the output as indented JSON

You can specify the format using the --format flag:

mcp tools --format pretty npx -y @modelcontextprotocol/server-filesystem ~/Code

Practical Examples

Let’s look at some examples of how you can use MCP Tools in practice:

Listing Available Tools

mcp tools npx -y @modelcontextprotocol/server-filesystem ~/Code

Calling a Tool

You can call tools with parameters using the call command:

mcp call read_file --params '{"path": "/path/to/file"}' npx -y @modelcontextprotocol/server-filesystem ~/Code

Working with Resources and Prompts

Similarly, you can list and call resources and prompts:

# List available resources
mcp resources npx -y @modelcontextprotocol/server-filesystem ~/Code

# Call a specific resource
mcp call resource:my-resource npx -y @modelcontextprotocol/server-filesystem ~/Code

Interactive Shell Mode

The shell mode is where MCP Tools really shines. It opens an interactive shell where you can run multiple MCP commands without reconnecting to the server:

mcp > connected to MCP server over stdio
mcp > Type '/h' for help or '/q' to quit
mcp > tools
NAME        DESCRIPTION
----        -----------
read_file   Reads a file from the filesystem
...

mcp > call read_file --params '{"path": "README.md"}'
...content of README.md...

# Direct tool calling is supported
mcp > read_file {"path": "README.md"}
...content of README.md...

Special shell commands include:

  • /h or /help: Show help information
  • /q, /quit, or exit: Exit the shell
  • format [json|pretty|table]: Get or set the output format

Why MCP Tools Matters

Having built several MCP servers in my previous blog posts, MCP Tools represents an important step in the evolution of the Model Context Protocol ecosystem. It provides:

  1. A standardized interface for interacting with any MCP server
  2. Enhanced developer experience with an interactive shell
  3. Simplified debugging for MCP server development

Roadmap

While the current version of MCP Tools focuses on stdio transport, I’m actively working on expanding its capabilities. Here’s what you can expect in upcoming releases:

  1. HTTP Transport Support: Connect to remote MCP servers using HTTP transport
  2. Authentication: MCP connections auth methods

I’m particularly excited about HTTP transport support, which will allow you to interact with remote MCP servers just as easily as local ones. This feature is currently in development and should be available in the next major release.

Conclusion

MCP Tools complements the MCP servers we’ve been building in the previous posts. It makes working with MCP servers more efficient and pleasant, whether you’re developing a new server or integrating with existing ones.

Give it a try by installing with Homebrew (brew tap f/mcptools && brew install mcp) or from source, and let me know how it works for you. The project is available on GitHub at github.com/f/mcptools.

This article was proofread and edited with AI assistance.

Cookies