Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ A typical flow:

See [`simpleStreamableHttp.ts`](../examples/client/src/simpleStreamableHttp.ts) for an interactive CLI client that exercises these methods and shows how to handle notifications, elicitation and tasks.

## Notifications

Clients can subscribe to server notifications and react to changes. For example, when the server reports that its tool list changed, refresh your cached tool list:

```typescript
import { ToolListChangedNotificationSchema } from '@modelcontextprotocol/client';

client.setNotificationHandler(ToolListChangedNotificationSchema, async () => {
await client.listTools();
});
```

## Transports and backwards compatibility

To support both modern Streamable HTTP and legacy SSE servers, use a client that:
Expand Down
7 changes: 7 additions & 0 deletions docs/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ const app = createMcpExpressApp({

Tools let MCP clients ask your server to take actions. They are usually the main way that LLMs call into your application.

When your tool list changes at runtime, the server can notify connected clients so they can refresh their cached tool list. `McpServer` automatically emits a tool list changed notification when you register a new tool. You can also send it manually if you update metadata or
remove tools:

```typescript
server.sendToolListChanged();
```

A typical registration with `registerTool` looks like this:

```typescript
Expand Down
Loading