agent-mcp-cars

agent-mcp-cars is a Python library designed for processing and analyzing automotive-related data. Users can efficiently manage vehicle information and perform various automation tasks. It is particularly focused on data collection, transformation, and analysis, making it a valuable tool for developers.

GitHub Stars

0

User Rating

Not Rated

Favorites

0

Views

17

Forks

0

Issues

0

README
๐Ÿš— AGENT MCP CARS

Python

An interactive CLI agent that communicates with an MCP server to query a car database.
The goal is to build an AI agent that decides when to send requests to the MCP server โ€” which then queries the database and returns the results.

Agent โ”€โ”€โ–ถ MCP Server โ”€โ”€โ–ถ Database  
       โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Project structure
โ”œโ”€โ”€ cars.db # SQLite database, create with the seed script
โ”œโ”€โ”€ main.py # Main entry point
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ scripts
โ”‚ย ย  โ”œโ”€โ”€ read_db.py # Look at every entry in the database
โ”‚ย ย  โ””โ”€โ”€ start_mcp_server.py # Run the MCP server
โ”œโ”€โ”€ src
โ”‚ย ย  โ””โ”€โ”€ app
โ”‚ย ย      โ”œโ”€โ”€ agent
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ agent_llm.py
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ tools.py
โ”‚ย ย      โ”œโ”€โ”€ cli
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ interface.py
โ”‚ย ย      โ”œโ”€โ”€ database
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ config.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ seed.py
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ session.py
โ”‚ย ย      โ”œโ”€โ”€ mcp
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ client.py
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ server.py
โ”‚ย ย      โ”œโ”€โ”€ models
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ car.py
โ”‚ย ย      โ””โ”€โ”€ runner.py # Run the CLI with commands
โ”œโ”€โ”€ tests
โ”‚ย ย  โ””โ”€โ”€ test_agent.py
โ””โ”€โ”€ uv.lock

๐Ÿ“ฆ Running the Project

This guide explains how to run the complete system โ€” including the MCP server, CLI interface, and database.

1. Clone the Repository
git clone https://github.com/vtigo/agent-mcp-cars.git
cd agent-mcp-cars
2. Set Up Environment Variables

Create a .env file in the root of the project:

DATABASE_URL=sqlite:///./cars.db
TOGETHER_API_KEY=sk-<your-together-api-key>
MCP_HOST=127.0.0.1
MCP_PORT=3333

๐Ÿ’ก If do not have a together api key, check out the next section.


2.1 ๐Ÿ“ก Using the Together API (skip if you already have a together api key)

This project requires access to a language model via Together.ai. If you do not already have an API key, follow these steps:

  1. Go to https://api.together.xyz
  2. Sign up for an account
  3. Navigate to the API section and generate your API key
  4. Add the key to your .env file as:
TOGETHER_API_KEY=sk-<your-together-api-key>

3. Install Dependencies
โœ… Option A: Using uv (recommended)
uv sync
source .venv/bin/activate      # Linux/macOS
.venv\Scripts\activate         # Windows
โœ… Option B: Using pip
python -m venv .venv
source .venv/bin/activate      # Linux/macOS
.venv\Scripts\activate         # Windows
pip install -r requirements.txt

๐Ÿ”ง Command Reference

All commands are run from the project root using either:

uv run main.py <command>
# OR (if not using uv)
python main.py <command>
๐Ÿ“… seed-db

Populate the database with fake car entries.
It also creates the database if it doesn't exist.

python main.py seed-db

๐Ÿ’ก Optional flag:
--reseed โ€” Drops and recreates all tables before seeding.

Example:

python main.py seed-db --reseed

๐Ÿ“ง mcp

Start the local MCP server.

python main.py mcp

Expected output:

MCP server running at 127.0.0.1:3333 ...

๐Ÿ’ฌ prompt

Starts an interactive CLI where you can ask the agent questions.
The agent will decide when to query the MCP server to fetch data.

python main.py prompt

โœ… check-db

Check that the database connection is functional and print a status report.

python main.py check-db

๐Ÿงช Example Workflow

Follow this step-by-step to run everything:

1. Seed the Database
python main.py seed-db --reseed
2. Start the MCP Server
python main.py mcp
3. Start the Interactive CLI Agent (in another terminal)
python main.py prompt

๐Ÿ“Œ Notes
  • All commands assume you're in the project root
  • The database file (cars.db) is created automatically when seeding