K-Targo Subway MCP Server
# π°π· 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) - λ°νμ νκ²½ TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose: get_all_subway_timetables retrieves comprehensive timetables for all days and directions, get_subway_timetable provides filtered timetables by day and direction, and search_subway_station finds station information. There is no overlap or ambiguity between these functions.
All tool names follow a consistent snake_case pattern with a clear verb_noun structure: get_all_subway_timetables, get_subway_timetable, and search_subway_station. The naming is predictable and readable throughout.
With only 3 tools, the server feels thin for a subway domain that might benefit from additional operations like route planning or real-time status. However, the tools cover core timetable and station search functions, making it borderline but functional.
The tools provide good coverage for timetable retrieval and station search, but there are minor gaps such as missing operations for route calculation, fare information, or real-time updates. Agents can work around these with the available tools for basic queries.