UNPKG

@postman/postman-mcp-server

Version:

Postman MCP Server — connect AI agents (Claude Code, Cursor, VS Code Copilot, Gemini CLI) to your Postman collections, specifications, and environments via Model Context Protocol (MCP)

24 lines (23 loc) • 754 B
import { existsSync } from 'node:fs'; import { join } from 'node:path'; import nunjucks from 'nunjucks'; export function createTemplateRenderer(viewsDir) { const env = nunjucks.configure(viewsDir, { autoescape: true, noCache: false, throwOnUndefined: false, }); env.addFilter('default', (val, defaultVal = '') => val === undefined || val === null ? defaultVal : val); return (toolName, rawText) => { const templatePath = join(viewsDir, `${toolName}.njk`); if (!existsSync(templatePath)) return null; try { const data = JSON.parse(rawText); return env.render(`${toolName}.njk`, data); } catch { return null; } }; }