mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
docs: document proxy and mcp helpers
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// Channel MCP bridge tests cover request bridging between MCP and channel APIs.
|
||||
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
|
||||
import { OpenClawChannelBridge } from "./channel-bridge.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Channel MCP bridge translates MCP tool calls into channel runtime operations.
|
||||
import { randomUUID } from "node:crypto";
|
||||
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Channel MCP shutdown tests cover unhandled rejection behavior during shutdown.
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const transportState = vi.hoisted(() => ({
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Channel MCP server tests cover channel tool registration and requests.
|
||||
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
||||
import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
|
||||
import { describe, expect, test, vi } from "vitest";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Channel MCP server wires channel bridge tools into an MCP server instance.
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Shared MCP channel helpers normalize channel tool payloads and responses.
|
||||
import {
|
||||
normalizeOptionalLowercaseString,
|
||||
normalizeOptionalString as toText,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Channel MCP tools expose channel operations through an MCP server.
|
||||
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { z } from "zod";
|
||||
import type { OpenClawChannelBridge } from "./channel-bridge.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OpenClaw MCP tools tests cover core tool server startup and registration.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveOpenClawToolsForMcp } from "./openclaw-tools-serve.js";
|
||||
import { createPluginToolsMcpHandlers } from "./plugin-tools-handlers.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Plugin MCP cancellation tests cover cancellation of in-flight plugin tool calls.
|
||||
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
||||
import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Plugin MCP tool handlers route plugin tool calls through the active runtime.
|
||||
import {
|
||||
isToolWrappedWithBeforeToolCallHook,
|
||||
rewrapToolWithBeforeToolCallHook,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Plugin MCP serve tests cover serving plugin tools over MCP.
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
type HookContext,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// MCP stdio server exposes OpenClaw tools over the MCP stdio transport.
|
||||
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
||||
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
||||
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture blob store persists captured request and response bodies by hash.
|
||||
import { createHash } from "node:crypto";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture CA helpers create and inspect local capture CA certificates.
|
||||
import { execFile } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture coverage tests cover capture coverage accounting and summaries.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildDebugProxyCoverageReport } from "./coverage.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture coverage helpers summarize which network calls were captured.
|
||||
import process from "node:process";
|
||||
import { resolveDebugProxySettings, type DebugProxySettings } from "./env.js";
|
||||
import type { CaptureProtocol } from "./types.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture env tests cover environment variable generation for capture sessions.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
OPENCLAW_DEBUG_PROXY_ENABLED,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture env helpers build proxy-related env vars for child processes.
|
||||
import { randomUUID } from "node:crypto";
|
||||
import type { Agent } from "node:http";
|
||||
import process from "node:process";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture path helpers resolve capture directories and database paths.
|
||||
import path from "node:path";
|
||||
import { resolveStateDir } from "../config/paths.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Managed proxy tests cover proxy server lifecycle with managed capture files.
|
||||
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||
import { createServer as createHttpServer } from "node:http";
|
||||
import { Socket, type AddressInfo } from "node:net";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture server tests cover request recording and response handling.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseConnectTarget } from "./proxy-server.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture server records proxied HTTP traffic for deterministic test fixtures.
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { createServer, type IncomingMessage, type ServerResponse } from "node:http";
|
||||
import { request as httpRequest } from "node:http";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture runtime tests cover session creation and capture lifecycle.
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import type { DebugProxySettings } from "./env.js";
|
||||
import {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture runtime coordinates capture sessions, proxy startup, and storage.
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { URL } from "node:url";
|
||||
import { normalizeRequestInitHeadersForFetch } from "../infra/fetch-headers.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture SQLite store tests cover persisted capture reads and writes.
|
||||
import { mkdtempSync, rmSync } from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Proxy capture SQLite store persists capture metadata and replayable exchanges.
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
|
||||
Reference in New Issue
Block a user