Skip to content

feat(client): add configurable periodic ping for connection health#1571

Closed
aptsalt wants to merge 1 commit intomodelcontextprotocol:mainfrom
aptsalt:feat/periodic-ping
Closed

feat(client): add configurable periodic ping for connection health#1571
aptsalt wants to merge 1 commit intomodelcontextprotocol:mainfrom
aptsalt:feat/periodic-ping

Conversation

@aptsalt
Copy link

@aptsalt aptsalt commented Feb 22, 2026

Summary

  • Adds opt-in periodic ping configuration to ClientOptions (ping.enabled, ping.intervalMs)
  • Client sends ping requests at the configured interval after connecting
  • Pings are automatically stopped on close()
  • Defaults: disabled, 60s interval when enabled

Implements the MCP specification recommendation that implementations SHOULD periodically issue pings to detect connection health, with configurable frequency.

Closes #1000

Test plan

  • should send periodic pings when enabled — verifies pings are sent at configured interval
  • should not send pings when disabled (default) — verifies no pings sent by default
  • should stop pings on close — verifies pings stop after client.close()
  • All 70 client tests pass
  • Build succeeds

🤖 Generated with Claude Code

The MCP specification recommends implementations periodically issue
pings to detect connection health. This adds an opt-in ping config
to ClientOptions with configurable interval.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aptsalt aptsalt requested a review from a team as a code owner February 22, 2026 09:54
@changeset-bot
Copy link

changeset-bot bot commented Feb 22, 2026

🦋 Changeset detected

Latest commit: 8f90a3a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@modelcontextprotocol/client Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 22, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1571

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1571

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1571

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1571

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1571

commit: 8f90a3a

@aptsalt aptsalt closed this by deleting the head repository Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug Report-2: Missing Periodic Ping Implementation

1 participant