mcp-client is a simple REST API and CLI client for interacting with Model Context Protocol (MCP) servers.
Purpose: This project aims to provide a client that allows users to interact with MCP servers via the command line or REST API, and execute prompts with the help of an LLM.
Main capabilities:
- Supports any MCP-compatible server.
- Preconfigured default servers: SQLite (provides test.db, containing sample product data) and Brave Search.
- Additional MCP servers can be added in the mcp-server-config.json file.
- Integrates LangChain to execute LLM prompts.
- Supports multiple MCP servers collaborating simultaneously to respond to a specific query.
- Compatible with any LLM provider that supports a function-based API, such as OpenAI, Claude, Gemini, AWS Nova, Groq, Ollama, etc.
Usage:
- Clone the repository: git clone https://github.com/rakesh-eltropy/mcp-client.git
- Enter the project directory: cd mcp-client
- Set the OPENAI_API_KEY environment variable: export OPENAI_API_KEY=your-openai-api-key. You can also set OPENAI_API_KEY in the mcp-server-config.json file, and you can set the provider and model in that file, for example provider as ollama and model as llama3.2:3b.
- Set the BRAVE_API_KEY environment variable: You can also set BRAVE_API_KEY in the mcp-server-config.json file. A free BRAVE_API_KEY can be obtained from the Brave Search API.
- Run from the CLI: uv run cli.py. Use the help option to explore the available commands. You can use the chat command to chat with the LLM. Example prompts: What is the capital city of India ? or Search the most expensive product from database and find more details about it from amazon ?
- Run from the REST API: uvicorn app:app --reload. You can use the following curl command to chat with the LLM: curl -X POST -H "Content-Type: application/json" -d '{"message": "list all the products from my local database?"}' http://localhost:8000/chat Using streaming: curl -X POST -H "Content-Type: application/json" -d '{"message": "list all the products from my local database?", "streaming": true}' http://localhost:8000/chat
Applicable scenarios: Suitable for developers who need to interact with LLMs through MCP servers, especially scenarios where they want to quickly integrate multiple MCP servers and multiple LLM providers using a REST API or CLI.
Limitations: The material does not provide more information about fees, pricing, platform restrictions, performance guarantees, etc.