@sazuapp/mcp-server 0.1.4 → 0.2.1
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.
- package/README.md +11 -1
- package/dist/tools.d.ts +10 -1
- package/dist/tools.js +46 -3
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -105,7 +105,7 @@ Antigravity 에디터 우상단 "…" → **Manage MCP Servers** → **View raw
|
|
|
105
105
|
|
|
106
106
|
| 도구 | 설명 |
|
|
107
107
|
|---|---|
|
|
108
|
-
| `sazu_calculate` | 사주팔자 + 14개 명리 분석 (오행·합형충파해·격국·용신·12운성·신살·허자·대운 등) |
|
|
108
|
+
| `sazu_calculate` | 사주팔자 + 14개 명리 분석 (오행·합형충파해·격국·용신·12운성·신살·허자·대운 등). `trueSolarTime` 로 진태양시 선택 가능 |
|
|
109
109
|
| `sazu_calendar_convert` | 양력 ↔ 음력 변환 (200년 만세력) |
|
|
110
110
|
|
|
111
111
|
<br/><br/><br/>
|
|
@@ -117,10 +117,20 @@ AI 에이전트에게 자연어로:
|
|
|
117
117
|
```
|
|
118
118
|
"1985년 3월 15일 14시 출생 남자의 사주를 분석해줘"
|
|
119
119
|
"1990년 음력 4월 8일을 양력으로 변환해줘"
|
|
120
|
+
"1990년 11월 7일 23시 20분 서울 출생, 진태양시로 사주 분석해줘"
|
|
120
121
|
```
|
|
121
122
|
|
|
122
123
|
→ AI 가 `sazu_calculate` / `sazu_calendar_convert` 도구를 자동 호출.
|
|
123
124
|
|
|
125
|
+
### 진태양시 옵션 (v0.2.0+ · API v1.1.0+)
|
|
126
|
+
|
|
127
|
+
`sazu_calculate` 의 `trueSolarTime` 파라미터로 시각 보정을 선택합니다.
|
|
128
|
+
|
|
129
|
+
- **기본(false)** — 한국 만세력 관습 (자시 23:30, 도시 경도차 보정)
|
|
130
|
+
- **true** — 한국천문연구원 방식 진태양시 (자시 23:00, **경도차 + 균시차**)
|
|
131
|
+
|
|
132
|
+
같은 생년월일·시각이라도 두 방식의 시주가 시(時) 경계 부근에서 달라질 수 있습니다. 문서: https://www.sazu.app/manse-api/docs#birth-city
|
|
133
|
+
|
|
124
134
|
<br/><br/><br/>
|
|
125
135
|
|
|
126
136
|
## 환경변수
|
package/dist/tools.d.ts
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
* 공개:
|
|
9
9
|
* - sazu_calculate : 사주팔자 + 14개 모듈 분석
|
|
10
10
|
* - sazu_calendar_convert : 양력 ↔ 음력 변환
|
|
11
|
+
*
|
|
12
|
+
* 주의: MCP 입력은 AI 친화적 형태(birthDate 문자열·gender 등)지만 SAZU API 는
|
|
13
|
+
* birthYear/birthMonth/birthDay·isFemale·birthCity 를 받는다. 아래 실행 함수에서
|
|
14
|
+
* API 규격으로 매핑한다. (매핑 없으면 API 가 VALIDATION_ERROR 로 거부)
|
|
11
15
|
*/
|
|
12
16
|
import { z } from 'zod';
|
|
13
17
|
export declare const SazuCalculateInputSchema: z.ZodObject<{
|
|
@@ -23,6 +27,7 @@ export declare const SazuCalculateInputSchema: z.ZodObject<{
|
|
|
23
27
|
}>>;
|
|
24
28
|
isLeapMonth: z.ZodOptional<z.ZodBoolean>;
|
|
25
29
|
location: z.ZodOptional<z.ZodString>;
|
|
30
|
+
trueSolarTime: z.ZodOptional<z.ZodBoolean>;
|
|
26
31
|
}, z.core.$strip>;
|
|
27
32
|
export type SazuCalculateInput = z.infer<typeof SazuCalculateInputSchema>;
|
|
28
33
|
export declare const CalendarConvertInputSchema: z.ZodObject<{
|
|
@@ -71,7 +76,11 @@ export declare const TOOL_DEFINITIONS: readonly [{
|
|
|
71
76
|
};
|
|
72
77
|
readonly location: {
|
|
73
78
|
readonly type: "string";
|
|
74
|
-
readonly description: "출생 도시 (선택,
|
|
79
|
+
readonly description: "출생 도시 (선택, 도시 경도 보정. 기본 서울)";
|
|
80
|
+
};
|
|
81
|
+
readonly trueSolarTime: {
|
|
82
|
+
readonly type: "boolean";
|
|
83
|
+
readonly description: "진태양시(경도차 + 균시차) 적용 여부 (선택, 기본 false). false = 한국 관습(자시 23:30). true = 한국천문연구원 방식 진태양시(자시 23:00, 균시차 포함).";
|
|
75
84
|
};
|
|
76
85
|
};
|
|
77
86
|
readonly required: readonly ["birthDate", "gender"];
|
package/dist/tools.js
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
* 공개:
|
|
9
9
|
* - sazu_calculate : 사주팔자 + 14개 모듈 분석
|
|
10
10
|
* - sazu_calendar_convert : 양력 ↔ 음력 변환
|
|
11
|
+
*
|
|
12
|
+
* 주의: MCP 입력은 AI 친화적 형태(birthDate 문자열·gender 등)지만 SAZU API 는
|
|
13
|
+
* birthYear/birthMonth/birthDay·isFemale·birthCity 를 받는다. 아래 실행 함수에서
|
|
14
|
+
* API 규격으로 매핑한다. (매핑 없으면 API 가 VALIDATION_ERROR 로 거부)
|
|
11
15
|
*/
|
|
12
16
|
import { z } from 'zod';
|
|
13
17
|
import { callApi } from './client.js';
|
|
@@ -24,6 +28,7 @@ export const SazuCalculateInputSchema = z.object({
|
|
|
24
28
|
calendar: z.enum(['solar', 'lunar']).default('solar'),
|
|
25
29
|
isLeapMonth: z.boolean().optional(),
|
|
26
30
|
location: z.string().optional(),
|
|
31
|
+
trueSolarTime: z.boolean().optional(),
|
|
27
32
|
});
|
|
28
33
|
export const CalendarConvertInputSchema = z.object({
|
|
29
34
|
date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD'),
|
|
@@ -31,19 +36,53 @@ export const CalendarConvertInputSchema = z.object({
|
|
|
31
36
|
to: z.enum(['solar', 'lunar']),
|
|
32
37
|
isLeapMonth: z.boolean().optional(),
|
|
33
38
|
});
|
|
39
|
+
// ── MCP 입력 → SAZU API 요청 매핑 ──
|
|
40
|
+
/** "YYYY-MM-DD" → { year, month, day } */
|
|
41
|
+
function splitDate(date) {
|
|
42
|
+
const [year, month, day] = date.split('-').map(Number);
|
|
43
|
+
return { year, month, day };
|
|
44
|
+
}
|
|
45
|
+
/** "HH:MM" → { hour, minute }. 미지정이면 hour=null. */
|
|
46
|
+
function splitTime(time) {
|
|
47
|
+
if (!time)
|
|
48
|
+
return { hour: null, minute: 0 };
|
|
49
|
+
const [hour, minute] = time.split(':').map(Number);
|
|
50
|
+
return { hour, minute };
|
|
51
|
+
}
|
|
34
52
|
// ── 도구 실행 ──
|
|
35
53
|
export async function executeSazuCalculate(input) {
|
|
36
54
|
const parsed = SazuCalculateInputSchema.parse(input);
|
|
55
|
+
const { year, month, day } = splitDate(parsed.birthDate);
|
|
56
|
+
const { hour, minute } = splitTime(parsed.birthTime);
|
|
57
|
+
// MCP 입력 → SAZU API 규격
|
|
58
|
+
const apiBody = {
|
|
59
|
+
birthYear: year,
|
|
60
|
+
birthMonth: month,
|
|
61
|
+
birthDay: day,
|
|
62
|
+
birthHour: hour,
|
|
63
|
+
birthMinute: minute,
|
|
64
|
+
isFemale: parsed.gender === 'female',
|
|
65
|
+
isLunar: parsed.calendar === 'lunar',
|
|
66
|
+
birthCity: parsed.location ?? '서울',
|
|
67
|
+
};
|
|
68
|
+
if (parsed.trueSolarTime !== undefined)
|
|
69
|
+
apiBody.trueSolarTime = parsed.trueSolarTime;
|
|
37
70
|
return callApi('/v1/sazu/calculate', {
|
|
38
71
|
method: 'POST',
|
|
39
|
-
body: JSON.stringify(
|
|
72
|
+
body: JSON.stringify(apiBody),
|
|
40
73
|
});
|
|
41
74
|
}
|
|
42
75
|
export async function executeCalendarConvert(input) {
|
|
43
76
|
const parsed = CalendarConvertInputSchema.parse(input);
|
|
77
|
+
if (parsed.from === parsed.to) {
|
|
78
|
+
throw new Error('from 과 to 가 동일합니다. (solar↔lunar 변환만 지원)');
|
|
79
|
+
}
|
|
80
|
+
const { year, month, day } = splitDate(parsed.date);
|
|
81
|
+
// from/to → SAZU API direction (toSolar = 음력→양력, toLunar = 양력→음력)
|
|
82
|
+
const direction = parsed.to === 'solar' ? 'toSolar' : 'toLunar';
|
|
44
83
|
return callApi('/v1/calendar/convert', {
|
|
45
84
|
method: 'POST',
|
|
46
|
-
body: JSON.stringify(
|
|
85
|
+
body: JSON.stringify({ year, month, day, direction }),
|
|
47
86
|
});
|
|
48
87
|
}
|
|
49
88
|
// ── 도구 메타데이터 (MCP server 등록용) ──
|
|
@@ -59,7 +98,11 @@ export const TOOL_DEFINITIONS = [
|
|
|
59
98
|
gender: { type: 'string', enum: ['male', 'female'], description: '성별' },
|
|
60
99
|
calendar: { type: 'string', enum: ['solar', 'lunar'], description: '양/음력 (기본 solar)', default: 'solar' },
|
|
61
100
|
isLeapMonth: { type: 'boolean', description: '윤달 여부 (lunar 일 때만)' },
|
|
62
|
-
location: { type: 'string', description: '출생 도시 (선택,
|
|
101
|
+
location: { type: 'string', description: '출생 도시 (선택, 도시 경도 보정. 기본 서울)' },
|
|
102
|
+
trueSolarTime: {
|
|
103
|
+
type: 'boolean',
|
|
104
|
+
description: '진태양시(경도차 + 균시차) 적용 여부 (선택, 기본 false). false = 한국 관습(자시 23:30). true = 한국천문연구원 방식 진태양시(자시 23:00, 균시차 포함).',
|
|
105
|
+
},
|
|
63
106
|
},
|
|
64
107
|
required: ['birthDate', 'gender'],
|
|
65
108
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sazuapp/mcp-server",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "SAZU API MCP server — AI agents (Claude Code/Cursor/Windsurf) 가 사주·만세력 API 를 직접 호출.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"build": "tsc -p tsconfig.json",
|
|
15
15
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
16
16
|
"start": "node dist/index.js",
|
|
17
|
-
"dev": "tsc -p tsconfig.json --watch"
|
|
17
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
18
|
+
"prepublishOnly": "tsc -p tsconfig.json"
|
|
18
19
|
},
|
|
19
20
|
"engines": {
|
|
20
21
|
"node": ">=20"
|