A Model Context Protocol (MCP) server that provides access to OPET fuel prices data through Claude AI.
- Get all available provinces
- Fetch fuel prices for specific provinces
- Get last update timestamp
- Error handling with detailed messages
Before using this MCP server, you need to set up the OPET API server first.
Install the OPET package from https://github.com/sinanerdinc/opet:
pip install opet
Start the API server using one of the following methods:
Option A: Using CLI
opet-cli --api
Option B: Using Docker
docker run -p 8000:8000 sinanerdinc/opet api
Option C: Using Docker with custom port
docker run -p 5050:8000 sinanerdinc/opet api
The API server will be available at http://localhost:8000
(or your custom port).
- Python 3.12 or higher
- uv package manager (recommended) or pip
- OPET package installed and API server running
- Clone the repository:
git clone <repository-url>
cd opet-mcp
- Using uv
# Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and install dependencies
uv venv -p 3.12
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv sync
Set the OPET API URL using environment variables. The URL should point to your running OPET API server:
# If using default port (8000)
export OPET_API_URL=http://localhost:8000
# If using custom port (e.g., 5050)
export OPET_API_URL=http://localhost:5050
Start the MCP server:
# With uv
uv run fastmcp run server.py
# With pip
fastmcp run server.py
{
"mcpServers": {
"Opet Server": {
"command": "uv",
"args": [
"run",
"--with",
"fastmcp",
"fastmcp",
"run",
"/your_absolute_path/opet-mcp/server.py"
],
"env": {
"OPET_API_URL": "http://localhost:8000"
}
}
}
}
fastmcp install server.py --name "OPET Fuel Prices" \
--env-var OPET_API_URL=http://localhost:8000
Retrieves a list of all provinces where fuel prices are available.
Fetches current fuel prices for a specific province using its ID.
Parameters:
province_id
(str): The unique identifier of the province
Gets the timestamp of when the fuel prices were last updated in the system.
This project is licensed under the MIT License - see the LICENSE file for details.