@sazuapp/mcp-server 0.1.2 → 0.2.0
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 +29 -13
- package/dist/tools.d.ts +10 -1
- package/dist/tools.js +46 -3
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -5,7 +5,30 @@ AI 에이전트 (Claude Code, Cursor, Windsurf, Codex, Antigravity 등) 가 사
|
|
|
5
5
|
|
|
6
6
|
sazu.app 에서 제공하는 manse-api 이용자들을 위한 mcp-server 입니다.
|
|
7
7
|
|
|
8
|
-
<br/><br/><br
|
|
8
|
+
<br/><br/><br/>
|
|
9
|
+
|
|
10
|
+
## 왜 SAZU MCP 인가
|
|
11
|
+
|
|
12
|
+
**사주·만세력·운세 관련 서비스를 만들고 있다면, 직접 명리 엔진을 구현하지 마세요.**
|
|
13
|
+
|
|
14
|
+
- 🚀 **연동 1줄, 5분이면 끝** — AI 에이전트에게 자연어로 말하면 사주 분석이 즉시 응답. fetch 코드·타입 정의·schema 검증 모두 불필요.
|
|
15
|
+
- 🎯 **14개 명리 모듈 한 번에** — 사주팔자·합형충파해·격국·용신·12운성·신살·허자·대운까지 1회 호출로 완성. 자체 구현 시 **수개월 작업**.
|
|
16
|
+
- 📅 **200년 범위 만세력** — 1900~2100 음/양력 변환, 절기 기반 월주 판별, 진태양시 보정. 명리학에 정확한 데이터 기반.
|
|
17
|
+
- ⚡ **50ms 이하 응답** — 챗봇·RAG·운세 앱·웹사이트에 즉시 통합. 사용자 경험 손실 0.
|
|
18
|
+
- 🧙 **50년 임상 노하우** — 사주 전문가 감수, 다수의 임상 실험으로 검증된 분석 모듈.
|
|
19
|
+
- 🤖 **AI 친화 설계** — Claude / GPT / Gemini 가 자연어를 구조화된 명리 데이터로 즉시 변환.
|
|
20
|
+
|
|
21
|
+
### 이런 분에게 추천
|
|
22
|
+
|
|
23
|
+
| 구축 중인 서비스 | 활용 |
|
|
24
|
+
|---|---|
|
|
25
|
+
| 운세 챗봇 / 사주 상담 봇 | `sazu_calculate` 로 즉시 사주 데이터 확보 → LLM 으로 자연어 풀이 |
|
|
26
|
+
| 만세력 모바일 앱 | `sazu_calendar_convert` 로 음/양력 정확 변환 + 사주 원국 표시 |
|
|
27
|
+
| 사주 SaaS / 명리 도구 | 14개 분석 모듈 그대로 활용, 자체 명리 알고리즘 R&D 비용 절감 |
|
|
28
|
+
| 점술·역학 콘텐츠 자동화 | AI 에이전트가 사주 데이터를 받아 콘텐츠 자동 생성 |
|
|
29
|
+
| 인사·매칭·궁합 서비스 | 합형충파해 데이터로 관계 분석·매칭 알고리즘 |
|
|
30
|
+
|
|
31
|
+
<br/><br/><br/>
|
|
9
32
|
|
|
10
33
|
## 설치
|
|
11
34
|
|
|
@@ -68,7 +91,7 @@ Antigravity 에디터 우상단 "…" → **Manage MCP Servers** → **View raw
|
|
|
68
91
|
}
|
|
69
92
|
```
|
|
70
93
|
|
|
71
|
-
<br/><br/><br
|
|
94
|
+
<br/><br/><br/>
|
|
72
95
|
|
|
73
96
|
## 시작하기
|
|
74
97
|
|
|
@@ -76,7 +99,7 @@ Antigravity 에디터 우상단 "…" → **Manage MCP Servers** → **View raw
|
|
|
76
99
|
2. [Pro 구독](https://sazu.app/manse-api/pricing) — Free 사용자는 [docs 페이지](https://sazu.app/manse-api/docs) 의 curl 예시 활용
|
|
77
100
|
3. [대시보드 → 키 발급](https://sazu.app/manse-api/dashboard/keys) — `SAZU_API_KEY` 환경변수에 설정
|
|
78
101
|
|
|
79
|
-
<br/><br/><br
|
|
102
|
+
<br/><br/><br/>
|
|
80
103
|
|
|
81
104
|
## 노출 도구
|
|
82
105
|
|
|
@@ -85,7 +108,7 @@ Antigravity 에디터 우상단 "…" → **Manage MCP Servers** → **View raw
|
|
|
85
108
|
| `sazu_calculate` | 사주팔자 + 14개 명리 분석 (오행·합형충파해·격국·용신·12운성·신살·허자·대운 등) |
|
|
86
109
|
| `sazu_calendar_convert` | 양력 ↔ 음력 변환 (200년 만세력) |
|
|
87
110
|
|
|
88
|
-
<br/><br/><br
|
|
111
|
+
<br/><br/><br/>
|
|
89
112
|
|
|
90
113
|
## 사용 예시
|
|
91
114
|
|
|
@@ -98,7 +121,7 @@ AI 에이전트에게 자연어로:
|
|
|
98
121
|
|
|
99
122
|
→ AI 가 `sazu_calculate` / `sazu_calendar_convert` 도구를 자동 호출.
|
|
100
123
|
|
|
101
|
-
<br/><br/><br
|
|
124
|
+
<br/><br/><br/>
|
|
102
125
|
|
|
103
126
|
## 환경변수
|
|
104
127
|
|
|
@@ -107,14 +130,7 @@ AI 에이전트에게 자연어로:
|
|
|
107
130
|
| `SAZU_API_KEY` | (필수) | Pro 플랜 API 키 |
|
|
108
131
|
| `SAZU_API_BASE` | `https://api.sazu.app` | API 베이스 URL (커스텀 환경용) |
|
|
109
132
|
|
|
110
|
-
<br/><br/><br
|
|
111
|
-
|
|
112
|
-
## 제한
|
|
113
|
-
|
|
114
|
-
- 운세 텍스트 생성 기능은 노출하지 않습니다 (별도 라이선스 필요)
|
|
115
|
-
- 인증·결제 엔드포인트는 노출하지 않습니다
|
|
116
|
-
|
|
117
|
-
<br/><br/><br/><br/><br/><br/>
|
|
133
|
+
<br/><br/><br/>
|
|
118
134
|
|
|
119
135
|
## 문의
|
|
120
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.
|
|
3
|
+
"version": "0.2.0",
|
|
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"
|