Skip to main content
Show how to run an interactive CLI to interact with an agent equipped with MCP tools.
This example starts the retired npm GitHub MCP server. The fence remains byte-matched to v2.7.4. Replace that command in the saved file with GitHub’s maintained MCP server before running it.
cli.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export environment variables

4

Use GitHub's maintained MCP server

Install and start Docker. Then replace npx -y @modelcontextprotocol/server-github in the saved file with docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN -e GITHUB_READ_ONLY=1 ghcr.io/github/github-mcp-server.
5

Run the example

Save the code above as cli.py, then run:
Full source: cookbook/91_tools/mcp/cli.py