Skip to main content
Glama

MongoDB MCP Server

Official
by mongodb-js
enforce-zod-v4.js1.79 kB
"use strict"; import path from "path"; // The file that is allowed to import from zod/v4 const configFilePath = path.resolve(import.meta.dirname, "../src/common/config.ts"); const schemasFilePath = path.resolve(import.meta.dirname, "../src/common/schemas.ts"); // Ref: https://eslint.org/docs/latest/extend/custom-rules export default { meta: { type: "problem", docs: { description: "Only allow importing 'zod/v4' in config.ts, all other imports are allowed elsewhere. We should only adopt zod v4 for tools and resources once https://github.com/modelcontextprotocol/typescript-sdk/issues/555 is resolved.", recommended: true, }, fixable: null, messages: { enforceZodV4: "Only 'zod/v4' imports are allowed in config.ts. Found import from '{{importPath}}'. Use 'zod/v4' instead.", }, }, create(context) { const currentFilePath = path.resolve(context.getFilename()); // Only allow zod v4 import in config.ts if (currentFilePath === configFilePath) { return {}; } return { ImportDeclaration(node) { const importPath = node.source.value; // Check if this is a zod import if (typeof importPath !== "string") { return; } const isZodV4Import = importPath === "zod/v4"; if (isZodV4Import) { context.report({ node, messageId: "enforceZodV4", data: { importPath, }, }); } }, }; }, };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mongodb-js/mongodb-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server