@macroforge/mcp-server
Version:
MCP server for Macroforge documentation and code analysis
53 lines (52 loc) • 1.91 kB
TypeScript
/**
* @module tools
*
* MCP Tool Registry and Request Handlers
*
* This module registers and implements all MCP tools exposed by the Macroforge server.
* It serves as the main business logic layer, handling tool requests from MCP clients.
*
* ## Registered Tools
*
* | Tool | Purpose |
* |------|---------|
* | `list-sections` | List all documentation sections with metadata |
* | `get-documentation` | Retrieve full content for specific sections |
* | `macroforge-autofixer` | Validate TypeScript code with @derive decorators |
* | `expand-code` | Expand macros and show generated code |
* | `get-macro-info` | Get documentation for macros and decorators |
*
* ## Architecture
*
* The module uses:
* - `docs-loader.js` for documentation loading and search
* - `macroforge` (optional) for native code validation and expansion
*
* Native bindings are loaded dynamically and gracefully degrade if unavailable.
*
* @see {@link registerTools} for the main entry point
*/
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
/**
* Registers all Macroforge MCP tools with the server instance.
*
* This function:
* 1. Loads documentation sections from disk
* 2. Registers a `tools/list` handler returning all available tools
* 3. Registers a `tools/call` handler routing requests to appropriate handlers
*
* The tools registered provide documentation access and code analysis capabilities
* for AI assistants working with Macroforge.
*
* @param server - The MCP Server instance to register tools with
*
* @example
* ```typescript
* import { Server } from '@modelcontextprotocol/sdk/server/index.js';
* import { registerTools } from './tools/index.ts';
*
* const server = new Server({ name: 'macroforge', version: '1.0.0' }, { capabilities: { tools: {} } });
* registerTools(server);
* ```
*/
export declare function registerTools(server: Server): void;