- Home
- MCP servers
- OPET Fuel Prices
OPET Fuel Prices
- python
0
GitHub Stars
python
Language
6 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"sinanerdinc-opet-mcp": {
"command": "uv",
"args": [
"run",
"--with",
"fastmcp",
"fastmcp",
"run",
"/your_absolute_path/opet-mcp/server.py"
],
"env": {
"OPET_API_URL": "http://localhost:8000"
}
}
}
}You set up this MCP server to access OPET fuel prices by province through Claude AI. It exposes endpoints to list provinces, fetch prices by province, and check the last update time, with clear error messages to help you diagnose issues quickly.
How to use
You use an MCP client to connect to the OPET Fuel Prices MCP Server. The server provides: a way to list all available provinces, fetch current fuel prices for a selected province, and retrieve the last update timestamp. You can rely on detailed error messages when something goes wrong to quickly identify and fix issues.
Typical usage patterns include switching between provinces to compare prices, refreshing data after the last update time changes, and integrating these data points into automation or chat-based assistants. You will provide the OPET API URL to the MCP server so it can fetch the latest data from the OPET backend.
How to install
Prerequisites include Python 3.12 or higher and a package manager suitable for your setup, such as uvx or pip. You also need the OPET package installed and the OPET API server running.
Step by step setup and run flow:
# Prerequisites
# - Python 3.12+
# - uvx or pip
# - OPET package installed and API server running
Install the OPET package and start the API server as needed in your environment.
Install the MCP server for OPET Fuel Prices by cloning the project and preparing your environment as follows:
# Prerequisites
# - Python 3.12+
# - uvx for environment management
# - OPET package installed and API server running
Create a Python virtual environment with uv, install dependencies, and synchronize the environment.
# 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
Configuration
Set the OPET API URL to point to your running OPET API server. This enables the MCP server to fetch live data.
export OPET_API_URL=http://localhost:8000
Running the server
Start the MCP server using the utilities you prepared during installation.
# With uv
uv run fastmcp run server.py
# With pip
fastmcp run server.py
Example configuration for Claude integration
Option 1: Install the OPET Fuel Prices MCP server with a custom name and API URL via the uv-based runtime.
{
"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"
}
}
}
}
Option 2: Installation command to set up the MCP server for Claude with the same API URL.
fastmcp install server.py --name "OPET Fuel Prices" \
--env-var OPET_API_URL=http://localhost:8000
Available tools (endpoints)
get_all_provinces() retrieves a list of all provinces where fuel prices are available.
get_fuel_prices_by_province(province_id) fetches current fuel prices for a specific province using its ID.
get_last_update_time() returns the timestamp of when the fuel prices were last updated.
Notes and tips
Ensure the OPET API URL is reachable from the MCP server host. If you run the OPET API on a non-default port, update OPET_API_URL accordingly.
If you encounter authentication or network errors, verify that OPET_API_URL is correct and that the OPET API server is running and accessible from the MCP host.
Available tools
get_all_provinces
Retrieves a list of all provinces where fuel prices are available.
get_fuel_prices_by_province
Fetches current fuel prices for a specific province using its ID.
get_last_update_time
Gets the timestamp of when the fuel prices were last updated.