Skip to main content
Glama
KimJintak

opinet-mcp

by KimJintak

opinet-mcp

This is an MCP server that allows you to use the Korea Petroleum Corporation's Opinet fuel price information free API in MCP clients such as Claude / Claude Code.

  • Language: TypeScript (ESM)

  • SDK: @modelcontextprotocol/sdk

  • Transport: stdio

  • Call limit: 1,500 calls/day (Opinet policy)


Prerequisites

  1. Get an API Key from Opinet Free API

  2. Node.js 18 or higher (uses global fetch)


Related MCP server: realestate-mcp

Installation & Execution — 3 Methods

Available after publishing to the npm registry. See the "Deployment" section below for publishing.

OPINET_API_KEY=발급키 npx -y opinet-mcp

Method 2. Global installation

npm install -g opinet-mcp
OPINET_API_KEY=발급키 opinet-mcp

Method 3. Clone source (For development / private use)

git clone https://github.com/KimJintak/opinet-mcp.git
cd opinet-mcp
npm install
npm run build
OPINET_API_KEY=발급키 node dist/index.js

MCP Client Registration

Claude Desktop / Claude Code

Configuration file location:

OS

Path

macOS

~/Library/Application Support/Claude/claude_desktop_config.json

Windows

%APPDATA%\Claude\claude_desktop_config.json

Linux

~/.config/Claude/claude_desktop_config.json

A. npx method (Easiest — use after publishing)

{
  "mcpServers": {
    "opinet": {
      "command": "npx",
      "args": ["-y", "opinet-mcp"],
      "env": {
        "OPINET_API_KEY": "발급받은_키"
      }
    }
  }
}

B. Global installation method

{
  "mcpServers": {
    "opinet": {
      "command": "opinet-mcp",
      "env": {
        "OPINET_API_KEY": "발급받은_키"
      }
    }
  }
}

C. Local build method (If source is cloned)

{
  "mcpServers": {
    "opinet": {
      "command": "node",
      "args": ["/절대/경로/opinet-mcp/dist/index.js"],
      "env": {
        "OPINET_API_KEY": "발급받은_키"
      }
    }
  }
}

⚠️ Claude Desktop has limited inheritance of PATH. If it cannot find the command when running with command: "node" or "npx", specify the absolute path (e.g., /opt/homebrew/bin/node, /usr/local/bin/npx). Check with which node / which npx in the terminal.

After configuration, completely quit Claude Desktop (Cmd+Q) → Relaunch, and you will see 6 tools in the tool icon.

Other MCP Clients (Cursor, Cline, Continue, etc.)

You can add it to the MCP server configuration file of each client in the same way as the JSON structure above.


Provided Tools (6 types)

Tool name

Opinet endpoint

Description

get_national_average_price

avgAllPrice.do

National average gas station price (current)

get_sido_average_price

avgSidoPrice.do

Average gas station price by province (current)

get_recent_7days_price

avgRecentPrice.do

Daily national average price for the last 7 days (trend)

get_lowest_price_top20

lowTop10.do

TOP 20 lowest-priced gas stations by nation/region

search_stations_around

aroundAll.do

Search for gas stations within a radius based on KATEC coordinates

get_station_detail

detailById.do

View detailed information by gas station ID (UNI_ID)

Common Codes

Product Code (prodcd)

Code

Product

B027

Regular Gasoline

D047

Automotive Diesel

B034

Premium Gasoline

C004

Indoor Kerosene

K015

Automotive Butane

Province Code (sido / area 2 digits)

Code

Region

Code

Region

01

Seoul

10

Busan

02

Gyeonggi

11

Jeju

03

Gangwon

12

Daegu

04

Chungbuk

13

Incheon

05

Chungnam

14

Gwangju

06

Jeonbuk

15

Daejeon

07

Jeonnam

16

Ulsan

08

Gyeongbuk

17

Sejong

09

Gyeongnam

The city/county/district unit is a 4-digit code (e.g., 0207 = Gyeonggi Gwangmyeong-si). Can be queried separately via the Opinet areaCode.do endpoint.

Coordinate System Notes

The input coordinates (x, y) for search_stations_around and the GIS_X_COOR / GIS_Y_COOR in all responses are in the KATEC coordinate system. They are different from WGS84 (latitude/longitude), so if you want to receive latitude/longitude as input, convert them to KATEC in the client before calling.


Usage Examples (Natural Language)

  • "Tell me today's national average gasoline price" → get_national_average_price

  • "Average diesel price in Seoul" → get_sido_average_price (sido=01, prodcd=D047)

  • "Gasoline trend for the last 7 days" → get_recent_7days_price (prodcd=B027)

  • "5 cheapest gas stations for gasoline in Gwangmyeong-si" → get_lowest_price_top20 (prodcd=B027, area=0207, cnt=5)

  • "Detailed info for gas station ID A0008322" → get_station_detail


Verification (Smoke Test)

Run without an API key → If it guides you to environment variables and exits, the build is OK:

node dist/index.js

When you have an API key, call directly via stdio:

export OPINET_API_KEY=발급키

# 등록된 툴 목록 확인
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node dist/index.js

# 전국 평균가격 호출
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_national_average_price","arguments":{}}}' | node dist/index.js

Development

npm install
npm run dev      # tsc --watch
npm run build    # 한 번 빌드
npm start        # dist/index.js 실행
npm run clean    # dist 삭제

Project structure:

opinet-mcp/
├── src/
│   └── index.ts          # MCP 서버 본체
├── dist/                 # 빌드 결과물 (배포 대상)
├── package.json
├── tsconfig.json
├── README.md
└── LICENSE

Deployment (npm publish)

When publishing for the first time:

# 1) npm 로그인
npm login

# 2) package.json의 author / repository / name 확인 (필요하면 scoped: @yourname/opinet-mcp)

# 3) 빌드 + publish (prepublishOnly에서 자동 빌드됨)
npm publish

# scoped 패키지면
npm publish --access public

Version update afterwards:

npm version patch   # 0.1.0 -> 0.1.1
npm publish

After publishing, anyone can use it immediately with npx -y opinet-mcp.

There is a prepare script, so it builds automatically upon npm install. This means it also works if installed directly from GitHub (npm i github:KimJintak/opinet-mcp).


License

MIT.

The data source is the Korea Petroleum Corporation Opinet, and please follow the Opinet Terms of Service when using the data.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.1.0
    • First observedget_lowest_price_top20
    • First observedget_national_average_price
    • First observedget_recent_7days_price
    • First observedget_sido_average_price
    • First observedget_station_detail

TDQS

A3.7/5.0

Scored across 5 tools

Disambiguation4/5

Each tool targets a distinct data view (cheapest stations, national average, historical trends, regional averages, single station details). While all relate to fuel prices, the scope filters (top20, 7-day history, sido codes) create clear boundaries.

Naming Consistency5/5

All tools use consistent snake_case with a 'get_' verb prefix followed by descriptive noun phrases (lowest_price_top20, national_average_price, etc.). The pattern is predictable throughout.

Tool Count4/5

Five tools cover the essential read-only queries for a fuel price information service without bloat. The scope is well-contained, though an additional search-by-radius or brand filter could round it out.

Completeness4/5

Core price discovery workflows are covered: finding cheap stations, checking averages at national/regional levels, viewing trends, and drilling into station details. Minor gaps include no brand-specific queries or historical data beyond 7 days.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables natural language querying of Korean statistical data from KOSIS, including population, employment, GDP, housing prices, and more, with support for regional and trend analysis.
    8
    61
    16
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables querying Korean apartment sales and rental transaction data from the public data portal through natural language, with tools for searching transactions and computing price statistics.
    4
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI to query real-time Korean public data including weather, real estate prices, air quality, economic indicators, and business registration via natural language.
    1
    MIT

Appeared in Searches