MC

mark1russell7/client

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

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

GitHub에서 전체 README 보기

설치

npx -y @procedures/mcp-dev-tools
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

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