@isnow890/naver-search-mcp 1.0.46 β†’ 1.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +75 -222
  2. package/dist/src/handlers/datalab.handlers.js +26 -17
  3. package/dist/src/index.d.ts +2 -2
  4. package/dist/src/index.js +36 -22
  5. package/dist/src/schemas/datalab.schemas.js +2 -2
  6. package/dist/src/utils/date.utils.d.ts +29 -0
  7. package/dist/src/utils/date.utils.js +51 -0
  8. package/package.json +1 -1
  9. package/dist/ref/naver-search-mcp-fixed-main/package.json +0 -39
  10. package/dist/ref/naver-search-mcp-fixed-main/src/clients/naver-api-core.client.d.ts +0 -11
  11. package/dist/ref/naver-search-mcp-fixed-main/src/clients/naver-api-core.client.js +0 -30
  12. package/dist/ref/naver-search-mcp-fixed-main/src/clients/naver-search.client.d.ts +0 -70
  13. package/dist/ref/naver-search-mcp-fixed-main/src/clients/naver-search.client.js +0 -100
  14. package/dist/ref/naver-search-mcp-fixed-main/src/handlers/datalab.handlers.d.ts +0 -61
  15. package/dist/ref/naver-search-mcp-fixed-main/src/handlers/datalab.handlers.js +0 -137
  16. package/dist/ref/naver-search-mcp-fixed-main/src/handlers/search.handlers.d.ts +0 -44
  17. package/dist/ref/naver-search-mcp-fixed-main/src/handlers/search.handlers.js +0 -81
  18. package/dist/ref/naver-search-mcp-fixed-main/src/index.d.ts +0 -2
  19. package/dist/ref/naver-search-mcp-fixed-main/src/index.js +0 -122
  20. package/dist/ref/naver-search-mcp-fixed-main/src/schemas/datalab.schemas.d.ts +0 -336
  21. package/dist/ref/naver-search-mcp-fixed-main/src/schemas/datalab.schemas.js +0 -103
  22. package/dist/ref/naver-search-mcp-fixed-main/src/schemas/search.schemas.d.ts +0 -80
  23. package/dist/ref/naver-search-mcp-fixed-main/src/schemas/search.schemas.js +0 -62
  24. package/dist/ref/naver-search-mcp-fixed-main/src/tools/datalab.tools.d.ts +0 -13
  25. package/dist/ref/naver-search-mcp-fixed-main/src/tools/datalab.tools.js +0 -70
  26. package/dist/ref/naver-search-mcp-fixed-main/src/tools/search.tools.d.ts +0 -13
  27. package/dist/ref/naver-search-mcp-fixed-main/src/tools/search.tools.js +0 -62
  28. package/dist/ref/naver-search-mcp-fixed-main/src/types/datalab.types.d.ts +0 -78
  29. package/dist/ref/naver-search-mcp-fixed-main/src/types/datalab.types.js +0 -1
  30. package/dist/ref/naver-search-mcp-fixed-main/src/types/search.types.d.ts +0 -44
  31. package/dist/ref/naver-search-mcp-fixed-main/src/types/search.types.js +0 -1
  32. package/dist/src/handlers/time.handlers.d.ts +0 -11
  33. package/dist/src/handlers/time.handlers.js +0 -32
  34. package/dist/src/schemas/time.schemas.d.ts +0 -6
  35. package/dist/src/schemas/time.schemas.js +0 -7
  36. package/dist/src/utils/memory-manager.d.ts +0 -87
  37. package/dist/src/utils/memory-manager.js +0 -211
package/README.md CHANGED
@@ -6,76 +6,19 @@
6
6
  [![smithery badge](https://smithery.ai/badge/@isnow890/naver-search-mcp)](https://smithery.ai/server/@isnow890/naver-search-mcp)
7
7
  [![MCP.so](https://img.shields.io/badge/MCP.so-Naver%20Search%20MCP-blue)](https://mcp.so/server/naver-search-mcp/isnow890)
8
8
 
9
- #### Version History
9
+ MCP server for Naver Search API and DataLab API integration, enabling comprehensive search across various Naver services and data trend analysis.
10
10
 
11
- ###### 1.0.45 (2025-09-28)
11
+ ## Quick Start: Use Without API Key
12
12
 
13
- - Smithery compatibility issues resolved - Now available through Smithery with latest features
14
- - Excel compatibility issues fixed in category search - Replaced with JSON functionality
15
- - Web Korean search (`search_webkr`) functionality restored
16
- - Full compatibility with Smithery platform installations
17
-
18
- ###### 1.0.44 (2025-08-31)
19
-
20
- - `get_current_korean_time` tool added - Essential time context tool for Korean timezone
21
- - Enhanced all existing tool descriptions to reference time tool for temporal queries
22
- - Improved temporal context handling for "today", "now", "current" searches
23
- - Comprehensive Korean time formatting with multiple output formats
24
-
25
- ###### 1.0.4 (2025-08-21)
26
-
27
- - `find_category` tool added - with fuzzy matching and ranking system support
28
- - Enhanced parameter validation with Zod schema
29
- - Improved category search workflow
30
-
31
- ###### 1.0.30 (2025-08-04)
32
-
33
- - MCP SDK upgraded to 1.17.1
34
- - Fixed compatibility issues with Smithery specification changes
35
- - Added comprehensive DataLab shopping category code documentation
36
-
37
- ###### 1.0.2 (2025-04-26)
38
-
39
- - README updated: cafe article search tool and version history section improved
40
-
41
- ###### 1.0.1 (2025-04-26)
42
-
43
- - Cafe article search feature added
44
- - Shopping category info added to zod
45
- - Source code refactored
46
-
47
- ###### 1.0.0 (2025-04-08)
48
-
49
- - Initial release
50
-
51
- #### Prerequisites
52
-
53
- - Naver Developers API Key (Client ID and Secret)
54
- - Node.js 18 or higher
55
- - NPM 8 or higher
56
- - Docker (optional, for container deployment)
57
-
58
- #### Getting API Keys
59
-
60
- 1. Visit [Naver Developers](https://developers.naver.com/apps/#/register)
61
- 2. Click "Register Application"
62
- 3. Enter application name and select ALL of the following APIs:
63
- - Search (for blog, news, book search, etc.)
64
- - DataLab (Search Trends)
65
- - DataLab (Shopping Insight)
66
- 4. Set the obtained Client ID and Client Secret as environment variables
13
+ You can use this server immediately without API keys through [Kakao PlayMCP](https://playmcp.kakao.com/mcp/154). Simply visit the link and start using it right away!
67
14
 
68
15
  ## Tool Details
69
16
 
70
17
  ### Available tools:
71
18
 
72
- #### πŸ• Time & Context Tools
73
-
74
- - **get_current_korean_time**: Get current Korean time (KST) with comprehensive date/time information. Essential for understanding "today", "now", or "current" context in Korean timezone. Always use this tool when temporal context is needed for searches or analysis.
75
-
76
19
  #### πŸ†• Category Search
77
20
 
78
- - **find_category**: Category search tool - No more need to manually check category numbers via URL for trend and shopping insight searches. The LLM will find it out as you say.
21
+ - **find_category**: Category search tool so you no longer need to manually check category numbers in URLs for trend and shopping insight searches. Just describe the category in natural language.
79
22
 
80
23
  #### Search Tools
81
24
 
@@ -103,106 +46,26 @@
103
46
  - **datalab_shopping_keyword_by_gender**: Analyze shopping keyword trends by gender
104
47
  - **datalab_shopping_keyword_by_age**: Analyze shopping keyword trends by age group
105
48
 
106
- #### Complete Category List:
107
-
108
- For a complete list of category codes, you can download from Naver Shopping Partner Center or extract them by browsing Naver Shopping categories.
109
-
110
- ### 🎯 Business Use Cases & Scenarios
111
-
112
- #### πŸ›οΈ E-commerce Market Research
113
-
114
- ```javascript
115
- // Fashion trend discovery
116
- find_category("fashion") β†’ Check top fashion categories and codes
117
- datalab_shopping_category β†’ Analyze seasonal fashion trends
118
- datalab_shopping_age β†’ Identify fashion target demographics
119
- datalab_shopping_keywords β†’ Compare "dress" vs "jacket" vs "coat"
120
- ```
121
-
122
- #### πŸ“± Digital Marketing Strategy
123
-
124
- ```javascript
125
- // Beauty industry analysis
126
- find_category("cosmetics") β†’ Find beauty categories
127
- datalab_shopping_gender β†’ 95% female vs 5% male shoppers
128
- datalab_shopping_device β†’ Mobile dominance in beauty shopping
129
- datalab_shopping_keywords β†’ "tint" vs "lipstick" keyword performance
130
- ```
131
-
132
- #### 🏒 Business Intelligence & Competitive Analysis
133
-
134
- ```javascript
135
- // Tech product insights
136
- find_category("smartphone") β†’ Check electronics categories
137
- datalab_shopping_category β†’ Track iPhone vs Galaxy trends
138
- datalab_shopping_age β†’ 20-30s as main smartphone buyers
139
- datalab_shopping_device β†’ PC vs mobile shopping behavior
140
- ```
141
-
142
- #### πŸ“Š Seasonal Business Planning
143
-
144
- ```javascript
145
- // Holiday shopping analysis
146
- find_category("gift") β†’ Gift categories
147
- datalab_shopping_category β†’ Black Friday, Christmas trends
148
- datalab_shopping_keywords β†’ "Mother's Day gift" vs "birthday gift"
149
- datalab_shopping_age β†’ Age-based gift purchasing patterns
150
- ```
151
-
152
- #### 🎯 Customer Persona Development
153
-
154
- ```javascript
155
- // Fitness market analysis
156
- find_category("exercise") β†’ Sports/fitness categories
157
- datalab_shopping_gender β†’ Male vs female fitness spending
158
- datalab_shopping_age β†’ Primary fitness demographics (20-40s)
159
- datalab_shopping_keywords β†’ "home workout" vs "gym" trend analysis
160
- ```
161
-
162
- ### πŸ“ˆ Advanced Analysis Scenarios
163
-
164
- #### Market Entry Strategy
165
-
166
- 1. **Category Discovery**: Use `find_category` to explore market segments
167
- 2. **Trend Analysis**: Identify growing vs declining categories
168
- 3. **Demographic Targeting**: Age/gender analysis for customer targeting
169
- 4. **Competitive Intelligence**: Keyword performance comparison
170
- 5. **Device Strategy**: Mobile vs PC shopping optimization
171
-
172
- #### Product Launch Planning
173
-
174
- 1. **Market Validation**: Category growth trends and seasonality
175
- 2. **Target Customers**: Demographic analysis for product positioning
176
- 3. **Marketing Channels**: Device preferences for advertising strategy
177
- 4. **Competitive Landscape**: Keyword competition and opportunities
178
- 5. **Pricing Strategy**: Category performance and price correlation
179
-
180
- #### Performance Monitoring
181
-
182
- 1. **Category Health**: Monitor product category trends
183
- 2. **Keyword Tracking**: Track brand and product keyword performance
184
- 3. **Demographic Shifts**: Monitor changing customer demographics
185
- 4. **Seasonal Patterns**: Plan inventory and marketing campaigns
186
- 5. **Competitive Benchmarking**: Compare performance against category averages
187
-
188
- ### Quick Reference: Popular Category Codes
189
-
190
- | Category | Code | Korean |
191
- | ------------------- | -------- | ------------- |
192
- | Fashion/Clothing | 50000000 | νŒ¨μ…˜μ˜λ₯˜ |
193
- | Cosmetics/Beauty | 50000002 | ν™”μž₯ν’ˆ/미용 |
194
- | Digital/Electronics | 50000003 | λ””μ§€ν„Έ/κ°€μ „ |
195
- | Sports/Leisure | 50000004 | 슀포츠/λ ˆμ € |
196
- | Food/Beverages | 50000008 | μ‹ν’ˆ/음료 |
197
- | Health/Medical | 50000009 | 건강/μ˜λ£Œμš©ν’ˆ |
198
-
199
- πŸ’‘ **Tip**: Use `find_category` with fuzzy searches like "beauty", "fashion", "electronics" to easily find categories.
49
+ ## Getting API Keys
50
+
51
+ 1. Visit [Naver Developers](https://developers.naver.com/apps/#/register) and log in with your Naver account
52
+ 2. Click the "Application Registration" (μ• ν”Œλ¦¬μΌ€μ΄μ…˜ 등둝) button
53
+ 3. Fill in the application information:
54
+ - **Application Name**: Enter any name (e.g., "Naver Search MCP")
55
+ - **Usage**: Select "Search" (검색)
56
+ 4. In the API Settings section, check ALL of the following APIs:
57
+ - **Search** (검색) - Required for blog, news, book, cafe article, web, image, kin, encyclopedia, academic, and local search
58
+ - **DataLab - Search Trends** (λ°μ΄ν„°λž© - 검색어 νŠΈλ Œλ“œ) - Required for search term trend analysis
59
+ - **DataLab - Shopping Insight** (λ°μ΄ν„°λž© - μ‡Όν•‘μΈμ‚¬μ΄νŠΈ) - Required for shopping trend analysis
60
+ 5. Click "Register" to complete registration
61
+ 6. After registration, you'll see your **Client ID** and **Client Secret** on the application detail page
62
+ 7. Use these credentials in the configuration below
200
63
 
201
64
  ## Installation
202
65
 
203
66
  ### Method 1: NPX Installation (Recommended)
204
67
 
205
- The most reliable way to use this MCP server is through direct NPX installation. For detailed package information, see the [NPM package page](https://www.npmjs.com/package/@isnow890/naver-search-mcp).
68
+ The most reliable way to use this MCP server is through NPX. For detailed package information, see the [NPM package page](https://www.npmjs.com/package/@isnow890/naver-search-mcp).
206
69
 
207
70
  #### Claude Desktop Configuration
208
71
 
@@ -223,9 +86,9 @@ Add to Claude Desktop config file (`%APPDATA%\Claude\claude_desktop_config.json`
223
86
  }
224
87
  ```
225
88
 
226
- #### Cursor AI Configuration
89
+ #### Claude Code Configuration
227
90
 
228
- Add to `mcp.json`:
91
+ Add to your Claude Code settings:
229
92
 
230
93
  ```json
231
94
  {
@@ -242,39 +105,14 @@ Add to `mcp.json`:
242
105
  }
243
106
  ```
244
107
 
245
- ### Method 2: Smithery Installation (Alternative - Known Issues)
246
-
247
- ⚠️ **Important Notice**: Smithery installation may experience connection timeouts and hanging issues due to WebSocket relay infrastructure problems. This is a known Smithery platform issue, not a problem with this MCP server code. **NPX installation (Method 1) is strongly recommended for reliable operation.**
248
-
249
- #### Known Issues with Smithery:
250
- - Server initialization hangs or times out
251
- - `Error -32001: Request timed out`
252
- - WebSocket connection drops after handshake
253
- - Server shuts down unexpectedly before processing requests
254
-
255
- #### If you still want to try Smithery:
108
+ ### Method 2: Smithery Installation
256
109
 
257
- ##### For Claude Desktop:
110
+ Install via Smithery CLI:
258
111
 
259
112
  ```bash
260
113
  npx -y @smithery/cli@latest install @isnow890/naver-search-mcp --client claude
261
114
  ```
262
115
 
263
- ##### For other AI clients:
264
-
265
- ```bash
266
- # Cursor
267
- npx -y @smithery/cli@latest install @isnow890/naver-search-mcp --client cursor
268
-
269
- # Windsurf
270
- npx -y @smithery/cli@latest install @isnow890/naver-search-mcp --client windsurf
271
-
272
- # Cline
273
- npx -y @smithery/cli@latest install @isnow890/naver-search-mcp --client cline
274
- ```
275
-
276
- **If you experience timeout issues with Smithery, please switch to Method 1 (NPX) for stable operation.**
277
-
278
116
  ### Method 3: Local Installation
279
117
 
280
118
  For local development or custom modifications:
@@ -292,7 +130,7 @@ npm run build
292
130
 
293
131
  ##### Or Download ZIP File
294
132
 
295
- 1. Download the latest version from [GitHub Releases](https://github.com/isnow890/naver-search-mcp/releases)
133
+ 1. Download the latest version from [GitHub Releases](https://github.com/isnow890/naver-search-mcp)
296
134
  2. Extract the ZIP file to your desired location
297
135
  3. Navigate to the extracted folder in terminal:
298
136
 
@@ -382,51 +220,66 @@ pwd
382
220
 
383
221
  After completing the configuration, completely close and restart Claude Desktop to activate the Naver Search MCP server.
384
222
 
223
+ ## Prerequisites
224
+
225
+ - Naver Developers API Key (Client ID and Secret)
226
+ - Node.js 18 or higher
227
+ - NPM 8 or higher
228
+
229
+ ## License
230
+
231
+ MIT License
232
+
385
233
  ---
386
234
 
387
- ## Alternative Installation Methods
235
+ ## Version History
388
236
 
389
- ### Method 4: Docker Installation
237
+ ### 1.0.47 (2025-01-03)
390
238
 
391
- For containerized deployment:
239
+ - **Added "today" keyword support** for all DataLab date parameters - no need to call separate time tool
240
+ - **Fixed server termination issue** - MCP server now properly exits when client disconnects
241
+ - **Added graceful shutdown handlers** for SIGINT, SIGTERM, and transport close events
242
+ - **Removed get_current_korean_time tool** - redundant with new "today" keyword feature
243
+ - **Removed memory monitoring module** - resolved setInterval blocking process exit
244
+ - **Special thanks to @gloomyrobot** for reporting the server termination issue
392
245
 
393
- ```bash
394
- docker run -i --rm \
395
- -e NAVER_CLIENT_ID=your_client_id \
396
- -e NAVER_CLIENT_SECRET=your_client_secret \
397
- mcp/naver-search
398
- ```
246
+ ### 1.0.45 (2025-09-28)
399
247
 
400
- Docker configuration for Claude Desktop:
248
+ - Resolved Smithery compatibility issues so you can use the latest features through Smithery
249
+ - Replaced the Excel export in category search with JSON for better compatibility
250
+ - Restored the `search_webkr` tool for Korean web search
251
+ - Fully compatible with Smithery platform installation
401
252
 
402
- ```json
403
- {
404
- "mcpServers": {
405
- "naver-search": {
406
- "command": "docker",
407
- "args": [
408
- "run",
409
- "-i",
410
- "--rm",
411
- "-e",
412
- "NAVER_CLIENT_ID=your_client_id",
413
- "-e",
414
- "NAVER_CLIENT_SECRET=your_client_secret",
415
- "mcp/naver-search"
416
- ]
417
- }
418
- }
419
- }
420
- ```
253
+ ### 1.0.44 (2025-08-31)
421
254
 
422
- ## Build
255
+ - Added the `get_current_korean_time` tool for essential Korea Standard Time context
256
+ - Referenced the time tool across existing tool descriptions for temporal queries
257
+ - Improved handling of "today", "now", and "current" searches with temporal context
258
+ - Expanded Korean date and time formatting outputs with multiple formats
423
259
 
424
- Docker build:
260
+ ### 1.0.40 (2025-08-21)
425
261
 
426
- ```bash
427
- docker build -t mcp/naver-search .
428
- ```
262
+ - Added the `find_category` tool with fuzzy matching so you no longer need to check category numbers manually in URLs
263
+ - Enhanced parameter validation with Zod schema
264
+ - Improved the category search workflow
265
+ - Implemented a level-based category ranking system that prioritizes top-level categories
429
266
 
430
- ## License
267
+ ### 1.0.30 (2025-08-04)
431
268
 
432
- MIT License
269
+ - MCP SDK upgraded to 1.17.1
270
+ - Fixed compatibility issues with Smithery specification changes
271
+ - Added comprehensive DataLab shopping category code documentation
272
+
273
+ ### 1.0.2 (2025-04-26)
274
+
275
+ - README updated: cafe article search tool and version history section improved
276
+
277
+ ### 1.0.1 (2025-04-26)
278
+
279
+ - Cafe article search feature added
280
+ - Shopping category info added to zod
281
+ - Source code refactored
282
+
283
+ ### 1.0.0 (2025-04-08)
284
+
285
+ - Initial release
@@ -1,4 +1,5 @@
1
1
  import { NaverSearchClient } from "../clients/naver-search.client.js";
2
+ import { resolveDateRange } from "../utils/date.utils.js";
2
3
  // ν΄λΌμ΄μ–ΈνŠΈ μΈμŠ€ν„΄μŠ€ (싱글톀)
3
4
  const client = NaverSearchClient.getInstance();
4
5
  /**
@@ -50,7 +51,8 @@ export const datalabToolHandlers = {
50
51
  * @param params DatalabSearch
51
52
  */
52
53
  export async function handleSearchTrend(params) {
53
- return client.searchTrend(params);
54
+ const { startDate, endDate } = resolveDateRange(params.startDate, params.endDate);
55
+ return client.searchTrend({ ...params, startDate, endDate });
54
56
  }
55
57
  /**
56
58
  * μ‡Όν•‘ μΉ΄ν…Œκ³ λ¦¬ νŠΈλ Œλ“œ ν•Έλ“€λŸ¬
@@ -58,7 +60,8 @@ export async function handleSearchTrend(params) {
58
60
  * @param params DatalabShopping
59
61
  */
60
62
  export async function handleShoppingCategoryTrend(params) {
61
- return client.datalabShoppingCategory(params);
63
+ const { startDate, endDate } = resolveDateRange(params.startDate, params.endDate);
64
+ return client.datalabShoppingCategory({ ...params, startDate, endDate });
62
65
  }
63
66
  /**
64
67
  * μ‡Όν•‘ 기기별 νŠΈλ Œλ“œ ν•Έλ“€λŸ¬
@@ -66,9 +69,10 @@ export async function handleShoppingCategoryTrend(params) {
66
69
  * @param params DatalabShoppingDevice
67
70
  */
68
71
  export async function handleShoppingByDeviceTrend(params) {
72
+ const { startDate, endDate } = resolveDateRange(params.startDate, params.endDate);
69
73
  return client.datalabShoppingByDevice({
70
- startDate: params.startDate,
71
- endDate: params.endDate,
74
+ startDate,
75
+ endDate,
72
76
  timeUnit: params.timeUnit,
73
77
  category: params.category,
74
78
  device: params.device,
@@ -80,9 +84,10 @@ export async function handleShoppingByDeviceTrend(params) {
80
84
  * @param params DatalabShoppingGender
81
85
  */
82
86
  export async function handleShoppingByGenderTrend(params) {
87
+ const { startDate, endDate } = resolveDateRange(params.startDate, params.endDate);
83
88
  return client.datalabShoppingByGender({
84
- startDate: params.startDate,
85
- endDate: params.endDate,
89
+ startDate,
90
+ endDate,
86
91
  timeUnit: params.timeUnit,
87
92
  category: params.category,
88
93
  gender: params.gender,
@@ -94,9 +99,10 @@ export async function handleShoppingByGenderTrend(params) {
94
99
  * @param params DatalabShoppingAge
95
100
  */
96
101
  export async function handleShoppingByAgeTrend(params) {
102
+ const { startDate, endDate } = resolveDateRange(params.startDate, params.endDate);
97
103
  return client.datalabShoppingByAge({
98
- startDate: params.startDate,
99
- endDate: params.endDate,
104
+ startDate,
105
+ endDate,
100
106
  timeUnit: params.timeUnit,
101
107
  category: params.category,
102
108
  ages: params.ages,
@@ -108,10 +114,10 @@ export async function handleShoppingByAgeTrend(params) {
108
114
  * @param params DatalabShoppingKeywords
109
115
  */
110
116
  export async function handleShoppingKeywordsTrend(params) {
111
- // ν‚€μ›Œλ“œ 배열을 넀이버 API에 λ§žλŠ” ν˜•μ‹μœΌλ‘œ λ³€ν™˜
117
+ const { startDate, endDate } = resolveDateRange(params.startDate, params.endDate);
112
118
  return client.datalabShoppingKeywords({
113
- startDate: params.startDate,
114
- endDate: params.endDate,
119
+ startDate,
120
+ endDate,
115
121
  timeUnit: params.timeUnit,
116
122
  category: params.category,
117
123
  keyword: params.keyword,
@@ -123,9 +129,10 @@ export async function handleShoppingKeywordsTrend(params) {
123
129
  * @param params DatalabShoppingKeywordDevice
124
130
  */
125
131
  export async function handleShoppingKeywordByDeviceTrend(params) {
132
+ const { startDate, endDate } = resolveDateRange(params.startDate, params.endDate);
126
133
  return client.datalabShoppingKeywordByDevice({
127
- startDate: params.startDate,
128
- endDate: params.endDate,
134
+ startDate,
135
+ endDate,
129
136
  timeUnit: params.timeUnit,
130
137
  category: params.category,
131
138
  keyword: params.keyword,
@@ -138,9 +145,10 @@ export async function handleShoppingKeywordByDeviceTrend(params) {
138
145
  * @param params DatalabShoppingKeywordGender
139
146
  */
140
147
  export async function handleShoppingKeywordByGenderTrend(params) {
148
+ const { startDate, endDate } = resolveDateRange(params.startDate, params.endDate);
141
149
  return client.datalabShoppingKeywordByGender({
142
- startDate: params.startDate,
143
- endDate: params.endDate,
150
+ startDate,
151
+ endDate,
144
152
  timeUnit: params.timeUnit,
145
153
  category: params.category,
146
154
  keyword: params.keyword,
@@ -153,9 +161,10 @@ export async function handleShoppingKeywordByGenderTrend(params) {
153
161
  * @param params DatalabShoppingKeywordAge
154
162
  */
155
163
  export async function handleShoppingKeywordByAgeTrend(params) {
164
+ const { startDate, endDate } = resolveDateRange(params.startDate, params.endDate);
156
165
  return client.datalabShoppingKeywordByAge({
157
- startDate: params.startDate,
158
- endDate: params.endDate,
166
+ startDate,
167
+ endDate,
159
168
  timeUnit: params.timeUnit,
160
169
  category: params.category,
161
170
  keyword: params.keyword,
@@ -17,7 +17,7 @@ export declare const configSchema: z.ZodObject<{
17
17
  export declare function resetServerInstance(): void;
18
18
  export declare function createNaverSearchServer({ config, }: {
19
19
  config: z.infer<typeof configSchema>;
20
- }): import("@modelcontextprotocol/sdk/server/index.js").Server<{
20
+ }): McpServer | import("@modelcontextprotocol/sdk/server/index.js").Server<{
21
21
  method: string;
22
22
  params?: {
23
23
  [x: string]: unknown;
@@ -39,5 +39,5 @@ export declare function createNaverSearchServer({ config, }: {
39
39
  _meta?: {
40
40
  [x: string]: unknown;
41
41
  } | undefined;
42
- }> | McpServer;
42
+ }>;
43
43
  export default createNaverSearchServer;
package/dist/src/index.js CHANGED
@@ -8,10 +8,7 @@ import { datalabToolHandlers } from "./handlers/datalab.handlers.js";
8
8
  import { SearchArgsSchema, NaverLocalSearchParamsSchema, } from "./schemas/search.schemas.js";
9
9
  import { DatalabSearchSchema, DatalabShoppingSchema, DatalabShoppingDeviceSchema, DatalabShoppingGenderSchema, DatalabShoppingAgeSchema, DatalabShoppingKeywordsSchema, DatalabShoppingKeywordDeviceSchema, DatalabShoppingKeywordGenderSchema, DatalabShoppingKeywordAgeSchema, } from "./schemas/datalab.schemas.js";
10
10
  import { FindCategorySchema } from "./schemas/category.schemas.js";
11
- import { findCategoryHandler } from "./handlers/category.handlers.js";
12
- import { GetKoreanTimeSchema } from "./schemas/time.schemas.js";
13
- import { timeToolHandlers } from "./handlers/time.handlers.js";
14
- import { startGlobalMemoryMonitoring, stopGlobalMemoryMonitoring } from "./utils/memory-manager.js";
11
+ import { findCategoryHandler, clearCategoriesCache } from "./handlers/category.handlers.js";
15
12
  // Configuration schema for Smithery
16
13
  export const configSchema = z.object({
17
14
  NAVER_CLIENT_ID: z.string().describe("Naver API Client ID"),
@@ -25,14 +22,10 @@ let currentConfig = null;
25
22
  */
26
23
  export function resetServerInstance() {
27
24
  if (globalServerInstance) {
28
- // λ©”λͺ¨λ¦¬ λͺ¨λ‹ˆν„°λ§ 쀑지
29
- stopGlobalMemoryMonitoring();
30
25
  // ν΄λΌμ΄μ–ΈνŠΈ μΈμŠ€ν„΄μŠ€ 정리
31
26
  NaverSearchClient.destroyInstance();
32
27
  // μΉ΄ν…Œκ³ λ¦¬ μΊμ‹œ 정리
33
- import('./handlers/category.handlers.js').then(({ clearCategoriesCache }) => {
34
- clearCategoriesCache();
35
- });
28
+ clearCategoriesCache();
36
29
  globalServerInstance = null;
37
30
  currentConfig = null;
38
31
  console.error("Server instance and resources cleaned up");
@@ -267,16 +260,6 @@ export function createNaverSearchServer({ config, }) {
267
260
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
268
261
  };
269
262
  });
270
- // Register current time tool
271
- server.registerTool("get_current_korean_time", {
272
- description: "πŸ• Get current Korean time (KST) with date and time information. Use this tool whenever you need to know 'today', 'now', 'current time', or any time-related queries. Essential for understanding what 'today' means in Korean context. Always use this tool when users mention 'today' or 'current' to provide accurate time context. (ν˜„μž¬ ν•œκ΅­ μ‹œκ°„ 쑰회 - '였늘', 'ν˜„μž¬', 'μ§€κΈˆ' λ“±μ˜ μ‹œκ°„ 정보가 ν•„μš”ν•  λ•Œ 항상 μ‚¬μš©ν•˜μ„Έμš”)",
273
- inputSchema: GetKoreanTimeSchema.shape,
274
- }, async (args) => {
275
- const result = await timeToolHandlers.getCurrentKoreanTime(args);
276
- return {
277
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
278
- };
279
- });
280
263
  // Register category search tool
281
264
  server.registerTool("find_category", {
282
265
  description: "πŸš€ STEP 1: Find shopping categories with Korean search terms. Search in KOREAN (νŒ¨μ…˜, ν™”μž₯ν’ˆ, κ°€μ „μ œν’ˆ, etc.) to find category codes needed for datalab tools. Smart fuzzy matching finds similar categories even with partial matches. (μΉ΄ν…Œκ³ λ¦¬ 검색: ν•œκ΅­μ–΄λ‘œ κ²€μƒ‰ν•˜μ—¬ λ°μ΄ν„°λž© 뢄석에 ν•„μš”ν•œ μΉ΄ν…Œκ³ λ¦¬ μ½”λ“œλ₯Ό μ°Ύμ•„μ£ΌλŠ” ν•„μˆ˜ 도ꡬ)",
@@ -290,13 +273,43 @@ export function createNaverSearchServer({ config, }) {
290
273
  // Cache the server instance and config
291
274
  globalServerInstance = server;
292
275
  currentConfig = config;
293
- // λ©”λͺ¨λ¦¬ λͺ¨λ‹ˆν„°λ§ μ‹œμž‘ (5λΆ„ 간격)
294
- startGlobalMemoryMonitoring(5 * 60 * 1000);
295
- console.error("Memory monitoring started");
296
276
  return server.server;
297
277
  }
298
278
  // Export default for Smithery compatibility
299
279
  export default createNaverSearchServer;
280
+ function registerShutdownHandlers({ server, transport, }) {
281
+ let shuttingDown = false;
282
+ const shutdown = async (reason, exitCode = 0) => {
283
+ if (shuttingDown)
284
+ return;
285
+ shuttingDown = true;
286
+ console.error(`Shutting down: ${reason}`);
287
+ try {
288
+ await server.close();
289
+ }
290
+ catch (error) {
291
+ console.error("Error while closing server:", error);
292
+ }
293
+ finally {
294
+ resetServerInstance();
295
+ }
296
+ process.exit(exitCode);
297
+ };
298
+ transport.onclose = () => {
299
+ void shutdown("transport closed");
300
+ };
301
+ transport.onerror = (error) => {
302
+ console.error("Transport error:", error);
303
+ void shutdown("transport error", 1);
304
+ };
305
+ const handleStdinClosed = () => {
306
+ void shutdown("stdin closed");
307
+ };
308
+ process.stdin.once("end", handleStdinClosed);
309
+ process.stdin.once("close", handleStdinClosed);
310
+ process.once("SIGINT", () => void shutdown("SIGINT"));
311
+ process.once("SIGTERM", () => void shutdown("SIGTERM"));
312
+ }
300
313
  // Main function to run the server when executed directly
301
314
  async function main() {
302
315
  try {
@@ -333,6 +346,7 @@ async function main() {
333
346
  // Create transport and run server
334
347
  const transport = new StdioServerTransport();
335
348
  console.error("Transport created, connecting...");
349
+ registerShutdownHandlers({ server: serverFactory, transport });
336
350
  await serverFactory.connect(transport);
337
351
  console.error("Server connected and running");
338
352
  }
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  // κΈ°λ³Έ DataLab μŠ€ν‚€λ§ˆ
3
3
  export const DatalabBaseSchema = z.object({
4
- startDate: z.string().describe("Start date (yyyy-mm-dd)"),
5
- endDate: z.string().describe("End date (yyyy-mm-dd)"),
4
+ startDate: z.string().describe("Start date (yyyy-mm-dd or 'today' for KST today)"),
5
+ endDate: z.string().describe("End date (yyyy-mm-dd or 'today' for KST today)"),
6
6
  timeUnit: z.enum(["date", "week", "month"]).describe("Time unit"),
7
7
  });
8
8
  // 검색어 νŠΈλ Œλ“œ μŠ€ν‚€λ§ˆ
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Date utility functions for Naver Search MCP Server
3
+ */
4
+ /**
5
+ * Convert "today" keyword to Korean Standard Time (KST) date string
6
+ * or return the original date string if it's already in yyyy-mm-dd format
7
+ *
8
+ * @param dateStr - Date string or "today" keyword
9
+ * @returns Date string in yyyy-mm-dd format (KST)
10
+ */
11
+ export declare function resolveDate(dateStr: string): string;
12
+ /**
13
+ * Get current Korean Standard Time (KST) date string
14
+ * KST is UTC+9
15
+ *
16
+ * @returns Date string in yyyy-mm-dd format
17
+ */
18
+ export declare function getKoreanToday(): string;
19
+ /**
20
+ * Resolve both startDate and endDate, handling "today" keyword
21
+ *
22
+ * @param startDate - Start date string or "today"
23
+ * @param endDate - End date string or "today"
24
+ * @returns Object with resolved dates
25
+ */
26
+ export declare function resolveDateRange(startDate: string, endDate: string): {
27
+ startDate: string;
28
+ endDate: string;
29
+ };