ShapeMCP/Docs/Ts To Mcp
TypeScript → MCP

TypeScript → MCP

01

TypeScript → MCP

The core engine of ShapeMCP. It uses the TypeScript Compiler API to perform deep static analysis on your source files. It treats exported functions as the boundary for tool definitions: each exported function becomes a candidate MCP tool with parameters derived from its signature.

How it works

The parser loads your TypeScript (or JavaScript) input, resolves symbols, and extracts function names, parameter names, types, and JSDoc descriptions. Optional parameters are reflected in JSON Schema; required parameters are listed in the required array. Union types and enums are mapped to schema enum or oneOf where appropriate.

Usage

Paste your TS/JS in the tool input or point the API at a file URL. The output is a JSON array of MCP tool definitions ready to plug into mcpServers or your agent runtime. Use the MCP Inspector to test the resulting server locally.