get_node_version
Returns the Node.js version of the environment running the MCP server. Use it to verify the runtime version.
Instructions
Returns the Node.js version information of the environment running the MCP server.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/node-version.ts:19-34 (handler)The handler function 'registerNodeVersionTool' registers the 'get_node_version' tool on the MCP server. It defines the tool name, description, and async handler that returns Node.js version info as JSON.
export function registerNodeVersionTool(server: McpServer): void { server.tool( "get_node_version", "Returns the Node.js version information of the environment running the MCP server.", async () => { // Error handling simplified, process.version/versions are generally safe const versionInfo = getNodeVersionInfo(); return { content: [{ type: "text", text: JSON.stringify(versionInfo, null, 2) // Keep JSON for structured data }] }; } ); } - src/mcp/node-version.ts:3-6 (schema)Interface INodeVersionInfo defines the return type: nodeVersion (string) and details (NodeJS.ProcessVersions).
interface INodeVersionInfo { nodeVersion: string; details: NodeJS.ProcessVersions; } - src/mcp/node-version.ts:12-17 (helper)The 'getNodeVersionInfo' helper function retrieves process.version and process.versions to build version information.
export function getNodeVersionInfo(): INodeVersionInfo { // Export for testing return { nodeVersion: process.version, details: process.versions, }; } - src/index.ts:7-7 (registration)Import statement for registerNodeVersionTool from the node-version module.
import { registerNodeVersionTool } from "./mcp/node-version.js"; - src/index.ts:22-22 (registration)The tool is registered by calling registerNodeVersionTool(server) in the main entry point.
registerNodeVersionTool(server);