From 65c69f5666aae3cb63069b2b2fa38f4899339c9d Mon Sep 17 00:00:00 2001 From: thug0bin Date: Mon, 2 Mar 2026 01:51:24 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20=EC=84=BC=EB=93=9C=EB=B9=8C(Send?= =?UTF-8?q?bill)=20MCP=20=EC=84=9C=EB=B2=84=20=EC=B4=88=EA=B8=B0=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 전자세금계산서 API 전체 커버 (29개 툴) - 인증서 관리, 계산서 발행(단건/묶음/대량), 상태조회, 회원관리 - 홈택스 연동 (세금계산서/현금영수증 일별/월별 매출/매입) - 휴폐업 조회, 추가메일 전송 - 에러코드표 내장 (Excel 기반) - 코드표 참조 툴 (billtype, taxrate, billstat 등) - 인증: SENDBILL_SBKEY 환경변수 Co-Authored-By: Claude Sonnet 4.6 --- .gitignore | 6 + package-lock.json | 1082 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 21 + src/client.ts | 46 ++ src/error-codes.ts | 148 ++++++ src/index.ts | 772 +++++++++++++++++++++++++++++++ tsconfig.json | 17 + 7 files changed, 2092 insertions(+) create mode 100644 .gitignore create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/client.ts create mode 100644 src/error-codes.ts create mode 100644 src/index.ts create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9a096d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +node_modules/ +dist/ +*.js.map +*.d.ts.map +.env +.env.local diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..ea064a7 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1082 @@ +{ + "name": "sendbill-mcp", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "sendbill-mcp", + "version": "1.0.0", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.0.0" + }, + "bin": { + "sendbill-mcp": "dist/index.js" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "typescript": "^5.0.0" + } + }, + "node_modules/@hono/node-server": { + "version": "1.19.9", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.9.tgz", + "integrity": "sha512-vHL6w3ecZsky+8P5MD+eFfaGTyCeOHUIFYMGpQGbrBTSmNNoxv0if69rEZ5giu36weC5saFuznL411gRX7bJDw==", + "engines": { + "node": ">=18.14.1" + }, + "peerDependencies": { + "hono": "^4" + } + }, + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.27.1", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.27.1.tgz", + "integrity": "sha512-sr6GbP+4edBwFndLbM60gf07z0FQ79gaExpnsjMGePXqFcSSb7t6iscpjk9DhFhwd+mTEQrzNafGP8/iGGFYaA==", + "dependencies": { + "@hono/node-server": "^1.19.9", + "ajv": "^8.17.1", + "ajv-formats": "^3.0.1", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.2.1", + "express-rate-limit": "^8.2.1", + "hono": "^4.11.4", + "jose": "^6.1.3", + "json-schema-typed": "^8.0.2", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.25 || ^4.0", + "zod-to-json-schema": "^3.25.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@cfworker/json-schema": "^4.1.1", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "@cfworker/json-schema": { + "optional": true + }, + "zod": { + "optional": false + } + } + }, + "node_modules/@types/node": { + "version": "20.19.35", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.35.tgz", + "integrity": "sha512-Uarfe6J91b9HAUXxjvSOdiO2UPOKLm07Q1oh0JHxoZ1y8HoqxDAu3gVrsrOHeiio0kSsoVBt4wFrKOm0dKxVPQ==", + "dev": true, + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ajv": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz", + "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventsource": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", + "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.6.tgz", + "integrity": "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.2.1.tgz", + "integrity": "sha512-PCZEIEIxqwhzw4KF0n7QF4QqruVTcF73O5kFKUnGOyjbCCgizBBiFaYpd/fnBLUMPw/BWw9OsiN7GgrNYr7j6g==", + "dependencies": { + "ip-address": "10.0.1" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ] + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hono": { + "version": "4.12.3", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.3.tgz", + "integrity": "sha512-SFsVSjp8sj5UumXOOFlkZOG6XS9SJDKw0TbwFeV+AJ8xlST8kxK5Z/5EYa111UY8732lK2S/xB653ceuaoGwpg==", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ip-address": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.0.1.tgz", + "integrity": "sha512-NWv9YLW4PoW2B7xtzaS3NCot75m6nK7Icdv0o3lfMceJVRfSoQwqD4wEH5rLwoKJwUiZ/rfpiVBhnaF0FK4HoA==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/jose": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.1.3.tgz", + "integrity": "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/json-schema-typed": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz", + "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pkce-challenge": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", + "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.0.tgz", + "integrity": "sha512-mAZTtNCeetKMH+pSjrb76NAM8V9a05I9aBZOHztWy/UqcJdQYNsf59vrRKWnojAT9Y+GbIvoTBC++CPHqpDBhQ==", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/zod": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", + "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.25.1", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", + "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", + "peerDependencies": { + "zod": "^3.25 || ^4" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..468273a --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "sendbill-mcp", + "version": "1.0.0", + "description": "센드빌 전자세금계산서 API MCP 서버", + "type": "module", + "bin": { + "sendbill-mcp": "./dist/index.js" + }, + "scripts": { + "build": "tsc", + "dev": "tsc --watch", + "start": "node dist/index.js" + }, + "dependencies": { + "@modelcontextprotocol/sdk": "^1.0.0" + }, + "devDependencies": { + "typescript": "^5.0.0", + "@types/node": "^20.0.0" + } +} diff --git a/src/client.ts b/src/client.ts new file mode 100644 index 0000000..1a8e068 --- /dev/null +++ b/src/client.ts @@ -0,0 +1,46 @@ +// 센드빌 API HTTP 클라이언트 + +const BASE_URL = "https://api.sendbill.co.kr"; + +export class SendbillClient { + private sbkey: string; + + constructor(sbkey: string) { + this.sbkey = sbkey; + } + + async post(endpoint: string, body: Record): Promise { + const url = `${BASE_URL}${endpoint}`; + const response = await fetch(url, { + method: "POST", + headers: { + "SBKEY": this.sbkey, + "Content-Type": "application/json; charset=UTF-8", + "Accept-Charset": "UTF-8", + }, + body: JSON.stringify(body), + }); + + if (!response.ok) { + throw new Error(`HTTP 오류: ${response.status} ${response.statusText}`); + } + + const text = await response.text(); + try { + return JSON.parse(text); + } catch { + return { raw: text }; + } + } +} + +export function createClient(): SendbillClient { + const sbkey = process.env.SENDBILL_SBKEY; + if (!sbkey) { + throw new Error( + "SENDBILL_SBKEY 환경변수가 설정되지 않았습니다.\n" + + "사용법: SENDBILL_SBKEY=your-key npx sendbill-mcp" + ); + } + return new SendbillClient(sbkey); +} diff --git a/src/error-codes.ts b/src/error-codes.ts new file mode 100644 index 0000000..ed13057 --- /dev/null +++ b/src/error-codes.ts @@ -0,0 +1,148 @@ +// 센드빌 API 에러코드 참조표 +// 출처: https://www.sendbill.co.kr/SendbillAPI_Error_Code.xls + +export const ERROR_CODES: Record = { + // SBKEY 관련 + "-10001": "SBKEY Header 데이터가 없습니다.", + "-10002": "SBKEY의 데이터가 옳바르지 않습니다.", + "-10003": "폐기 처리된 SBKEY 입니다.", + "-10004": "SBKEY의 사용 기간이 만료되었습니다.", + + // 인증서 관련 + "-11001": "실패", + "-11002": "등록된 인증서가 없습니다.", + "-11003": "기타오류, 고객센터로 문의 바랍니다.", + "-11004": "파일 업로드 중 오류가 발생하였습니다.", + "-11101": "올바른 파일을 선택해 주세요.", + "-11102": "[venderno] 필수 항목입니다.", + "-11103": "[venderno] 최대 길이는 10 bytes 입니다.", + "-11104": "[venderno] 숫자만 입력 가능합니다.", + "-11105": "[venderno] 올바른 형태의 사업자번호가 아닙니다.", + "-11106": "[password] 필수 항목입니다.", + "-11107": "[certderfile] 필수 항목입니다.", + "-11108": "[certkeyfile] 필수 항목입니다.", + "-11401": "등록된 인증서의 발급 정보와 사업자 번호가 일치하지 않습니다.", + "-11402": "인증서의 발급 정보와 인증서 비밀번호가 일치하지 않습니다.", + "-11403": "인증서의 사용기간이 만료되었습니다.", + "-11509": "등록된 인증서의 데이터가 옳바르지 않습니다. 인증서 신규 등록 후 다시 시도해주세요.", + "-11701": "URL 유효 시간이 만료되었습니다.", + "-11702": "token 오류, token 재발행 후 재시도해주세요.", + "-11703": "올바르지 않은 토큰입니다.", + + // 계산서 발행 관련 + "-12001": "실패", + "-12002": "조회된 데이터가 없습니다.", + "-12003": "기타오류, 고객센터로 문의 바랍니다.", + "-66666": "/api/agent/document/registDirect 긴급점검중 입니다.", + "-12501": "충전된 요금이 부족합니다.", + "-12502": "우대권 잔여 건 수 및 충전된 요금이 부족합니다.", + "-12503": "[대납] 충전된 요금이 부족합니다.", + "-12504": "[대납] 우대권 잔여 건 수 및 충전된 요금이 부족합니다.", + "-12631": "[A] 공급자 사업자번호에 해당하는 회원 ID가 없습니다.", + "-12633": "[A] 공급받는자 사업자번호에 해당하는 회원 ID가 없습니다.", + "-12641": "[A] 관리자가 마감하여 전송할 수 없습니다.", + "-12651": "[A] 품목의 합계 금액이 총 금액과 맞지 않습니다.", + "-12654": "[A] 과세기간(반기)이 지난 세금계산서는 발행이 불가능 합니다.", + "-12701": "발행자의 인증서가 등록되어 있지 않습니다.", + "-12703": "발행자의 등록된 인증서 사용기간이 만료되었습니다.", + "-12101": "[Billseq] 데이터가 중복되었습니다.", + "-12102": "[Item(Array)] 필수 항목입니다.", + + // 회원 등록 관련 + "-13001": "실패", + "-13002": "조회된 데이터가 없습니다.", + "-13003": "기타오류, 고객센터로 문의 바랍니다.", + "-13101": "이미 등록된 아이디 입니다.", + + // 계산서 관리 관련 + "-14001": "실패", + "-14002": "조회된 데이터가 없습니다.", + "-14003": "기타오류, 고객센터로 문의 바랍니다.", + "-14101": "[Orderseq] 데이터 중복 입니다.", + "-14102": "[Billseq] 필수 항목 입니다.", + "-14104": "[cmd_div] 필수 항목 입니다.", + "-14110": "[cmd_div] 올바른 코드 값을 입력 해주세요. [ 6, E ]", + + // 계산서 상태조회 관련 + "-15001": "실패", + "-15002": "조회된 데이터가 없습니다.", + "-15101": "[Billseq] 필수 항목 입니다.", + + // 홈택스 연동 관련 + "-18001": "실패", + "-18002": "조회된 데이터가 없습니다.", + "-18004": "홈택스에서 조회된 데이터가 없습니다.", + "-18101": "요청 사업자번호의 인증서가 등록되어 있지 않습니다.", + "-18403": "센드빌에 등록된 홈택스 계정 또는 인증서 정보가 없습니다.", + "-18401": "홈택스연동 사용 사업자가 아닙니다. 고객센터에 문의 바랍니다.", +}; + +export function getErrorMessage(code: number | string): string { + const key = String(Math.round(Number(code))); + return ERROR_CODES[key] ?? `알 수 없는 오류 코드: ${code}`; +} + +// 코드표 +export const CODE_TABLES = { + billtype: { + "10": "세금계산서", + "11": "비회원 세금계산서", + "20": "(면세)계산서", + "21": "비회원(면세)계산서", + "30": "거래명세서", + "31": "비회원 거래명세서", + "40": "위수탁 세금계산서", + "41": "비회원 위수탁 세금계산서", + "50": "위수탁 (면세)계산서", + "51": "비회원 위수탁 (면세)계산서", + "61": "개인 매출 세금계산서", + "62": "개인 매출 계산서", + "Y1": "외부 매출 세금계산서", + "Z1": "외부 매입 세금계산서", + }, + cmd_div: { + "6": "삭제요청", + "E": "EMAIL 전송", + }, + taxrate: { + "0": "과세율", + "1": "영세율", + "2": "면세율", + "3": "매입세액불공제", + "4": "의제매입", + }, + report_stat: { + "N": "미신고", + "A": "접수대기", + "B": "접수완료", + "R": "신고상태", + "F": "신고실패", + }, + report_amend_cd: { + "1": "기재사항 착오/정정", + "2": "공급가액 변동", + "3": "환입", + "4": "계약의 해제", + "5": "내국신용장 사후 개설", + "6": "착오에 의한 이중발행", + }, + billstat: { + "5": "미전송", + "0": "미개봉", + "3": "개봉", + "1": "승인", + "2": "반려", + "4": "승인취소", + "9": "종이문서저장", + "6": "삭제", + }, + gubun: { + "1": "영수", + "2": "청구", + }, + etc01: { + "S": "SENDID: 센드빌 ID / RECVID: 센드빌 ID", + "I": "SENDID: 센드빌 ID / RECVID: 거래처 ID", + "X": "SENDID: 거래처 ID / RECVID: 거래처 ID", + }, +}; diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..ea57530 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,772 @@ +#!/usr/bin/env node +/** + * 센드빌(Sendbill) MCP 서버 + * 전자세금계산서 API 연동을 위한 Model Context Protocol 서버 + * + * Base URL: https://api.sendbill.co.kr + * 인증: SBKEY 헤더 (환경변수 SENDBILL_SBKEY) + * + * 지원 기능: + * - 인증서 관리 (토큰, 등록, 조회, 삭제) + * - 계산서(세금) 발행 (단건/묶음/대량) + * - 계산서 상태조회 및 관리 + * - 회원 등록 관리 + * - 홈택스 연동 (세금계산서/현금영수증 조회) + * - 휴폐업 조회 + * - 추가메일 전송 + */ + +import { Server } from "@modelcontextprotocol/sdk/server/index.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { + CallToolRequestSchema, + ListToolsRequestSchema, +} from "@modelcontextprotocol/sdk/types.js"; +import { createClient } from "./client.js"; +import { getErrorMessage, CODE_TABLES } from "./error-codes.js"; + +const server = new Server( + { name: "sendbill-mcp", version: "1.0.0" }, + { capabilities: { tools: {} } } +); + +// ───────────────────────────────────────────── +// 툴 목록 정의 +// ───────────────────────────────────────────── +server.setRequestHandler(ListToolsRequestSchema, async () => ({ + tools: [ + // ── 인증서 관리 ────────────────────────── + { + name: "sendbill_get_token", + description: + "인증서 등록에 사용할 휘발성 토큰을 생성합니다. (유효시간: 5분)\n" + + "POST /api/agent/certificate/gettoken", + inputSchema: { + type: "object", + properties: { + venderno: { + type: "string", + description: "센드빌 회원사 사업자번호 (하이픈 제외 10자리)", + }, + }, + required: ["venderno"], + }, + }, + { + name: "sendbill_upload_cert", + description: + "계산서 발행을 위해 공인인증서를 센드빌에 등록합니다.\n" + + "POST /api/agent/certificate/uploadcert\n" + + "certderfile, certkeyfile은 각각 signCert.der, signPri.key 파일을 Base64 인코딩한 값입니다.", + inputSchema: { + type: "object", + properties: { + jwt: { type: "string", description: "sendbill_get_token으로 발급받은 토큰" }, + password: { type: "string", description: "인증서 비밀번호" }, + certderfile: { type: "string", description: "signCert.der 파일 Base64 인코딩값" }, + certkeyfile: { type: "string", description: "signPri.key 파일 Base64 인코딩값" }, + }, + required: ["jwt", "password", "certderfile", "certkeyfile"], + }, + }, + { + name: "sendbill_inquire_cert", + description: + "센드빌에 등록된 인증서의 만료일자를 조회합니다.\n" + + "POST /api/agent/certificate/inquirecert", + inputSchema: { + type: "object", + properties: { + jwt: { type: "string", description: "sendbill_get_token으로 발급받은 토큰" }, + }, + required: ["jwt"], + }, + }, + { + name: "sendbill_delete_cert", + description: + "센드빌에 등록된 인증서를 삭제합니다.\n" + + "POST /api/agent/certificate/deletecert", + inputSchema: { + type: "object", + properties: { + jwt: { type: "string", description: "sendbill_get_token으로 발급받은 토큰" }, + password: { type: "string", description: "등록된 인증서 비밀번호" }, + }, + required: ["jwt", "password"], + }, + }, + { + name: "sendbill_get_cert_upload_view", + description: + "타사가 직접 인증서를 등록할 수 있는 폼 URL을 생성합니다. (유효시간: 5분)\n" + + "POST /api/agent/certificate/getuploadview", + inputSchema: { + type: "object", + properties: { + venderno: { type: "string", description: "사업자번호 (하이픈 제외 10자리)" }, + }, + required: ["venderno"], + }, + }, + + // ── 계산서 발행 ────────────────────────── + { + name: "sendbill_register_invoice", + description: + "전자세금계산서(또는 계산서)를 단건 발행합니다.\n" + + "POST /api/agent/document/registDirect\n" + + "billtype 코드: 10=세금계산서, 20=(면세)계산서, 30=거래명세서, 40=위수탁세금계산서 등\n" + + "gubun: 1=영수, 2=청구\n" + + "taxrate: 0=과세, 1=영세, 2=면세", + inputSchema: { + type: "object", + properties: { + billseq: { type: "string", description: "세금계산서 고유번호 (최대 25자, 중복불가)" }, + svenderno: { type: "string", description: "공급자 사업자번호 (하이픈 제외 10자리)" }, + rvenderno: { type: "string", description: "공급받는자 사업자번호 또는 주민등록번호 (13자리 이내)" }, + dt: { type: "string", description: "작성일 (YYYY-MM-DD, 미래일자 불가)" }, + supmoney: { type: "string", description: "공급가액 총액 (숫자, 최대 13자리)" }, + taxmoney: { type: "string", description: "세액 총액 (숫자, 최대 13자리)" }, + billtype: { type: "string", description: "계산서 종류 코드 (10/11/20/21/30/31/40/41/50/51/61/62/Y1/Z1)" }, + gubun: { type: "string", description: "청구구분 (1=영수, 2=청구)" }, + taxrate: { type: "string", description: "과세구분 (0=과세, 1=영세, 2=면세, 3=매입세액불공제, 4=의제매입)" }, + scompany: { type: "string", description: "공급자 업체명" }, + sceoname: { type: "string", description: "공급자 대표자명" }, + suptae: { type: "string", description: "공급자 업태" }, + supjong: { type: "string", description: "공급자 업종" }, + saddress: { type: "string", description: "공급자 주소" }, + suser: { type: "string", description: "공급자 담당자명" }, + stelno: { type: "string", description: "공급자 전화번호 (000-0000-0000)" }, + semail: { type: "string", description: "공급자 이메일" }, + rcompany: { type: "string", description: "공급받는자 업체명" }, + rceoname: { type: "string", description: "공급받는자 대표자명" }, + ruptae: { type: "string", description: "공급받는자 업태" }, + rupjong: { type: "string", description: "공급받는자 업종" }, + raddress: { type: "string", description: "공급받는자 주소" }, + ruser: { type: "string", description: "공급받는자 담당자명" }, + rtelno: { type: "string", description: "공급받는자 전화번호" }, + remail: { type: "string", description: "공급받는자 이메일" }, + report_except_yn: { type: "string", description: "신고 제외 여부 (Y/N, 기본값 N)" }, + reverseyn: { type: "string", description: "역발행 여부 (Y/N, 기본값 N)" }, + transyn: { type: "string", description: "전송 여부 (Y/N, 기본값 N)" }, + test_yn: { type: "string", description: "테스트 여부 (Y/N, 기본값 N)" }, + bigo: { type: "string", description: "비고 (최대 150자)" }, + cash: { type: "string", description: "현금 지급액" }, + checks: { type: "string", description: "수표 지급액" }, + note: { type: "string", description: "어음 지급액" }, + credit: { type: "string", description: "외상미수금" }, + sendid: { type: "string", description: "공급자 센드빌 ID (etc01 코드에 따라 결정)" }, + recvid: { type: "string", description: "공급받는자 센드빌 ID (etc01 코드에 따라 결정)" }, + etc01: { type: "string", description: "ID 구분 (X=거래처ID, I=공급자ID+거래처ID, S=양쪽 센드빌ID, 기본값 X)" }, + etc03: { type: "string", description: "비회원 자동가입 여부 (Y/N, 기본값 N)" }, + file_url: { type: "string", description: "첨부파일 URL (최대 250자)" }, + upbillseq: { type: "string", description: "수정세금계산서의 원본 고유번호" }, + report_amend_cd: { type: "string", description: "수정사유 코드 (1=착오정정, 2=공급가액변동, 3=환입, 4=계약해제, 5=내국신용장, 6=이중발행)" }, + item: { + type: "array", + description: "품목 목록 (필수)", + items: { + type: "object", + properties: { + tax: { type: "string", description: "품목별 세액" }, + sup: { type: "string", description: "품목별 공급가액" }, + danga: { type: "string", description: "단가" }, + vlm: { type: "string", description: "수량" }, + unit: { type: "string", description: "규격" }, + obj: { type: "string", description: "품목명" }, + dt: { type: "string", description: "품목별 거래일자 (YYYY-MM-DD)" }, + remark: { type: "string", description: "비고" }, + }, + required: ["tax", "sup", "dt"], + }, + }, + broker: { + type: "object", + description: "수탁자 정보 (billtype 40/41/50/51인 경우만 사용)", + properties: { + venderno: { type: "string" }, + company: { type: "string" }, + ceoname: { type: "string" }, + uptae: { type: "string" }, + upjong: { type: "string" }, + address: { type: "string" }, + email: { type: "string" }, + nid: { type: "string", description: "연동ID" }, + }, + }, + }, + required: [ + "billseq", "svenderno", "rvenderno", "dt", "supmoney", "taxmoney", + "billtype", "gubun", "scompany", "sceoname", "rcompany", "rceoname", + "report_except_yn", "reverseyn", "item" + ], + }, + }, + { + name: "sendbill_register_invoice_multi", + description: + "수정세금계산서를 최대 2건 동시 발행합니다. (묶음 발행)\n" + + "POST /api/agent/document/registMultiDirect\n" + + "주로 기재사항 착오/정정, 내국신용장 사후 개설 시 원본+수정본을 한 번에 발행할 때 사용.\n" + + "1건이라도 오류 시 전체 취소됩니다.", + inputSchema: { + type: "object", + properties: { + documents: { + type: "array", + description: "발행할 계산서 목록 (최대 2건). 각 항목은 sendbill_register_invoice와 동일한 형식.", + items: { type: "object" }, + maxItems: 2, + }, + }, + required: ["documents"], + }, + }, + { + name: "sendbill_register_invoice_bulk", + description: + "전자세금계산서를 최대 100건 대량 발행합니다.\n" + + "POST /api/agent/document/registBulkDirect\n" + + "일부 실패 시에도 성공건은 발행됩니다. 응답에 성공/실패 건수와 오류 목록이 포함됩니다.", + inputSchema: { + type: "object", + properties: { + documents: { + type: "array", + description: "발행할 계산서 목록 (최대 100건). 각 항목은 sendbill_register_invoice와 동일한 형식.", + items: { type: "object" }, + maxItems: 100, + }, + }, + required: ["documents"], + }, + }, + + // ── 계산서 조회/관리 ───────────────────── + { + name: "sendbill_get_invoice_status", + description: + "세금계산서의 상태를 단건 조회합니다.\n" + + "POST /api/agent/status/detail\n" + + "billstat 코드: 0=미개봉, 1=승인, 2=반려, 3=개봉, 4=승인취소, 5=미전송, 6=삭제, 9=종이문서저장\n" + + "transyn: Y=전송성공, N=전송대기, E=에러", + inputSchema: { + type: "object", + properties: { + billseq: { type: "string", description: "세금계산서 고유번호" }, + }, + required: ["billseq"], + }, + }, + { + name: "sendbill_get_invoice_status_list", + description: + "세금계산서 상태를 최대 1000건 다중 조회합니다.\n" + + "POST /api/agent/status/list", + inputSchema: { + type: "object", + properties: { + billseqs: { + type: "array", + description: "조회할 세금계산서 고유번호 목록 (최대 1000건)", + items: { type: "string" }, + maxItems: 1000, + }, + }, + required: ["billseqs"], + }, + }, + { + name: "sendbill_manage_invoice", + description: + "세금계산서에 대한 관리 요청을 처리합니다. (삭제 또는 이메일 재전송)\n" + + "POST /api/agent/manager/registDirect\n" + + "cmd_div: 6=삭제요청, E=EMAIL 전송\n" + + "EMAIL 전송 시 remark에 전송할 이메일 주소를 입력하세요.", + inputSchema: { + type: "object", + properties: { + billseq: { type: "string", description: "세금계산서 고유번호" }, + cmd_div: { type: "string", description: "요청코드 (6=삭제, E=이메일전송)" }, + remark: { type: "string", description: "이메일 전송 시 수신자 이메일 주소 (최대 500자)" }, + etc1: { type: "string", description: "기타1 (최대 200자)" }, + etc2: { type: "string", description: "기타2 (최대 200자)" }, + etc3: { type: "string", description: "기타3 (최대 200자)" }, + etc4: { type: "string", description: "기타4 (최대 200자)" }, + etc5: { type: "string", description: "기타5 (최대 200자)" }, + }, + required: ["billseq", "cmd_div"], + }, + }, + { + name: "sendbill_get_invoice_error_log", + description: + "세금계산서 발행 시 발생한 에러 로그를 조회합니다.\n" + + "POST /api/agent/log/bill", + inputSchema: { + type: "object", + properties: { + billseq: { type: "string", description: "세금계산서 고유번호" }, + }, + required: ["billseq"], + }, + }, + { + name: "sendbill_get_manage_error_log", + description: + "계산서 관리 요청(삭제/이메일 전송 등) 시 발생한 에러 로그를 조회합니다.\n" + + "POST /api/agent/log/manager", + inputSchema: { + type: "object", + properties: { + billseq: { type: "string", description: "세금계산서 고유번호" }, + }, + required: ["billseq"], + }, + }, + + // ── 회원 관리 ──────────────────────────── + { + name: "sendbill_register_member", + description: + "센드빌에 거래처(비회원)를 임시 회원으로 등록합니다.\n" + + "POST /api/agent/member/registDirect\n" + + "비회원 세금계산서를 사용하지 않는 경우, 반드시 거래처가 센드빌에 등록되어 있어야 합니다.", + inputSchema: { + type: "object", + properties: { + entcode: { type: "string", description: "제휴업체 코드 (4자리)" }, + id: { type: "string", description: "회원 아이디 (최대 20자)" }, + company: { type: "string", description: "업체명 (최대 200자)" }, + venderno: { type: "string", description: "사업자 등록번호 (하이픈 제외 10자리)" }, + ceoname: { type: "string", description: "대표자명 (최대 100자)" }, + uptae: { type: "string", description: "업태 (최대 100자)" }, + upjong: { type: "string", description: "업종 (최대 100자)" }, + address: { type: "string", description: "주소 (최대 150자)" }, + mgmt_yn: { type: "string", description: "관리자 구분 (Y/N)" }, + email_yn: { type: "string", description: "이메일 수신 여부 (Y/N)" }, + sms_yn: { type: "string", description: "SMS 수신 여부 (Y/N)" }, + zipcode: { type: "string", description: "우편번호 (6자리)" }, + address2: { type: "string", description: "상세주소" }, + email: { type: "string", description: "이메일" }, + users: { type: "string", description: "담당자명" }, + fax: { type: "string", description: "팩스번호" }, + tel: { type: "string", description: "전화번호" }, + division: { type: "string", description: "부서명" }, + resno: { type: "string", description: "주민등록번호 (13자리)" }, + smsno: { type: "string", description: "핸드폰번호" }, + sign_yn: { type: "string", description: "담당자 동의 여부 (Y/N)" }, + }, + required: ["entcode", "id", "company", "venderno", "ceoname", "uptae", "upjong", "address", "mgmt_yn", "email_yn", "sms_yn"], + }, + }, + { + name: "sendbill_get_member_error_log", + description: + "회원 등록 요청 시 발생한 에러 로그를 조회합니다.\n" + + "POST /api/agent/log/member", + inputSchema: { + type: "object", + properties: { + entcode: { type: "string", description: "제휴업체 코드 (최대 6자리)" }, + userid: { type: "string", description: "회원 아이디(임시가입) (최대 30자)" }, + }, + required: ["entcode", "userid"], + }, + }, + + // ── 홈택스 연동 ────────────────────────── + { + name: "sendbill_hometax_query_tax_invoice", + description: + "홈택스에서 세금계산서 매출/매입 내역을 조회합니다.\n" + + "direction: sales=매출, purchase=매입\n" + + "period: daily=일별(basedate), monthly=월별(basemonth)\n" + + "taxtype: '01'=과세+영세, '03'=면세\n" + + "datetype: '01'=작성일자, '02'=발행일자\n" + + "orderdirection: '01'=내림차순, '02'=오름차순\n" + + "⚠️ 홈택스 접근제어로 30건당 5초 딜레이가 있습니다.", + inputSchema: { + type: "object", + properties: { + direction: { type: "string", enum: ["sales", "purchase"], description: "조회 방향 (sales=매출, purchase=매입)" }, + period: { type: "string", enum: ["daily", "monthly"], description: "조회 주기 (daily=일별, monthly=월별)" }, + venderno: { type: "string", description: "사업자번호 (10자리)" }, + taxtype: { type: "string", description: "과세구분 ('01'=과세+영세, '03'=면세)" }, + datetype: { type: "string", description: "기준일자 유형 ('01'=작성일자, '02'=발행일자)" }, + basedate: { type: "string", description: "기준일자 (YYYYMMDD, period=daily일 때)" }, + basemonth: { type: "string", description: "기준월 (YYYYMM, period=monthly일 때)" }, + orderdirection: { type: "string", description: "정렬방향 ('01'=내림차순, '02'=오름차순)" }, + }, + required: ["direction", "period", "venderno", "taxtype", "datetype", "orderdirection"], + }, + }, + { + name: "sendbill_hometax_query_cash_receipt", + description: + "홈택스에서 현금영수증 매출/매입 내역을 조회합니다.\n" + + "direction: sales=매출, purchase=매입\n" + + "period: daily=일별(basedate), monthly=월별(basemonth)\n" + + "orderdirection: '01'=내림차순, '02'=오름차순\n" + + "⚠️ 홈택스 접근제어로 30건당 5초 딜레이가 있습니다.", + inputSchema: { + type: "object", + properties: { + direction: { type: "string", enum: ["sales", "purchase"], description: "조회 방향 (sales=매출, purchase=매입)" }, + period: { type: "string", enum: ["daily", "monthly"], description: "조회 주기 (daily=일별, monthly=월별)" }, + venderno: { type: "string", description: "사업자번호 (10자리)" }, + basedate: { type: "string", description: "기준일자 (YYYYMMDD, period=daily일 때)" }, + basemonth: { type: "string", description: "기준월 (YYYYMM, period=monthly일 때)" }, + orderdirection: { type: "string", description: "정렬방향 ('01'=내림차순, '02'=오름차순)" }, + }, + required: ["direction", "period", "venderno", "orderdirection"], + }, + }, + { + name: "sendbill_hometax_register_account", + description: + "홈택스 연동을 위한 홈택스 계정을 센드빌에 등록합니다.\n" + + "POST /api/agent/hometax/account/regist\n" + + "세금계산서용과 현금영수증용 계정을 별도로 사용합니다.", + inputSchema: { + type: "object", + properties: { + jwt: { type: "string", description: "sendbill_get_token으로 발급받은 토큰" }, + billhtid: { type: "string", description: "세금계산서용 홈택스 아이디" }, + billhtpw: { type: "string", description: "세금계산서용 홈택스 패스워드" }, + cashhtid: { type: "string", description: "현금영수증용 홈택스 아이디" }, + cashhtpw: { type: "string", description: "현금영수증용 홈택스 패스워드" }, + }, + required: ["jwt", "billhtid", "billhtpw", "cashhtid", "cashhtpw"], + }, + }, + { + name: "sendbill_hometax_delete_account", + description: + "홈택스 연동계정을 센드빌에서 삭제합니다.\n" + + "POST /api/agent/hometax/account/delete\n" + + "계정 존재 유무에 대한 결과는 반환되지 않습니다.", + inputSchema: { + type: "object", + properties: { + jwt: { type: "string", description: "sendbill_get_token으로 발급받은 토큰" }, + }, + required: ["jwt"], + }, + }, + { + name: "sendbill_hometax_get_register_view", + description: + "타사가 직접 홈택스 연동계정을 등록할 수 있는 폼 URL을 생성합니다. (유효시간: 10분)\n" + + "POST /api/agent/hometax/account/getRegistView", + inputSchema: { + type: "object", + properties: { + venderno: { type: "string", description: "사업자번호 (하이픈 제외 10자리)" }, + }, + required: ["venderno"], + }, + }, + + // ── 휴폐업 조회 ────────────────────────── + { + name: "sendbill_company_close_search", + description: + "사업자의 휴업/폐업 상태를 최대 100건 조회합니다.\n" + + "POST /api/agent/companyclosesearch\n" + + "국세청 데이터를 실시간으로 조회합니다.", + inputSchema: { + type: "object", + properties: { + venderno: { + type: "array", + description: "조회할 사업자번호 목록 (하이픈 제외 10자리, 최대 100건)", + items: { type: "string" }, + maxItems: 100, + }, + }, + required: ["venderno"], + }, + }, + + // ── 추가메일 전송 ───────────────────────── + { + name: "sendbill_send_additional_mail", + description: + "이미 발행한 계산서의 이메일을 추가 주소로 재전송합니다.\n" + + "POST /api/agent/additionalMail/sendAdditionalMail", + inputSchema: { + type: "object", + properties: { + billseq: { type: "string", description: "발행 문서 고유번호 (최대 19자)" }, + sendType: { type: "string", description: "전송타입 코드" }, + newMailAddress: { type: "string", description: "신규 전송 메일 주소 (최대 30자)" }, + }, + required: ["billseq", "sendType", "newMailAddress"], + }, + }, + { + name: "sendbill_get_mail_send_list", + description: + "API로 발행한 계산서의 이메일 전송 내역과 수신 여부를 조회합니다.\n" + + "POST /api/agent/additionalMail/sendMailList", + inputSchema: { + type: "object", + properties: { + billseq: { type: "string", description: "API 발행 문서 고유번호 (최대 19자)" }, + }, + required: ["billseq"], + }, + }, + + // ── 참조 도구 ───────────────────────────── + { + name: "sendbill_get_error_message", + description: + "센드빌 API 에러코드에 해당하는 한국어 메시지를 조회합니다.\n" + + "API 응답에서 음수 Result 코드를 받았을 때 사용하세요.", + inputSchema: { + type: "object", + properties: { + code: { type: "number", description: "에러코드 (음수, 예: -10001)" }, + }, + required: ["code"], + }, + }, + { + name: "sendbill_get_code_tables", + description: + "센드빌 API에서 사용하는 코드표 전체를 반환합니다.\n" + + "billtype, cmd_div, taxrate, billstat, gubun, etc01, report_stat, report_amend_cd 코드를 확인할 수 있습니다.", + inputSchema: { + type: "object", + properties: { + table: { + type: "string", + enum: ["billtype", "cmd_div", "taxrate", "billstat", "gubun", "etc01", "report_stat", "report_amend_cd", "all"], + description: "조회할 코드표 이름 (all=전체 조회)", + }, + }, + required: ["table"], + }, + }, + ], +})); + +// ───────────────────────────────────────────── +// 툴 실행 핸들러 +// ───────────────────────────────────────────── +server.setRequestHandler(CallToolRequestSchema, async (request) => { + const { name, arguments: args } = request.params; + + // 참조 도구는 API 호출 없음 + if (name === "sendbill_get_error_message") { + const code = (args as { code: number }).code; + const message = getErrorMessage(code); + return { + content: [{ type: "text", text: `에러코드 ${code}: ${message}` }], + }; + } + + if (name === "sendbill_get_code_tables") { + const table = (args as { table: string }).table; + if (table === "all") { + return { + content: [{ type: "text", text: JSON.stringify(CODE_TABLES, null, 2) }], + }; + } + const tableData = CODE_TABLES[table as keyof typeof CODE_TABLES]; + if (!tableData) { + return { + content: [{ type: "text", text: `코드표 '${table}'를 찾을 수 없습니다.` }], + isError: true, + }; + } + return { + content: [{ type: "text", text: JSON.stringify({ [table]: tableData }, null, 2) }], + }; + } + + // API 호출 도구 + const client = createClient(); + + type EndpointMap = Record) => Record]>; + + const endpoints: EndpointMap = { + // 인증서 관리 + sendbill_get_token: ["/api/agent/certificate/gettoken", (a) => ({ venderno: a.venderno })], + sendbill_upload_cert: ["/api/agent/certificate/uploadcert", (a) => ({ + jwt: a.jwt, password: a.password, certderfile: a.certderfile, certkeyfile: a.certkeyfile + })], + sendbill_inquire_cert: ["/api/agent/certificate/inquirecert", (a) => ({ jwt: a.jwt })], + sendbill_delete_cert: ["/api/agent/certificate/deletecert", (a) => ({ jwt: a.jwt, password: a.password })], + sendbill_get_cert_upload_view: ["/api/agent/certificate/getuploadview", (a) => ({ venderno: a.venderno })], + + // 계산서 발행 + sendbill_register_invoice: ["/api/agent/document/registDirect", (a) => a], + sendbill_register_invoice_multi: ["/api/agent/document/registMultiDirect", (a) => a], + sendbill_register_invoice_bulk: ["/api/agent/document/registBulkDirect", (a) => a], + + // 계산서 조회/관리 + sendbill_get_invoice_status: ["/api/agent/status/detail", (a) => ({ billseq: a.billseq })], + sendbill_get_invoice_status_list: ["/api/agent/status/list", (a) => ({ billseqs: a.billseqs })], + sendbill_manage_invoice: ["/api/agent/manager/registDirect", (a) => a], + sendbill_get_invoice_error_log: ["/api/agent/log/bill", (a) => ({ billseq: a.billseq })], + sendbill_get_manage_error_log: ["/api/agent/log/manager", (a) => ({ billseq: a.billseq })], + + // 회원 관리 + sendbill_register_member: ["/api/agent/member/registDirect", (a) => a], + sendbill_get_member_error_log: ["/api/agent/log/member", (a) => ({ entcode: a.entcode, userid: a.userid })], + + // 홈택스 연동 + sendbill_hometax_register_account: ["/api/agent/hometax/account/regist", (a) => a], + sendbill_hometax_delete_account: ["/api/agent/hometax/account/delete", (a) => ({ jwt: a.jwt })], + sendbill_hometax_get_register_view: ["/api/agent/hometax/account/getRegistView", (a) => ({ venderno: a.venderno })], + + // 휴폐업 조회 + sendbill_company_close_search: ["/api/agent/companyclosesearch", (a) => ({ venderno: a.venderno })], + + // 추가메일 + sendbill_send_additional_mail: ["/api/agent/additionalMail/sendAdditionalMail", (a) => a], + sendbill_get_mail_send_list: ["/api/agent/additionalMail/sendMailList", (a) => ({ billseq: a.billseq })], + }; + + // 홈택스 조회는 방향+주기에 따라 엔드포인트가 다름 + if (name === "sendbill_hometax_query_tax_invoice") { + const a = args as Record; + const direction = a.direction as string; + const period = a.period as string; + + const endpointMap: Record = { + "sales-daily": "/api/agent/hometax/listDailyTaxInvoiceSales", + "sales-monthly": "/api/agent/hometax/listMonthlyTaxInvoiceSales", + "purchase-daily": "/api/agent/hometax/listDailyTaxInvoicePurchase", + "purchase-monthly": "/api/agent/hometax/listMonthlyTaxInvoicePurchase", + }; + + const endpoint = endpointMap[`${direction}-${period}`]; + if (!endpoint) { + return { content: [{ type: "text", text: "잘못된 direction 또는 period 값입니다." }], isError: true }; + } + + const body: Record = { + venderno: a.venderno, + taxtype: a.taxtype, + datetype: a.datetype, + orderdirection: a.orderdirection, + }; + if (period === "daily") body.basedate = a.basedate; + else body.basemonth = a.basemonth; + + try { + const result = await client.post(endpoint, body); + const text = formatResult(result); + return { content: [{ type: "text", text }] }; + } catch (err: unknown) { + const message = err instanceof Error ? err.message : String(err); + return { content: [{ type: "text", text: `API 오류: ${message}` }], isError: true }; + } + } + + if (name === "sendbill_hometax_query_cash_receipt") { + const a = args as Record; + const direction = a.direction as string; + const period = a.period as string; + + const endpointMap: Record = { + "sales-daily": "/api/agent/hometax/listDailyCashBillSales", + "sales-monthly": "/api/agent/hometax/listMonthlyCashBillSales", + "purchase-daily": "/api/agent/hometax/listDailyCashBillPurchase", + "purchase-monthly": "/api/agent/hometax/listMonthlyCashBillPurchase", + }; + + const endpoint = endpointMap[`${direction}-${period}`]; + if (!endpoint) { + return { content: [{ type: "text", text: "잘못된 direction 또는 period 값입니다." }], isError: true }; + } + + const body: Record = { + venderno: a.venderno, + orderdirection: a.orderdirection, + }; + if (period === "daily") body.basedate = a.basedate; + else body.basemonth = a.basemonth; + + try { + const result = await client.post(endpoint, body); + const text = formatResult(result); + return { content: [{ type: "text", text }] }; + } catch (err: unknown) { + const message = err instanceof Error ? err.message : String(err); + return { content: [{ type: "text", text: `API 오류: ${message}` }], isError: true }; + } + } + + // 일반 엔드포인트 처리 + const entry = endpoints[name]; + if (!entry) { + return { + content: [{ type: "text", text: `알 수 없는 툴: ${name}` }], + isError: true, + }; + } + + const [endpoint, buildBody] = entry; + const body = buildBody(args as Record); + + try { + const result = await client.post(endpoint, body); + const text = formatResult(result); + return { content: [{ type: "text", text }] }; + } catch (err: unknown) { + const message = err instanceof Error ? err.message : String(err); + return { content: [{ type: "text", text: `API 오류: ${message}` }], isError: true }; + } +}); + +function formatResult(result: unknown): string { + if (typeof result !== "object" || result === null) { + return String(result); + } + const obj = result as Record; + const lines: string[] = []; + + // Result 코드 해석 + if ("Result" in obj || "result" in obj) { + const code = (obj.Result ?? obj.result) as number; + const msg = (obj.Message ?? obj.message) as string | undefined; + if (code < 0) { + lines.push(`❌ 실패 (Result: ${code})`); + lines.push(` 오류: ${msg ?? getErrorMessage(code)}`); + } else { + lines.push(`✅ 성공 (Result: ${code})`); + if (msg) lines.push(` 메시지: ${msg}`); + } + } + + // 나머지 데이터 + const skip = new Set(["Result", "result", "Message", "message"]); + const rest = Object.fromEntries(Object.entries(obj).filter(([k]) => !skip.has(k))); + if (Object.keys(rest).length > 0) { + lines.push("\n데이터:"); + lines.push(JSON.stringify(rest, null, 2)); + } + + return lines.join("\n") || JSON.stringify(result, null, 2); +} + +// ───────────────────────────────────────────── +// 서버 시작 +// ───────────────────────────────────────────── +async function main() { + const transport = new StdioServerTransport(); + await server.connect(transport); + // stderr에만 출력 (stdout은 MCP 프로토콜 전용) + process.stderr.write("센드빌 MCP 서버 시작됨\n"); +} + +main().catch((err) => { + process.stderr.write(`치명적 오류: ${err}\n`); + process.exit(1); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..12bf830 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "node", + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +}