edition-mcp-server 0.3.0 → 0.3.2
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 +103 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -172,7 +172,7 @@ async function apiPost(path, body) {
|
|
|
172
172
|
// ── MCP Server ──────────────────────────────────────
|
|
173
173
|
const server = new mcp_js_1.McpServer({
|
|
174
174
|
name: "edition",
|
|
175
|
-
version: "0.3.
|
|
175
|
+
version: "0.3.2",
|
|
176
176
|
}, {
|
|
177
177
|
instructions: PROGRESSIVE
|
|
178
178
|
? "EDITION is a Japan Knowledge Gateway for AI agents. Use japan_discover to explore 14 knowledge domains, japan_search for cross-domain queries, and japan_execute for specific domain operations. This server uses Progressive Discovery — only load domain details when needed."
|
|
@@ -321,7 +321,7 @@ else {
|
|
|
321
321
|
return { content: [{ type: "text", text }] };
|
|
322
322
|
});
|
|
323
323
|
// ── Tool: memory_context ────────────────────────────
|
|
324
|
-
server.tool("memory_context", "
|
|
324
|
+
server.tool("memory_context", "現在のセッション状態(有効な事実・合意事項のサマリー)を取得します。エージェントのプロンプトに注入して文脈を維持するために使います。新しい会話セッション開始時や、長い会話の途中で文脈を再確認したい場合に呼び出してください。個別のファクトを一覧で見たい場合はmemory_factsを使ってください。", {
|
|
325
325
|
session_id: zod_1.z.string().optional().describe("セッションID(省略で全体)"),
|
|
326
326
|
}, { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, async ({ session_id }) => {
|
|
327
327
|
const params = session_id ? `?session_id=${encodeURIComponent(session_id)}` : "";
|
|
@@ -404,7 +404,7 @@ else {
|
|
|
404
404
|
return { content: [{ type: "text", text }] };
|
|
405
405
|
});
|
|
406
406
|
// ── Tool: regulation_industries ──────────────────────
|
|
407
|
-
server.tool("regulation_industries", "
|
|
407
|
+
server.tool("regulation_industries", "日本の規制データベースに登録されている業種の一覧を取得します。対応業種を確認したい場合や、regulation_checkに渡すindustryパラメータの値を調べたい場合に使ってください。特定の規制内容を知りたい場合はregulation_checkを使ってください。", {}, { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, async () => {
|
|
408
408
|
const result = await apiGet("/api/v1/regulation/industries");
|
|
409
409
|
let text = `🗾 対応業種一覧 (${result.count}業種):\n\n`;
|
|
410
410
|
for (const ind of result.industries) {
|
|
@@ -416,7 +416,7 @@ else {
|
|
|
416
416
|
return { content: [{ type: "text", text }] };
|
|
417
417
|
});
|
|
418
418
|
// ── Tool: regulation_tourist ────────────────────────
|
|
419
|
-
server.tool("regulation_tourist", "訪日旅行者向けの規制・マナー情報のカテゴリ一覧を取得します。ビザ、免税、交通、宿泊、医療、マナーの6
|
|
419
|
+
server.tool("regulation_tourist", "訪日旅行者向けの規制・マナー情報のカテゴリ一覧を取得します。ビザ、免税、交通、宿泊、医療、マナーの6カテゴリ。どのカテゴリがあるか一覧で確認したい場合に使ってください。特定のカテゴリの詳細を知りたい場合はregulation_check(entity_type='tourist')を使ってください。", {}, { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, async () => {
|
|
420
420
|
const result = await apiGet("/api/v1/regulation/tourist");
|
|
421
421
|
let text = `🗾 訪日旅行者向け規制カテゴリ (${result.count}件):\n\n`;
|
|
422
422
|
for (const cat of result.categories) {
|
|
@@ -688,7 +688,7 @@ else {
|
|
|
688
688
|
return { content: [{ type: "text", text }] };
|
|
689
689
|
});
|
|
690
690
|
// ── Tool: search ────────────────────────────────────
|
|
691
|
-
server.tool("search", "EDITION全14ドメインを横断検索します。1
|
|
691
|
+
server.tool("search", "EDITION全14ドメインを横断検索します。1回のリクエストで規制・プロトコル・カレンダー・地域・組織・進出手続き・旅行・エンタメ・日常生活・日本語・食文化・災害安全・メモリの全14ドメインを同時検索します。日本に関する幅広い質問で、どのドメインに該当するかわからない場合にまずこのツールを使ってください。特定ドメインの詳細が必要な場合は、各ドメイン専用の_checkまたは_searchツールを使ってください。", {
|
|
692
692
|
query: zod_1.z.string().describe("検索クエリ(例: '大阪で飲食店を開業', '地震の避難方法', '敬語の使い方')"),
|
|
693
693
|
}, { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, async ({ query }) => {
|
|
694
694
|
const result = await apiPost("/api/v1/search", { query });
|
|
@@ -764,6 +764,104 @@ else {
|
|
|
764
764
|
}
|
|
765
765
|
});
|
|
766
766
|
} // end of legacy mode else block
|
|
767
|
+
const auditLog = [];
|
|
768
|
+
let auditCounter = 0;
|
|
769
|
+
function recordAudit(entry) {
|
|
770
|
+
const record = {
|
|
771
|
+
id: `AUDIT-${++auditCounter}-${Date.now()}`,
|
|
772
|
+
timestamp: new Date().toISOString(),
|
|
773
|
+
...entry,
|
|
774
|
+
};
|
|
775
|
+
auditLog.push(record);
|
|
776
|
+
return record;
|
|
777
|
+
}
|
|
778
|
+
// Tool: compliance_log — Record a compliance check with audit trail
|
|
779
|
+
server.tool("compliance_log", "Record a Japan regulatory/compliance check with full audit trail. Use this AFTER performing a regulation_check, foreign_entry_check, or any compliance-sensitive query. Creates an immutable, timestamped record for governance reporting. Agents operating under compliance requirements should call this after every regulatory lookup.", {
|
|
780
|
+
domain: zod_1.z.string().describe("Knowledge domain checked (e.g. 'regulation', 'foreign_entry', 'protocol')"),
|
|
781
|
+
action: zod_1.z.string().describe("Action that was checked (e.g. 'open restaurant in Tokyo', 'apply for management visa')"),
|
|
782
|
+
query: zod_1.z.string().describe("The original query/action that triggered the compliance check"),
|
|
783
|
+
result_summary: zod_1.z.string().describe("Summary of the compliance check result"),
|
|
784
|
+
confidence: zod_1.z.number().min(0).max(1).describe("Confidence score of the check (0-1)"),
|
|
785
|
+
compliant: zod_1.z.boolean().describe("Whether the action was found to be compliant"),
|
|
786
|
+
context: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("Additional context (industry, entity_type, jurisdiction, etc.)"),
|
|
787
|
+
}, { readOnlyHint: false, destructiveHint: false, idempotentHint: false }, async ({ domain, action, query, result_summary, confidence, compliant, context }) => {
|
|
788
|
+
const record = recordAudit({
|
|
789
|
+
domain,
|
|
790
|
+
action,
|
|
791
|
+
query,
|
|
792
|
+
result_summary,
|
|
793
|
+
confidence,
|
|
794
|
+
compliant,
|
|
795
|
+
metadata: {
|
|
796
|
+
...context,
|
|
797
|
+
server_version: "0.3.1",
|
|
798
|
+
mode: PROGRESSIVE ? "progressive" : "legacy",
|
|
799
|
+
},
|
|
800
|
+
});
|
|
801
|
+
let text = `📋 Compliance Audit Record Created\n`;
|
|
802
|
+
text += `━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`;
|
|
803
|
+
text += ` ID: ${record.id}\n`;
|
|
804
|
+
text += ` Timestamp: ${record.timestamp}\n`;
|
|
805
|
+
text += ` Domain: ${record.domain}\n`;
|
|
806
|
+
text += ` Action: ${record.action}\n`;
|
|
807
|
+
text += ` Status: ${record.compliant ? "✅ COMPLIANT" : "⚠️ NON-COMPLIANT / REQUIRES REVIEW"}\n`;
|
|
808
|
+
text += ` Confidence: ${(record.confidence * 100).toFixed(0)}%\n`;
|
|
809
|
+
text += ` Summary: ${record.result_summary}\n`;
|
|
810
|
+
text += `━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`;
|
|
811
|
+
text += `\nTotal audit records this session: ${auditLog.length}`;
|
|
812
|
+
return { content: [{ type: "text", text }] };
|
|
813
|
+
});
|
|
814
|
+
// Tool: compliance_report — Generate governance report from audit trail
|
|
815
|
+
server.tool("compliance_report", "Generate a structured compliance/governance report from accumulated audit records. Returns all logged compliance checks with statistics. Use for periodic compliance reviews, audit preparation, or governance dashboards. Supports filtering by domain, date range, or compliance status.", {
|
|
816
|
+
domain: zod_1.z.string().optional().describe("Filter by domain (e.g. 'regulation'). Omit for all domains."),
|
|
817
|
+
compliant_only: zod_1.z.boolean().optional().describe("If true, show only compliant records. If false, show only non-compliant. Omit for all."),
|
|
818
|
+
format: zod_1.z.enum(["summary", "detailed", "json"]).default("summary").describe("Report format: summary (overview + stats), detailed (all records), json (machine-readable)"),
|
|
819
|
+
}, { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, async ({ domain, compliant_only, format }) => {
|
|
820
|
+
let records = [...auditLog];
|
|
821
|
+
if (domain)
|
|
822
|
+
records = records.filter(r => r.domain === domain);
|
|
823
|
+
if (compliant_only !== undefined)
|
|
824
|
+
records = records.filter(r => r.compliant === compliant_only);
|
|
825
|
+
if (records.length === 0) {
|
|
826
|
+
return { content: [{ type: "text", text: "📊 No compliance records found for the specified criteria.\n\n💡 Use compliance_log after regulatory checks to build your audit trail." }] };
|
|
827
|
+
}
|
|
828
|
+
if (format === "json") {
|
|
829
|
+
return { content: [{ type: "text", text: JSON.stringify({ total: records.length, records }, null, 2) }] };
|
|
830
|
+
}
|
|
831
|
+
// Statistics
|
|
832
|
+
const total = records.length;
|
|
833
|
+
const compliant = records.filter(r => r.compliant).length;
|
|
834
|
+
const nonCompliant = total - compliant;
|
|
835
|
+
const avgConfidence = records.reduce((sum, r) => sum + r.confidence, 0) / total;
|
|
836
|
+
const domains = [...new Set(records.map(r => r.domain))];
|
|
837
|
+
const timeRange = records.length > 0
|
|
838
|
+
? `${records[0].timestamp} → ${records[records.length - 1].timestamp}`
|
|
839
|
+
: "N/A";
|
|
840
|
+
let text = `\n📊 EDITION Compliance Governance Report\n`;
|
|
841
|
+
text += `══════════════════════════════════════\n\n`;
|
|
842
|
+
text += `📅 Period: ${timeRange}\n`;
|
|
843
|
+
text += `📈 Total Checks: ${total}\n`;
|
|
844
|
+
text += ` ✅ Compliant: ${compliant} (${((compliant / total) * 100).toFixed(1)}%)\n`;
|
|
845
|
+
text += ` ⚠️ Review Needed: ${nonCompliant} (${((nonCompliant / total) * 100).toFixed(1)}%)\n`;
|
|
846
|
+
text += ` 📊 Average Confidence: ${(avgConfidence * 100).toFixed(1)}%\n`;
|
|
847
|
+
text += ` 🗂️ Domains Covered: ${domains.join(", ")}\n`;
|
|
848
|
+
text += `\n══════════════════════════════════════\n`;
|
|
849
|
+
if (format === "detailed") {
|
|
850
|
+
text += `\n📋 Detailed Records:\n\n`;
|
|
851
|
+
for (const r of records) {
|
|
852
|
+
text += ` ─── ${r.id} ───\n`;
|
|
853
|
+
text += ` Time: ${r.timestamp}\n`;
|
|
854
|
+
text += ` Domain: ${r.domain} | Action: ${r.action}\n`;
|
|
855
|
+
text += ` Query: ${r.query}\n`;
|
|
856
|
+
text += ` Result: ${r.result_summary}\n`;
|
|
857
|
+
text += ` Status: ${r.compliant ? "✅ COMPLIANT" : "⚠️ REVIEW"} | Confidence: ${(r.confidence * 100).toFixed(0)}%\n\n`;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
text += `\n⚠️ Disclaimer: This report is generated from EDITION audit records. `;
|
|
861
|
+
text += `It serves as a structured reference for governance reviews but does not constitute legal certification.`;
|
|
862
|
+
text += `\n📌 Data source: EDITION Intelligence Platform (api.edition.sh) — Verified Japan regulatory knowledge.`;
|
|
863
|
+
return { content: [{ type: "text", text }] };
|
|
864
|
+
});
|
|
767
865
|
// ── Start ───────────────────────────────────────────
|
|
768
866
|
async function main() {
|
|
769
867
|
const transport = new stdio_js_1.StdioServerTransport();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edition-mcp-server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"mcpName": "io.github.hiroshic9-png/japan-business-operations",
|
|
5
5
|
"description": "EDITION — Japan Knowledge Gateway for AI agents. 14 knowledge domains, 6 Skills Packs, 31 MCP tools, Progressive Discovery support. Verified ground truth: regulations, procedures, protocols, calendar, regional, organization, foreign entry, travel, entertainment, daily life, language, food culture, disaster safety, and persistent memory.",
|
|
6
6
|
"main": "dist/index.js",
|