@cyanheads/pubmed-mcp-server 1.3.2 → 1.3.3
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/config/index.js +46 -13
- package/package.json +1 -1
package/dist/config/index.js
CHANGED
|
@@ -137,30 +137,63 @@ const ensureDirectory = (dirPath, rootDir, dirName) => {
|
|
|
137
137
|
const resolvedDirPath = path.isAbsolute(dirPath)
|
|
138
138
|
? dirPath
|
|
139
139
|
: path.resolve(rootDir, dirPath);
|
|
140
|
-
if (!resolvedDirPath.startsWith(rootDir)
|
|
140
|
+
if (!resolvedDirPath.startsWith(rootDir + path.sep) &&
|
|
141
|
+
resolvedDirPath !== rootDir) {
|
|
141
142
|
if (process.stdout.isTTY) {
|
|
142
|
-
console.error(`Error: ${dirName} path "${dirPath}" is outside the project boundary "${rootDir}".`);
|
|
143
|
+
console.error(`Error: ${dirName} path "${dirPath}" resolves to "${resolvedDirPath}", which is outside the project boundary "${rootDir}".`);
|
|
143
144
|
}
|
|
144
145
|
return null;
|
|
145
146
|
}
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
if (!existsSync(resolvedDirPath)) {
|
|
148
|
+
try {
|
|
148
149
|
mkdirSync(resolvedDirPath, { recursive: true });
|
|
150
|
+
if (process.stdout.isTTY) {
|
|
151
|
+
console.log(`Created ${dirName} directory: ${resolvedDirPath}`);
|
|
152
|
+
}
|
|
149
153
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
catch (err) {
|
|
155
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
156
|
+
if (process.stdout.isTTY) {
|
|
157
|
+
console.error(`Error creating ${dirName} directory at ${resolvedDirPath}: ${errorMessage}`);
|
|
154
158
|
}
|
|
159
|
+
return null;
|
|
155
160
|
}
|
|
156
|
-
return resolvedDirPath;
|
|
157
161
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
else {
|
|
163
|
+
try {
|
|
164
|
+
const stats = statSync(resolvedDirPath);
|
|
165
|
+
if (!stats.isDirectory()) {
|
|
166
|
+
if (process.stdout.isTTY) {
|
|
167
|
+
console.error(`Error: ${dirName} path ${resolvedDirPath} exists but is not a directory.`);
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch (statError) {
|
|
173
|
+
const errorMessage = statError instanceof Error
|
|
174
|
+
? statError.message
|
|
175
|
+
: "An unknown error occurred";
|
|
176
|
+
if (process.stdout.isTTY) {
|
|
177
|
+
console.error(`Error accessing ${dirName} path ${resolvedDirPath}: ${errorMessage}`);
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
161
181
|
}
|
|
182
|
+
return resolvedDirPath;
|
|
162
183
|
};
|
|
163
|
-
|
|
184
|
+
let validatedLogsPath = ensureDirectory(env.LOGS_DIR, projectRoot, "logs");
|
|
185
|
+
if (!validatedLogsPath) {
|
|
186
|
+
if (process.stdout.isTTY) {
|
|
187
|
+
console.warn(`Warning: Custom logs directory ('${env.LOGS_DIR}') is invalid or outside the project boundary. Falling back to default.`);
|
|
188
|
+
}
|
|
189
|
+
const defaultLogsDir = path.join(projectRoot, "logs");
|
|
190
|
+
validatedLogsPath = ensureDirectory(defaultLogsDir, projectRoot, "logs");
|
|
191
|
+
if (!validatedLogsPath) {
|
|
192
|
+
if (process.stdout.isTTY) {
|
|
193
|
+
console.warn("Warning: Default logs directory could not be created. File logging will be disabled.");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
164
197
|
export const config = {
|
|
165
198
|
pkg,
|
|
166
199
|
mcpServerName: env.MCP_SERVER_NAME || pkg.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyanheads/pubmed-mcp-server",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "A Model Context Protocol (MCP) server enabling AI agents to intelligently search, retrieve, and analyze biomedical literature from PubMed via NCBI E-utilities. Built on the mcp-ts-template for robust, production-ready performance.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|