> ## Documentation Index
> Fetch the complete documentation index at: https://docs.moltzap.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# client/endpoint/harness-endpoint

> Scoped MCP implementation of the public semantic HarnessEndpoint.

# client/endpoint/harness-endpoint

*`packages/client/src/endpoint/harness-endpoint`*

## Purpose

Scoped MCP implementation of the public semantic HarnessEndpoint.

## Public surface

### [`acquireHarnessEndpoint`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/endpoint/harness-endpoint/index.ts#L59)

*Function*

```ts theme={null}
export function acquireHarnessEndpoint(
  endpoint: URL,
): Effect.Effect<HarnessEndpoint, ConnectError, Scope.Scope>
```

Acquire one real MCP-backed endpoint and its scoped connection.

**Returns:** An endpoint whose resources remain live for the caller's scope.

### [`ConnectError`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/endpoint/harness-endpoint/capability.ts#L27)

*Class*

```ts theme={null}
export class ConnectError extends Data.TaggedError("ConnectError")<{
  readonly reason: ConnectFailure;
}> {
  override get message(): string {
    return `connect failed: ${this.reason}`;
  }
}
```

Acquiring the endpoint connection failed.

### [`HarnessEndpoint`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/endpoint/harness-endpoint/capability.ts#L54)

*Interface*

```ts theme={null}
export interface HarnessEndpoint {
  readonly send: (
    input: SendInput,
    options?: Readonly<{
      failureDelivery?: FailureDelivery;
    }>,
  ) => Effect.Effect<
    SendResult,
    SendError | CollectiveError | FirewallSendError
  >;
  readonly messages: Stream.Stream<InboundDelivery, ListenError>;
}
```

Structural runtime capability owned by one scoped endpoint connection.
Every send is one operation or one collective response; the stream yields
inbound items.

A host whose tool returns before the send completes passes
`failureDelivery: "inbound"`: a refused gather, all\_gather or response
then completes and its error arrives as an `operationFailed` item on the
stream. A multicast has no operation id, so its failure is always returned.
A firewall refusal always returns on the send call before creating an intent,
including when inbound failure delivery was requested.

### [`InboundDelivery`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/endpoint/harness-endpoint/capability.ts#L36)

*Interface*

```ts theme={null}
export interface InboundDelivery {
  readonly item: InboundItem;
  readonly guidance?: LocalGuidance;
  readonly acknowledge: Effect.Effect<void, DeliveryAcknowledgeError>;
}
```

One inbound item plus its transport-only acknowledgment.

## Files

* `capability.ts`
* `index.ts`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.