MCP Client
@garvk
About MCP Client
Overview
What is MCP Client?
MCP Client is a Python implementation of the Model Context Protocol (MCP) that integrates with Claude 3.5 Sonnet. It runs on the command line or through a Chainlit UI, targeting developers who need to connect AI assistants to tools like PostgreSQL databases.
How to use MCP Client?
Ensure Python 3.12+, Node.js, and uv (or pip) are installed. Clone the repository, create and activate a virtual environment, then install dependencies: uv add mcp anthropic python-dotenv chainlit asyncpg and npm install @modelcontextprotocol/server-postgres. Add your Anthropic API key to a .env file. Run in CLI mode with uv run client.py <path-to-mcp-server> <database-url>, or in UI mode by first creating a PostgreSQL database named chat_history, running python app/init_db.py, then executing chainlit run app/chainlit_app.py. Type quit to exit.
Key features of MCP Client
- Interactive chat with Claude 3.5 Sonnet
- PostgreSQL database integration via MCP
- Support for Python and JavaScript MCP servers
- Tool-based query processing
- Command line and Chainlit UI modes
Use cases of MCP Client
- Query a PostgreSQL database using natural language
- Build a chat interface with live database access
- Prototype an AI assistant that fetches and processes database records
- Develop applications using the Model Context Protocol with minimal setup
FAQ from MCP Client
What are the prerequisites to run MCP Client?
You need Python 3.12 or higher, a PostgreSQL database, Node.js, and the uv package manager (or pip). An Anthropic API key is required.
How do I connect MCP Client to a database?
Pass the path to the MCP server JavaScript file and your PostgreSQL connection string as arguments to the client: uv run client.py ./path/to/server-postgres/index.js postgresql://localhost/your_database.
Can I use other MCP servers beyond PostgreSQL?
Yes. The README states support for both Python and JavaScript MCP servers, so you can adapt the client to any MCP-compatible server.
How do I run MCP Client with a graphical interface?
Use Chainlit: create a PostgreSQL database called chat_history, run python app/init_db.py to initialize tables, then start the UI with chainlit run app/chainlit_app.py.
What license does MCP Client use?
The project is licensed under the MIT License.
Basic information
Category
Other
Author

Comments