@yoonion/mimi-seed-mcp 0.3.35 → 0.3.37

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/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import { registerInstagramTools } from './registers/instagram.js';
16
16
  import { registerFacebookTools } from './registers/facebook.js';
17
17
  import { registerGoogleAdsTools } from './registers/googleads.js';
18
18
  import { registerGscTools } from './registers/gsc.js';
19
+ import { registerJenkinsTools } from './registers/jenkins.js';
19
20
  import { registerPrompts } from './prompts.js';
20
21
  import { registerResources } from './resources.js';
21
22
  // dist/index.js 기준 ../package.json — npm 패키지 루트의 버전을 단일 출처로 사용.
@@ -39,6 +40,7 @@ registerInstagramTools(server);
39
40
  registerFacebookTools(server);
40
41
  registerGoogleAdsTools(server);
41
42
  registerGscTools(server);
43
+ registerJenkinsTools(server);
42
44
  registerPrompts(server);
43
45
  registerResources(server);
44
46
  // `npx -y @yoonion/mimi-seed-mcp <subcommand>` 처리.
@@ -0,0 +1,8 @@
1
+ export interface JenkinsConfig {
2
+ url: string;
3
+ username: string;
4
+ token: string;
5
+ }
6
+ export declare function loadJenkinsConfig(): JenkinsConfig | null;
7
+ export declare function saveJenkinsConfig(config: JenkinsConfig): void;
8
+ export declare function requireJenkinsConfig(): JenkinsConfig;
@@ -0,0 +1,29 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import os from 'node:os';
4
+ const CONFIG_DIR = path.join(os.homedir(), '.mimi-seed');
5
+ const JENKINS_CONFIG_PATH = path.join(CONFIG_DIR, 'jenkins.json');
6
+ export function loadJenkinsConfig() {
7
+ try {
8
+ return JSON.parse(fs.readFileSync(JENKINS_CONFIG_PATH, 'utf-8'));
9
+ }
10
+ catch {
11
+ return null;
12
+ }
13
+ }
14
+ export function saveJenkinsConfig(config) {
15
+ if (!fs.existsSync(CONFIG_DIR)) {
16
+ fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
17
+ }
18
+ fs.writeFileSync(JENKINS_CONFIG_PATH, JSON.stringify(config, null, 2), { mode: 0o600 });
19
+ }
20
+ export function requireJenkinsConfig() {
21
+ const cfg = loadJenkinsConfig();
22
+ if (!cfg) {
23
+ throw new Error('Jenkins 설정이 없습니다.\n' +
24
+ 'jenkins_save_config 도구로 먼저 설정해주세요.\n' +
25
+ '예시:\n' +
26
+ ' jenkins_save_config(url="https://jenkins.example.com", username="admin", token="11abc...")');
27
+ }
28
+ return cfg;
29
+ }
@@ -0,0 +1,10 @@
1
+ import type { JenkinsConfig } from './config.js';
2
+ export interface JenkinsCredentialSummary {
3
+ id: string;
4
+ displayName: string;
5
+ typeName: string;
6
+ }
7
+ export declare function listCredentials(cfg: JenkinsConfig): Promise<JenkinsCredentialSummary[]>;
8
+ export declare function upsertSecretText(cfg: JenkinsConfig, id: string, secret: string, description?: string): Promise<'created' | 'updated'>;
9
+ export declare function upsertSecretFile(cfg: JenkinsConfig, id: string, fileBase64: string, fileName: string, description?: string): Promise<'created' | 'updated'>;
10
+ export declare function deleteCredential(cfg: JenkinsConfig, id: string): Promise<void>;
@@ -0,0 +1,95 @@
1
+ function basicAuth(username, token) {
2
+ return 'Basic ' + Buffer.from(`${username}:${token}`).toString('base64');
3
+ }
4
+ function credentialsBase(url) {
5
+ return `${url.replace(/\/$/, '')}/credentials/store/system/domain/_`;
6
+ }
7
+ async function credentialExists(cfg, id) {
8
+ const res = await fetch(`${credentialsBase(cfg.url)}/${encodeURIComponent(id)}/api/json`, {
9
+ headers: { Authorization: basicAuth(cfg.username, cfg.token) },
10
+ });
11
+ return res.ok;
12
+ }
13
+ export async function listCredentials(cfg) {
14
+ const res = await fetch(`${credentialsBase(cfg.url)}/api/json?depth=1`, {
15
+ headers: { Authorization: basicAuth(cfg.username, cfg.token) },
16
+ });
17
+ if (!res.ok)
18
+ throw new Error(`Jenkins credentials 조회 실패 (${res.status})`);
19
+ const data = (await res.json());
20
+ return (data.credentials ?? []).map((c) => ({
21
+ id: c.id,
22
+ displayName: c.displayName,
23
+ typeName: c.typeName,
24
+ }));
25
+ }
26
+ export async function upsertSecretText(cfg, id, secret, description = '') {
27
+ const payload = JSON.stringify({
28
+ '': '0',
29
+ credentials: {
30
+ scope: 'GLOBAL',
31
+ id,
32
+ description,
33
+ secret,
34
+ 'stapler-class': 'org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl',
35
+ '$class': 'org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl',
36
+ },
37
+ });
38
+ const base = credentialsBase(cfg.url);
39
+ const exists = await credentialExists(cfg, id);
40
+ const endpoint = exists
41
+ ? `${base}/${encodeURIComponent(id)}/updateSubmit`
42
+ : `${base}/createCredentials`;
43
+ const res = await fetch(endpoint, {
44
+ method: 'POST',
45
+ headers: {
46
+ Authorization: basicAuth(cfg.username, cfg.token),
47
+ 'Content-Type': 'application/x-www-form-urlencoded',
48
+ },
49
+ body: new URLSearchParams({ json: payload }).toString(),
50
+ });
51
+ if (!res.ok && res.status !== 302) {
52
+ throw new Error(`Jenkins credential ${exists ? 'update' : 'create'} 실패 (${res.status})`);
53
+ }
54
+ return exists ? 'updated' : 'created';
55
+ }
56
+ export async function upsertSecretFile(cfg, id, fileBase64, fileName, description = '') {
57
+ const payload = JSON.stringify({
58
+ '': '0',
59
+ credentials: {
60
+ scope: 'GLOBAL',
61
+ id,
62
+ description,
63
+ fileName,
64
+ secretBytes: fileBase64,
65
+ 'stapler-class': 'org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl',
66
+ '$class': 'org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl',
67
+ },
68
+ });
69
+ const base = credentialsBase(cfg.url);
70
+ const exists = await credentialExists(cfg, id);
71
+ const endpoint = exists
72
+ ? `${base}/${encodeURIComponent(id)}/updateSubmit`
73
+ : `${base}/createCredentials`;
74
+ const res = await fetch(endpoint, {
75
+ method: 'POST',
76
+ headers: {
77
+ Authorization: basicAuth(cfg.username, cfg.token),
78
+ 'Content-Type': 'application/x-www-form-urlencoded',
79
+ },
80
+ body: new URLSearchParams({ json: payload }).toString(),
81
+ });
82
+ if (!res.ok && res.status !== 302) {
83
+ throw new Error(`Jenkins secret file credential ${exists ? 'update' : 'create'} 실패 (${res.status})`);
84
+ }
85
+ return exists ? 'updated' : 'created';
86
+ }
87
+ export async function deleteCredential(cfg, id) {
88
+ const res = await fetch(`${credentialsBase(cfg.url)}/${encodeURIComponent(id)}/doDelete`, {
89
+ method: 'POST',
90
+ headers: { Authorization: basicAuth(cfg.username, cfg.token) },
91
+ });
92
+ if (!res.ok && res.status !== 302) {
93
+ throw new Error(`Jenkins credential 삭제 실패 (${res.status})`);
94
+ }
95
+ }
@@ -0,0 +1,2 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerJenkinsTools(server: McpServer): void;
@@ -0,0 +1,150 @@
1
+ import { z } from 'zod';
2
+ import { loadJenkinsConfig, requireJenkinsConfig, saveJenkinsConfig } from '../jenkins/config.js';
3
+ import * as creds from '../jenkins/credentials.js';
4
+ export function registerJenkinsTools(server) {
5
+ // ── 0. 상태 확인 (항상 첫 번째로 호출) ─────────────────────────────────────
6
+ server.tool('jenkins_status', [
7
+ '⭐ Jenkins 관련 작업을 시작하기 전에 반드시 이 도구를 먼저 호출하세요.',
8
+ '현재 Jenkins 연결 설정(~/.mimi-seed/jenkins.json) 유무를 확인합니다.',
9
+ '설정이 없으면 사용자에게 Jenkins URL / 사용자 ID / API Token을 물어본 뒤',
10
+ 'jenkins_save_config를 호출해 저장하세요.',
11
+ 'API Token 발급: Jenkins 대시보드 → [사용자 이름] → 설정 → API Token → "Add new Token".',
12
+ '로컬 Jenkins 없이 회사·외부 서버도 URL만 맞으면 연결 가능합니다.',
13
+ ].join(' '), {}, async () => {
14
+ const cfg = loadJenkinsConfig();
15
+ if (!cfg) {
16
+ return {
17
+ content: [{
18
+ type: 'text',
19
+ text: [
20
+ '⚠️ Jenkins 설정이 없습니다.',
21
+ '',
22
+ '다음 정보를 사용자에게 확인한 뒤 jenkins_save_config를 호출해주세요:',
23
+ '',
24
+ '1. Jenkins URL (예: https://jenkins.company.com)',
25
+ '2. Jenkins 사용자 ID (예: admin)',
26
+ '3. Jenkins API Token',
27
+ ' 발급 방법: Jenkins 대시보드 → [사용자 이름] → 설정 → API Token → "Add new Token"',
28
+ '',
29
+ '로컬 Jenkins가 없어도 회사·원격 서버의 URL을 입력하면 됩니다.',
30
+ ].join('\n'),
31
+ }],
32
+ };
33
+ }
34
+ return {
35
+ content: [{
36
+ type: 'text',
37
+ text: [
38
+ '✅ Jenkins 설정 있음',
39
+ ` URL: ${cfg.url}`,
40
+ ` 사용자: ${cfg.username}`,
41
+ ` Token: ${'*'.repeat(8)}`,
42
+ '',
43
+ 'jenkins_list_credentials 로 등록된 credential 목록을 확인하거나,',
44
+ 'jenkins_create_credential / jenkins_upload_keystore 로 credential을 추가하세요.',
45
+ ].join('\n'),
46
+ }],
47
+ };
48
+ });
49
+ // ── 1. 설정 저장 ───────────────────────────────────────────────────────────
50
+ server.tool('jenkins_save_config', [
51
+ 'Jenkins 서버 연결 설정을 저장합니다 (~/.mimi-seed/jenkins.json, mode 0600).',
52
+ '이 도구를 호출하기 전에 사용자에게 URL / username / token을 먼저 확인하세요.',
53
+ '로컬 Jenkins가 없어도 회사·원격 서버의 URL을 그대로 사용할 수 있습니다.',
54
+ 'API Token 발급: Jenkins 대시보드 → [사용자 이름] → 설정 → API Token → "Add new Token".',
55
+ '저장 후 jenkins_list_credentials 로 연결을 검증하세요.',
56
+ ].join(' '), {
57
+ url: z.string().url().describe('Jenkins 기본 URL (예: https://jenkins.company.com)'),
58
+ username: z.string().describe('Jenkins 사용자 ID'),
59
+ token: z.string().describe('Jenkins API Token'),
60
+ }, async ({ url, username, token }) => {
61
+ saveJenkinsConfig({ url, username, token });
62
+ return {
63
+ content: [{
64
+ type: 'text',
65
+ text: [
66
+ '✅ Jenkins 설정 저장 완료',
67
+ ` URL: ${url}`,
68
+ ` 사용자: ${username}`,
69
+ '',
70
+ '이제 jenkins_list_credentials 로 연결이 잘 됐는지 확인하세요.',
71
+ ].join('\n'),
72
+ }],
73
+ };
74
+ });
75
+ // ── 2. Credential 목록 ─────────────────────────────────────────────────────
76
+ server.tool('jenkins_list_credentials', [
77
+ 'Jenkins에 등록된 credential 목록을 조회합니다 (id / displayName / type).',
78
+ '설정이 없으면 jenkins_status를 먼저 호출해 연결 정보를 확인하세요.',
79
+ ].join(' '), {}, async () => {
80
+ const cfg = requireJenkinsConfig();
81
+ const list = await creds.listCredentials(cfg);
82
+ if (list.length === 0) {
83
+ return { content: [{ type: 'text', text: '등록된 Jenkins credential 없음.' }] };
84
+ }
85
+ const lines = list.map((c) => `• ${c.id} [${c.typeName}] ${c.displayName}`);
86
+ return {
87
+ content: [{
88
+ type: 'text',
89
+ text: `Jenkins credentials (${list.length}개):\n\n${lines.join('\n')}`,
90
+ }],
91
+ };
92
+ });
93
+ // ── 3. Secret Text ─────────────────────────────────────────────────────────
94
+ server.tool('jenkins_create_credential', [
95
+ 'Jenkins에 Secret Text credential을 생성하거나 업데이트합니다.',
96
+ '비밀번호, API 키, 앱 시크릿 등 문자열 값에 사용하세요.',
97
+ '같은 id가 이미 존재하면 자동으로 업데이트합니다.',
98
+ '설정이 없으면 jenkins_status를 먼저 호출하세요.',
99
+ ].join(' '), {
100
+ id: z.string().describe('Credential ID (예: speakmoney-android-key-password)'),
101
+ secret: z.string().describe('저장할 비밀값'),
102
+ description: z.string().optional().describe('설명 (선택)'),
103
+ }, async ({ id, secret, description }) => {
104
+ const cfg = requireJenkinsConfig();
105
+ const result = await creds.upsertSecretText(cfg, id, secret, description ?? '');
106
+ return {
107
+ content: [{
108
+ type: 'text',
109
+ text: `✅ Jenkins credential ${result}: \`${id}\``,
110
+ }],
111
+ };
112
+ });
113
+ // ── 4. Secret File (keystore) ──────────────────────────────────────────────
114
+ server.tool('jenkins_upload_keystore', [
115
+ 'Jenkins에 Android keystore 파일을 Secret File credential로 업로드합니다.',
116
+ 'keystore_base64에 .jks/.p12 파일을 base64로 인코딩한 값을 전달하세요.',
117
+ '같은 id가 이미 존재하면 자동으로 교체합니다.',
118
+ '설정이 없으면 jenkins_status를 먼저 호출하세요.',
119
+ ].join(' '), {
120
+ id: z.string().describe('Credential ID (예: speakmoney-android-keystore)'),
121
+ keystore_base64: z.string().describe('keystore 파일 내용을 base64로 인코딩한 값'),
122
+ file_name: z.string().default('keystore.jks').describe('파일명 (기본: keystore.jks)'),
123
+ description: z.string().optional().describe('설명 (선택)'),
124
+ }, async ({ id, keystore_base64, file_name, description }) => {
125
+ const cfg = requireJenkinsConfig();
126
+ const result = await creds.upsertSecretFile(cfg, id, keystore_base64, file_name, description ?? '');
127
+ return {
128
+ content: [{
129
+ type: 'text',
130
+ text: `✅ Jenkins keystore credential ${result}: \`${id}\` (${file_name})`,
131
+ }],
132
+ };
133
+ });
134
+ // ── 5. 삭제 ───────────────────────────────────────────────────────────────
135
+ server.tool('jenkins_delete_credential', [
136
+ 'Jenkins credential을 삭제합니다. 비가역 작업입니다.',
137
+ '설정이 없으면 jenkins_status를 먼저 호출하세요.',
138
+ ].join(' '), {
139
+ id: z.string().describe('삭제할 Credential ID'),
140
+ }, async ({ id }) => {
141
+ const cfg = requireJenkinsConfig();
142
+ await creds.deleteCredential(cfg, id);
143
+ return {
144
+ content: [{
145
+ type: 'text',
146
+ text: `🗑 Jenkins credential 삭제 완료: \`${id}\``,
147
+ }],
148
+ };
149
+ });
150
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoonion/mimi-seed-mcp",
3
- "version": "0.3.35",
3
+ "version": "0.3.37",
4
4
  "description": "Mimi Seed MCP server — Firebase + AdMob + Google Play + App Store management for Claude Code / Codex / Cursor / any MCP client.",
5
5
  "type": "module",
6
6
  "bin": {