drupal-mcp-connector 2.5.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/README.md +3 -0
- package/bin/drupal-mcp-verify.js +147 -0
- package/config/config.example.json +31 -29
- package/package.json +7 -4
- package/src/index.js +17 -0
- package/src/lib/config.js +19 -1
- package/src/lib/load-secrets.js +158 -0
- package/src/lib/security.js +27 -4
- package/src/lib/verify.js +916 -0
- package/src/tools/site.js +32 -1
package/src/tools/site.js
CHANGED
|
@@ -58,9 +58,38 @@ async function listConfiguredSites() {
|
|
|
58
58
|
* @param {object} args - { site? } (a named site narrows the report).
|
|
59
59
|
* @returns {Promise<{sites: object[]}>} required/ok/reason per site.
|
|
60
60
|
*/
|
|
61
|
+
/**
|
|
62
|
+
* Classify a getSiteConfig failure so the diagnostic reason matches the cause.
|
|
63
|
+
* @param {string} message
|
|
64
|
+
* @returns {string}
|
|
65
|
+
*/
|
|
66
|
+
export function classifySiteResolutionFailure(message) {
|
|
67
|
+
if (message.includes("Unknown site:")) return "unknown_site";
|
|
68
|
+
if (message.includes("baseUrl is not HTTPS")) return "insecure_base_url";
|
|
69
|
+
if (message.includes("is not set in the environment")) return "credential_unresolved";
|
|
70
|
+
return "site_unresolved";
|
|
71
|
+
}
|
|
72
|
+
|
|
61
73
|
async function getGovernanceStatus({ site: siteName } = {}) {
|
|
62
74
|
const names = siteName ? [siteName] : listSiteNames();
|
|
63
|
-
|
|
75
|
+
const resolved = [];
|
|
76
|
+
const unresolved = [];
|
|
77
|
+
for (const name of names) {
|
|
78
|
+
try {
|
|
79
|
+
resolved.push(getSiteConfig(name));
|
|
80
|
+
} catch (error) {
|
|
81
|
+
const detail = error instanceof Error ? error.message : "site could not be resolved";
|
|
82
|
+
unresolved.push({
|
|
83
|
+
site: name,
|
|
84
|
+
required: null,
|
|
85
|
+
ok: false,
|
|
86
|
+
reason: classifySiteResolutionFailure(detail),
|
|
87
|
+
detail,
|
|
88
|
+
checkedAt: null,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return { sites: [...unresolved, ...(await governanceStatus(resolved))] };
|
|
64
93
|
}
|
|
65
94
|
|
|
66
95
|
// ---------------------------------------------------------------------------
|
|
@@ -102,6 +131,8 @@ export const definitions = [
|
|
|
102
131
|
},
|
|
103
132
|
];
|
|
104
133
|
|
|
134
|
+
export { getGovernanceStatus };
|
|
135
|
+
|
|
105
136
|
export const handlers = {
|
|
106
137
|
drupal_site_info: getSiteInfo,
|
|
107
138
|
drupal_list_content_types: listContentTypes,
|