MCP Car Database

by Gabriel-Maxsy
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Provides database functionality for storing and retrieving data about cars, enabling querying of the vehicle information stored in an SQLite database through the MCP protocol.

MCP Project

This is a finished project that uses the MCP (Model Context Protocol) protocol for communication between client and server. The project includes creating an SQLite database and implementing a client that queries that database.

Folder structure

📁 mcp-car
│-- 📂 app
│ ├── server.py # MCP server file
│ ├── database.py # Script responsible for creating the database
│-- 📂 client
│ ├── client.py # Main client code where interaction occurs
│-- 📂 useful
│ ├── create_cars.py # Generates dummy data for the database
│-- README.md # Project documentation

How to rotate the project

  1. Create and configure the virtual environment
    • To ensure that all project dependencies are installed correctly, it is recommended to create a virtual environment.
    • At the root of your project, run the following command to create a virtual environment:python -m venv venvRight away:.\venv\Scripts\activateSo to download the dependencies:pip install -r requirements.txt
    • This will install all the libraries the project needs to work properly.

Now you can proceed with the rest of the project configuration, with the virtual environment ready for use.

  1. Create the database
    • Navigate to the app folder.
    • Open the database.py file and run it to create the database in SQLite format inside your "data" folder. This script will create the necessary structure to store the car data.
  2. Populate the database with dummy data
    • Access the utils folder.
    • Open the create_cars.py file and run it to populate the database with 100 fictitious car records. This step is necessary to have data in the database before running the system.
  3. Run the client and query the data
    • With the database filled in, go to the client folder.
    • Run the client.py file to interact with the system. The agent will allow you to enter filters (such as make, model, year, etc.) to search for cars in the database.

Usage example

When running the client ( client.py ), you will be prompted for search criteria, such as:

  • Mark
  • Model
  • Year
  • Color
  • Maximum price

The client will send the query to the server, which will search the database and return the cars that meet the provided criteria.

You can stop searching by typing "exit" at any time.


Contributions

Feel free to explore and modify the project as needed. If you have any questions or would like to suggest improvements, please submit a pull request or contact us.

-
security - not tested
F
license - not found
-
quality - not tested

A client-server system using Model Context Protocol that allows users to query an SQLite database of fictitious car data.

  1. Estrutura de pastas
    1. Como rodar o projeto
      1. Exemplo de uso
        1. Contribuições
          ID: yxo3571cyo