MCP Client logo

MCP Client

by MCP-Mirror

This is a Python client for interacting with an MCP (Module Communication Protocol) server. It allows you to execute tools on the server and retrieve results.

View on GitHub

Last updated: N/A

What is MCP Client?

This is a Python client designed to communicate with an MCP server, enabling the execution of tools and retrieval of results. It provides a way to interact with the server's filesystem and other functionalities.

How to use MCP Client?

  1. Set up a virtual environment and install dependencies using pip install -r requirements.txt. 2. Configure the .env file with the server path and allowed directory. 3. Run the client using python client.py. You can optionally specify a tool and arguments using command-line flags like --tool and --args.

Key features of MCP Client

  • Connects to a filesystem server

  • Lists available tools

  • Executes specified tools with arguments

  • Displays results to the console

Use cases of MCP Client

  • Testing filesystem server functionality

  • Automated execution of server-side tools

  • Remote file management

  • Interacting with MCP server from a Python environment

FAQ from MCP Client

What is the purpose of the .env file?

The .env file stores the server path and the allowed directory, as well as optional tool and arguments for testing.

How do I specify a different tool to run?

You can specify a tool using the --tool argument when running the client, for example: python client.py --tool list_directory --args '{"path": "/path/to/directory", "recursive": true}'.

What should I do if the client fails to connect to the server?

Ensure that the server is running and that the SERVER_PATH in the .env file is correct.

How do I verify that the client is working correctly?

Check the client output for the list of available tools and the result of the tool call. Also, verify any side effects of the tool, such as file creation.

What is the default tool if I don't specify one?

If no tool is specified in the .env file, the client will attempt to call the write_file tool to create a test file.