An open API service indexing awesome lists of open source software.

https://github.com/slicequeue/k-targo-subway-mcp-server


https://github.com/slicequeue/k-targo-subway-mcp-server

Last synced: 10 months ago
JSON representation

Awesome Lists containing this project

README

          

# πŸ‡°πŸ‡· K-Targo Subway MCP Server
[![smithery badge](https://smithery.ai/badge/@slicequeue/k-targo-subway-mcp-server)](https://smithery.ai/server/@slicequeue/k-targo-subway-mcp-server)

ν•œκ΅­ μ§€ν•˜μ²  정보λ₯Ό μ œκ³΅ν•˜λŠ” MCP (Model Context Protocol) μ„œλ²„μž…λ‹ˆλ‹€.

## πŸš‡ μ£Όμš” κΈ°λŠ₯

- **μ§€ν•˜μ² μ—­ 검색**: μ—­λͺ…μœΌλ‘œ μ§€ν•˜μ² μ—­ 정보 검색
- **μ—΄μ°¨ μ‹œκ°„ν‘œ 쑰회**: νŠΉμ • μ—­μ˜ μ—΄μ°¨ μ‹œκ°„ν‘œ 쑰회
- **μ‹€μ‹œκ°„ μ§€ν•˜μ²  정보**: Tago APIλ₯Ό ν†΅ν•œ μ‹€μ‹œκ°„ 데이터 제곡
- **MCP ν‘œμ€€ μ€€μˆ˜**: Model Context Protocol ν‘œμ€€μ„ λ”°λ₯΄λŠ” 도ꡬ 제곡

## πŸ› οΈ μ„€μΉ˜ 및 μ‚¬μš©

### Installing via Smithery

To install k-targo-subway-mcp-server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@slicequeue/k-targo-subway-mcp-server):

```bash
npx -y @smithery/cli install @slicequeue/k-targo-subway-mcp-server --client claude
```

### 1. 곡곡데이터 API ν‚€ μ„€μ •
이 μ„œλ²„λŠ” **ꡭ토ꡐ톡뢀_(TAGO)_μ§€ν•˜μ² μ •λ³΄** APIλ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€. μ‚¬μš©ν•˜κΈ° 전에 API ν‚€λ₯Ό μ„€μ •ν•΄μ•Ό ν•©λ‹ˆλ‹€.

#### API 정보
- **API λͺ…**: ꡭ토ꡐ톡뢀_(TAGO)_μ§€ν•˜μ² μ •λ³΄
- **API URL**: https://www.data.go.kr/data/15098554/openapi.do
- **μ œκ³΅κΈ°κ΄€**: ꡭ토ꡐ톡뢀
- **데이터 ν˜•μ‹**: JSON

#### API ν‚€ λ°œκΈ‰
1. [곡곡데이터포털](https://www.data.go.kr/)에 κ°€μž…
2. "ꡭ토ꡐ톡뢀_(TAGO)_μ§€ν•˜μ² μ •λ³΄" API μ‹ μ²­
3. 승인 ν›„ λ°œκΈ‰λ°›μ€ API ν‚€λ₯Ό ν™˜κ²½λ³€μˆ˜λ‘œ μ„€μ •

#### ν™˜κ²½λ³€μˆ˜ μ„€μ •
```bash
# Windows
set GOV_API_KEY=your_api_key_here

# macOS/Linux
export GOV_API_KEY=your_api_key_here

# .env 파일 μ‚¬μš© (ꢌμž₯)
echo "GOV_API_KEY=your_api_key_here" > .env
```

### 2. npx둜 μ¦‰μ‹œ μ‹€ν–‰ (ꢌμž₯)
```bash
npx k-targo-subway-mcp-server
```

### 3. npm으둜 μ„€μΉ˜
```bash
npm install k-targo-subway-mcp-server
```

### 4. κΈ€λ‘œλ²Œ μ„€μΉ˜
```bash
npm install -g k-targo-subway-mcp-server
```

## πŸ“¦ MCP 도ꡬ

### 1. μ§€ν•˜μ² μ—­ 검색 (`search_subway_station`)
μ§€ν•˜μ² μ—­λͺ…μœΌλ‘œ μ—­ 정보λ₯Ό κ²€μƒ‰ν•©λ‹ˆλ‹€.

**μž…λ ₯ νŒŒλΌλ―Έν„°:**
- `stationName` (string): 검색할 μ—­λͺ…

**μ‚¬μš© μ˜ˆμ‹œ:**
```typescript
// "강남" μ—­ 검색
const result = await searchSubwayStationTool.handler({
stationName: "강남"
}, {});
```

### 2. μ—΄μ°¨ μ‹œκ°„ν‘œ 쑰회 (`get_station_timetable`)
νŠΉμ • μ—­μ˜ μ—΄μ°¨ μ‹œκ°„ν‘œλ₯Ό μ‘°νšŒν•©λ‹ˆλ‹€.

**μž…λ ₯ νŒŒλΌλ―Έν„°:**
- `stationCode` (string): μ—­ μ½”λ“œ
- `direction` (string): λ°©ν–₯ (상행/ν•˜ν–‰)

**μ‚¬μš© μ˜ˆμ‹œ:**
```typescript
// 강남역 상행 μ‹œκ°„ν‘œ 쑰회
const result = await getStationTimetableTool.handler({
stationCode: "0222",
direction: "상행"
}, {});
```

## πŸ—οΈ ν”„λ‘œμ νŠΈ ꡬ쑰

```
src/
β”œβ”€β”€ config/ # μ„€μ • 파일
β”‚ └── index.ts
β”œβ”€β”€ external/ # μ™ΈλΆ€ API 연동
β”‚ β”œβ”€β”€ common/ # 곡톡 μœ ν‹Έλ¦¬ν‹°
β”‚ └── tago-subway/ # Tago μ§€ν•˜μ²  API
β”‚ β”œβ”€β”€ api.ts # API ν΄λΌμ΄μ–ΈνŠΈ
β”‚ β”œβ”€β”€ service.ts # λΉ„μ¦ˆλ‹ˆμŠ€ 둜직
β”‚ β”œβ”€β”€ dtos/ # 데이터 전솑 객체
β”‚ └── types/ # νƒ€μž… μ •μ˜
β”œβ”€β”€ tools/ # MCP 도ꡬ듀
β”‚ β”œβ”€β”€ subway.ts # μ§€ν•˜μ²  κ΄€λ ¨ 도ꡬ
β”‚ β”œβ”€β”€ index.ts # 도ꡬ듀 톡합
β”‚ └── types.ts # 도ꡬ νƒ€μž… μ •μ˜
β”œβ”€β”€ utils/ # μœ ν‹Έλ¦¬ν‹°
β”‚ β”œβ”€β”€ PackageJsonUtil.ts
β”‚ └── ResponseUtil.ts
└── index.ts # 메인 μ§„μž…μ 
```

## πŸ”§ 개발 ν™˜κ²½ μ„€μ •

### 1. μ˜μ‘΄μ„± μ„€μΉ˜
```bash
npm install
```

### 2. API ν‚€ μ„€μ •
```bash
# .env 파일 생성
echo "GOV_API_KEY=your_api_key_here" > .env

# λ˜λŠ” ν™˜κ²½λ³€μˆ˜λ‘œ μ„€μ •
export GOV_API_KEY=your_api_key_here # macOS/Linux
set GOV_API_KEY=your_api_key_here # Windows
```

#### .env 파일 μ˜ˆμ‹œ
```env
# ꡭ토ꡐ톡뢀_(TAGO)_μ§€ν•˜μ² μ •λ³΄ API ν‚€
# 곡곡데이터포털(https://www.data.go.kr/)μ—μ„œ λ°œκΈ‰λ°›μ€ API ν‚€λ₯Ό μ„€μ •ν•˜μ„Έμš”
# API URL: https://www.data.go.kr/data/15098554/openapi.do
GOV_API_KEY=your_public_data_api_key_here

# μ˜ˆμ‹œ:
# GOV_API_KEY=abc123def456ghi789jkl012mno345pqr678stu901vwx234yz567
```

### 3. 개발 μ„œλ²„ μ‹€ν–‰
```bash
npm run dev
```

### 4. λΉŒλ“œ
```bash
npm run build
```

### 5. ν…ŒμŠ€νŠΈ
```bash
# 전체 ν…ŒμŠ€νŠΈ
npm test

# API ν…ŒμŠ€νŠΈ
npm run test:api

# νŠΉμ • μ—­ ν…ŒμŠ€νŠΈ
npm run test:api:station
```

## πŸ“‘ API 연동

### ꡭ토ꡐ톡뢀_(TAGO)_μ§€ν•˜μ² μ •λ³΄ API
- **API λͺ…**: ꡭ토ꡐ톡뢀_(TAGO)_μ§€ν•˜μ² μ •λ³΄
- **API URL**: https://www.data.go.kr/data/15098554/openapi.do
- **μ œκ³΅κΈ°κ΄€**: ꡭ토ꡐ톡뢀
- **κΈ°λ³Έ URL**: `https://api.tago.go.kr`
- **인증**: 곡곡데이터 API ν‚€ 기반 인증 (`GOV_API_KEY` ν™˜κ²½λ³€μˆ˜)
- **데이터 ν˜•μ‹**: JSON
- **API ν‚€ λ°œκΈ‰**: [곡곡데이터포털](https://www.data.go.kr/)μ—μ„œ "ꡭ토ꡐ톡뢀_(TAGO)_μ§€ν•˜μ² μ •λ³΄" μ‹ μ²­

### ν™˜κ²½λ³€μˆ˜ μ„€μ •
```bash
# ν•„μˆ˜ ν™˜κ²½λ³€μˆ˜
GOV_API_KEY=your_public_data_api_key_here
```

### μ£Όμš” μ—”λ“œν¬μΈνŠΈ
- `GET /subway-station/search`: μ§€ν•˜μ² μ—­ 검색
- `GET /subway-station/{stationCode}/timetable`: μ—΄μ°¨ μ‹œκ°„ν‘œ 쑰회

## 🎯 μ‚¬μš© 예제

### MCP ν΄λΌμ΄μ–ΈνŠΈ μ„€μ •
MCP ν΄λΌμ΄μ–ΈνŠΈμ—μ„œ 이 μ„œλ²„λ₯Ό μ‚¬μš©ν•˜λ €λ©΄ λ‹€μŒκ³Ό 같이 μ„€μ •ν•˜μ„Έμš”:

```json
{
"mcpServers": {
"k-targo-subway": {
"command": "npx",
"args": ["k-targo-subway-mcp-server"],
"env": {
"GOV_API_KEY": "your_targo_api_key_here"
}
}
}
}
```

### MCP ν΄λΌμ΄μ–ΈνŠΈμ—μ„œ μ‚¬μš©
```typescript
// μ§€ν•˜μ² μ—­ 검색
const searchResult = await mcpClient.callTool('search_subway_station', {
stationName: '강남'
});

// μ‹œκ°„ν‘œ 쑰회
const timetableResult = await mcpClient.callTool('get_station_timetable', {
stationCode: '0222',
direction: '상행'
});
```

### CLIμ—μ„œ 직접 μ‹€ν–‰
```bash
# npx둜 μ‹€ν–‰ (ꢌμž₯)
npx k-targo-subway-mcp-server

# κΈ€λ‘œλ²Œ μ„€μΉ˜ ν›„ μ‹€ν–‰
k-targo-subway-mcp-server

# λ˜λŠ” npm 슀크립트둜 μ‹€ν–‰
npm start
```

## πŸ”„ 개발 μ›Œν¬ν”Œλ‘œμš°

1. **μƒˆ κΈ°λŠ₯ μΆ”κ°€**: `src/tools/`에 μƒˆ 도ꡬ 파일 생성
2. **API 연동**: `src/external/`에 μ™ΈλΆ€ API ν΄λΌμ΄μ–ΈνŠΈ μΆ”κ°€
3. **νƒ€μž… μ •μ˜**: ν•„μš”ν•œ νƒ€μž…λ“€μ„ μ •μ˜
4. **ν…ŒμŠ€νŠΈ**: `test/` 디렉토리에 ν…ŒμŠ€νŠΈ μ½”λ“œ μž‘μ„±
5. **λΉŒλ“œ 및 배포**: `npm run build` ν›„ 배포

## πŸ“š μ£Όμš” κ°œλ…

### MCP Tool
μ‚¬μš©μžκ°€ ν˜ΈμΆœν•  수 μžˆλŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€. μž…λ ₯ μŠ€ν‚€λ§ˆμ™€ ν•Έλ“€λŸ¬ ν•¨μˆ˜λ‘œ κ΅¬μ„±λ©λ‹ˆλ‹€.

### TAGO API
κ΅­ν† κ΅ν†΅λΆ€μ—μ„œ μ œκ³΅ν•˜λŠ” μ§€ν•˜μ²  정보 APIμž…λ‹ˆλ‹€. 곡곡데이터포털을 톡해 μ œκ³΅λ©λ‹ˆλ‹€.

### μ§€ν•˜μ² μ—­ μ½”λ“œ
각 μ§€ν•˜μ² μ—­μ€ κ³ μœ ν•œ μ½”λ“œλ₯Ό κ°€μ§€κ³  μžˆμŠ΅λ‹ˆλ‹€ (예: 강남역 = "0222").

## πŸš€ 배포

```bash
# λΉŒλ“œ
npm run build

# npm 배포
npm publish

# μ‹€ν–‰
node dist/index.js
```

## πŸ“„ λΌμ΄μ„ μŠ€

MIT License

## 🀝 κΈ°μ—¬ν•˜κΈ°

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## πŸ“ž 문의

- **GitHub**: [https://github.com/slicequeue/k-targo-subway-mcp-server](https://github.com/slicequeue/k-targo-subway-mcp-server)
- **Issues**: [https://github.com/slicequeue/k-targo-subway-mcp-server/issues](https://github.com/slicequeue/k-targo-subway-mcp-server/issues)

## πŸ™ κ°μ‚¬μ˜ 말

- [ꡭ토ꡐ톡뢀_(TAGO)_μ§€ν•˜μ² μ •λ³΄](https://www.data.go.kr/data/15098554/openapi.do) - μ§€ν•˜μ²  정보 제곡
- [곡곡데이터포털](https://www.data.go.kr/) - API μ„œλΉ„μŠ€ 제곡
- [Model Context Protocol](https://modelcontextprotocol.io) - MCP ν‘œμ€€
- [Node.js](https://nodejs.org) - λŸ°νƒ€μž„ ν™˜κ²½