@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)
32 lines (30 loc) • 1.51 kB
JavaScript
import { z } from 'zod';
import { asMcpError, McpError, defineToolAnnotations } from './utils/toolHelpers.js';
export const method = 'getApiDiscoveryInstructions';
export const title = 'Get API discovery instructions';
export const description = `Returns instructions (markdown) for finding APIs in Postman — searching the public network, browsing private/internal/team collections, filtering by ownership and visibility, and comparing candidate APIs. Includes the rules for presenting results with Postman links and the patterns for evaluating tradeoffs between APIs.
Call this when the user wants to find, search for, or compare APIs (e.g., "find me an email API", "search for the Payvance API", "compare Payvance and Cashloom"). Prerequisite: call getPostmanContextOverview first if you have not already loaded the Postman Context overview in this session.`;
export const parameters = z.object({});
export const annotations = defineToolAnnotations({
title: 'Get API discovery instructions',
readOnlyHint: true,
destructiveHint: false,
idempotentHint: true,
openWorldHint: false,
});
export async function handler(_args, extra) {
try {
const result = await extra.client.get('/context/instructions/discovery', {
headers: extra.headers,
});
return {
content: [{ type: 'text', text: result }],
};
}
catch (e) {
if (e instanceof McpError) {
throw e;
}
throw asMcpError(e);
}
}