Enables SQL-based manipulation of a retail car database, allowing users to query existing car listings and add new car advertisements through natural language interactions.
Data Engineer Agent with MCP Server
In this project I developed an AI agent that can manipulate a database of retail cars using SQL. The agent can add new ads or show the existing cars according to the user preference.
The code is split into three files:
dp.py
All the code relating to the SQL cursor and the LLM parser are located in this file. The execute_mysql_query runs the query and if it is a select query, it returns the results. The results of this function are passed to format_results_for_llm function to convert into a dict format using column headers for the llm to understand.
Server.py
This file is our MPC server connected to the database. The tool run_query is responsible for running the query on the database and provides the model with the schema for the database table.
agent.ipynb
This is the client for the server. I used LangChain MCP Adapters to convert the tools in the MCP server to LangChain tools and created a simple react agent. The code demonstrates two examples:
Example 1
In this example, the user wanted to buy a Toyota and the agent searched the database for Toyota cars and listed the results.
Example 2
In this example, the user wanted to sell a Ferrari. However, they did not provide enough information to the agent so the agent asked the user to complete the information and once it had enough information to fill every field it needed, it added the add to the database.
Disclamer
LangChain MCP Adapters is a fairly new package so I could not get it to work in a clean way. Maybe future updates can solve its issues.
This server cannot be installed
Enables AI agents to interact with a retail cars database using SQL queries. Supports adding new car advertisements and searching existing cars based on user preferences through natural language.
Related MCP Servers
- AsecurityAlicenseAqualityAllows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.Last updated -1752PythonMIT License
- -securityFlicense-qualityA powerful server that enables AI agents to interact with MySQL databases, execute SQL queries, and manage database content through a simple interface.Last updated -225JavaScript
Adb MySQL MCP Serverofficial
AsecurityAlicenseAqualityA universal interface that enables AI Agents to seamlessly communicate with Adb MySQL databases, allowing them to retrieve database metadata and execute SQL operations.Last updated -316PythonApache 2.0- -securityFlicense-qualityEnables searching for AI agents by keywords or categories, allowing users to discover tools like coding agents, GUI agents, or industry-specific assistants across marketplaces.Last updated -34Python