TypeMCP in-process bridge

The published @theorvane/type-chain@0.1.1 /typemcp subpath composes a TypeMCP-decorated server into native LangChain tools in the same Node.js process. TypeMCP owns declaration validation and instance resolution; LangChain owns agent construction; the application owns models, policies, dependencies, and deployment.

Prerequisites

Install

npm install @theorvane/type-chain@0.1.1 @theorvane/type-mcp@0.2.2 @langchain/core langchain zod

This is an optional integration boundary; the root TypeChain package does not import TypeMCP or LangChain peers.

Configure TypeScript

Create tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "lib": ["ES2022", "ESNext.Decorators"],
    "strict": true,
    "verbatimModuleSyntax": true
  }
}

Leave experimentalDecorators off.

Convert a TypeMCP server to LangChain tools

Create src/catalog-server.ts as a zero-argument TypeMCP-decorated server with an application-owned configuration seam. Then create src/typemcp-tools.ts:

import { createTypeMcpLangChainTools } from "@theorvane/type-chain/typemcp";
import type { CatalogClient } from "./catalog-server.js";
import { CatalogServer } from "./catalog-server.js";

// This client is constructed and authorized by application code.
declare const catalogClient: CatalogClient;

export const tools = await createTypeMcpLangChainTools(CatalogServer, {
  resolver: { resolve: () => new CatalogServer().configure(catalogClient) },
});

The released TypeMCP @McpServer contract requires a zero-argument decorated constructor. The explicit resolver configures the application-owned dependency before TypeChain delegates to TypeMCP's createLangChainTools().

Expected behavior

tools contains native LangChain tools for the decorated CatalogServer methods. Resolving and invoking a tool uses the supplied catalogClient; no stdio/HTTP listener, MCP client/session, or cross-process connection is created.

Transport boundary

The in-process bridge does not open MCP HTTP or stdio transports, implement MCP clients or sessions, supply credentials, or enforce authorization, approval, retries, timeouts, auditing, or redaction. Use TypeMCP transport hosts separately when cross-process MCP access is required.

Next steps