MC

mark1russell7/client

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

0 stars 0 forks Качество 77 Тренд 20MIT

Procedures as data for TypeScript: one typed call model for in-process, HTTP, WebSocket, CLI and MCP (Claude) — with streaming, middleware and a visual composer.

Обзор

You define a procedure one time: a path, a Zod input, a Zod output and a handler. Then you use it in the same process, over HTTP or WebSocket, from the mark CLI, or from Claude as an MCP tool. A program is plain JSON: calls, references to earlier results, and control flow. The client gives streams, middleware, retries and a cache. has the Composer (build a program from blocks, then start it in your browser), the middleware lab, the procedure catalog and the status board. The packages need Node.js 22 or later. They are ES modules. Replace LocalTransport with HttpTransport or WebSocketTransport to use the same procedures on a server. PROGRAM-FORMAT.md tells the rules of programs. tRPC is the better choice for type inference from server to client in one application. This repository is for procedures that many hosts use: a program, a CLI, a server and Claude. All packages are in packages/. The public packages are in the npm scope @procedures, with one version together.

README

Показан фрагмент оригинального README. Открыть оригинал.

client

Procedures as data for TypeScript. You define a procedure one time: a path, a Zod input, a Zod output and a handler. Then you use it in the same process, over HTTP or WebSocket, from the mark CLI, or from Claude as an MCP tool. A program is plain JSON: calls, references to earlier results, and control flow. The client gives streams, middleware, retries and a cache.

The site has the Composer (build a program from blocks, then start it in your browser), the middleware lab, the procedure catalog and the status board.

Install

npm install @procedures/client zod

The packages need Node.js 22 or later. They are ES modules.

Example

import { z } from "zod";
import { Client, LocalTransport, PROCEDURE_REGISTRY, allCoreProcedures, createProcedure, zodAdapter } from "@procedures/client";
import "@procedures/client/register"; // the control flow: client.chain and the others

// A procedure: a path, a typed input and output, and a handler
PROCEDURE_REGISTRY.register(
  createProcedure()
    .path(["greet"])
    .input(zodAdapter(z.object({ name: z.string() })))
    .output(zodAdapter(z.string()))
    .handler(async ({ name }) => `Hello, ${name}!`)
    .build(),
);
for (const p of allCoreProcedures) if (!PROCEDURE_REGISTRY.has(p.path)) PROCEDURE_REGISTRY.register(p);

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
console.log(await client.exec({ $proc: ["greet"], input: { name: "Ada" } }));
// Hello, Ada!

// A program is JSON: the second step reads the result of the first step
const result = await client.exec({
  $proc: ["client", "chain"],
  input: {
    steps: [
      { $proc: ["client", "add"], input: { a: 2, b: 3 } },
      { $proc: ["client", "multiply"], input: { a: { $ref: "$last" }, b: 4 } },
    ],
  },
});
console.log(result.final);
// 20

Replace LocalTransport with HttpTransport or WebSocketTransport to use the same procedures on a server. PROGRAM-FORMAT.md tells the rules of programs.

Compared with other tools

Открыть полный README на GitHub

Установка

npx -y @procedures/mcp-dev-tools
Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "dev-tools": { "command": "npx", "args": ["-y", "@procedures/mcp-dev-tools"] } } }