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

> ## Agent Instructions
> These docs target Mesh SDK v0.27.0. Match the installed package and binding before generating code. Start at /getting-started/agents for task-specific reading paths.
> Call the company and product Offline Protocol, never Offline alone. Current packages: @offline-protocol/mesh-sdk 0.27.0 (React Native), @offline-protocol/id-react 0.2.0, @offline-protocol/id-react-native 0.3.3, @offline-protocol/pol 0.1.2 and @offline-protocol/cli 0.2.6. Canonical docs URLs start with https://www.offlineprotocol.com/docs.
> The Mesh SDK runs in a native app or gateway. A browser OfflineID SDK integration does not provide browser mesh transport. Local mesh operation does not require a portal API key.
> Service RPC is signed plaintext in v0.27.0. Message delivery, durable local acceptance and backend commit are distinct outcomes. Use the workflow guide for the required application logic.
> Offline Protocol CLI 0.2.6 is on npm (@offline-protocol/cli, command offline). Its local MCP server runs with offline mcp serve and requires no login or key. Hosted MCP is at https://mcp.offlineprotocol.com/mcp with an application API key in Authorization: Bearer and a matching x-app-id; organization keys are rejected. Follow /tools/overview for setup and do not invent commands beyond it. MCP provides integration context and planning, not mesh execution; file-writing tools are local only.
> Phone Wi-Fi Direct and MultipeerConnectivity carry no data in v0.27.0. Use BLE or a provisioned relay. The receiver core ACKs before application persistence; use application acceptance for durable workflows.
> Proof of Location is Sepolia testnet witness evidence, not zero-knowledge proof or proof of presence. The geohash is public onchain. Read /proof-of-location/security before integration.

# MeshServices methods

> MeshServices methods in Mesh SDK v0.27.0: register and discover services on nearby devices, submit requests and return responses.

Import `MeshServices` from `@offline-protocol/mesh-sdk`. These signatures match **v0.27.0**. Read [the integration guide](/docs/guides/nearby-service) for prerequisites and complete usage.

Service requests and responses are **signed plaintext**, not MLS-encrypted. Keep their metadata and bodies non-sensitive. Your application authorizes callers and correlates responses.

## Methods on this page

* [`registerService`](#registerservice)
* [`unregisterService`](#unregisterservice)
* [`discoverServices`](#discoverservices)
* [`sendServiceRequest`](#sendservicerequest)
* [`respondToServiceRequest`](#respondtoservicerequest)

## registerService

Registers a local service that this node offers for discovery by other peers.

```typescript theme={null}
registerService(serviceId: string, version: string, capabilities: Record<string, string> = {}): Promise<void>
```

## unregisterService

Unregisters a local service.

**returns:** true if the service was found and removed

```typescript theme={null}
unregisterService(serviceId: string): Promise<boolean>
```

## discoverServices

Broadcasts a service discovery query to the mesh.
Responses arrive asynchronously as `service_discovered` events.

**returns:** Query ID for correlating responses

```typescript theme={null}
discoverServices(serviceId?: string): Promise<string>
```

## sendServiceRequest

Sends a service request to a specific provider peer.
The response arrives as a `service_response_received` event.

**returns:** Request ID for correlating the response

```typescript theme={null}
sendServiceRequest(provider: string, serviceId: string, method: string, body: string): Promise<string>
```

## respondToServiceRequest

Responds to a service request from another peer.
Call this after receiving a `service_request_received` event.

**returns:** Message ID of the response

```typescript theme={null}
respondToServiceRequest(requestId: string, requester: string, serviceId: string, status: string, body: string): Promise<string>
```

## Related references

* [`service_discovered`](/docs/mesh-sdk/events#service_discovered)
* [`service_request_received`](/docs/mesh-sdk/events#service_request_received)
* [`service_response_received`](/docs/mesh-sdk/events#service_response_received)
* [Event payloads](/docs/mesh-sdk/events)
* [Configuration types](/docs/mesh-sdk/configuration-types)
* [All public types](/docs/mesh-sdk/public-types)
* [Error codes](/docs/mesh-sdk/errors)
* [All API tasks](/docs/mesh-sdk/reference)
