Skip to content

MCP access part 11: tsh auto reconnect#55942

Merged
greedy52 merged 5 commits intomasterfrom
STeve/54705_part_11_resumable_conn
Jul 22, 2025
Merged

MCP access part 11: tsh auto reconnect#55942
greedy52 merged 5 commits intomasterfrom
STeve/54705_part_11_resumable_conn

Conversation

@greedy52
Copy link
Copy Markdown
Contributor

@greedy52 greedy52 commented Jun 20, 2025

part of:

This PR attempts to improve user experience when Teleport MCP server is "disconnected" (network issue, expired tsh session).

Now tsh mcp connect by default starts a new remote MCP session if the previous one is interrupted by network issues or tsh session expiration. The behavior can be overwrite by --[no]-auto-reconnect flag.

TODO(s)

  • make derive
  • make -C integrations/operator crd
  • make -C integrations/terraform docs

examples (click to expand)

`tsh mcp config`
$ tsh mcp config everything
Found MCP servers:
everything

Here is a sample JSON configuration for launching Teleport MCP servers:
{
  "mcpServers": {
    "teleport-mcp-everything": {
      "command": "/Users/stevehuang/go/github.com/gravitational/teleport/build/tsh",
      "args": ["mcp", "connect", "everything"],
      "env": {
        "TELEPORT_HOME": "/Users/stevehuang/.tsh-local"
      }
    }
  }
}

By default, tsh automatically starts a new remote MCP session if the previous
one is interrupted by network issues or tsh session expiration.
Auto-reconnection is recommended when MCP sessions are stateless across
requests. To disable it, use the --no-auto-reconnect flag. If disabled, you may
need to manually restart your client when encountering “disconnected” errors.

Tip: use --client-config=claude to update your Claude Desktop configuration.
You can also specify a custom config path with --client-config=<path> to update
a config file compatible with the "mcpServer" mapping.
Claude network issue Screenshot 2025-06-25 at 3 37 17 PM
Claude expired tsh session Screenshot 2025-06-25 at 3 48 34 PM

@greedy52 greedy52 added no-changelog Indicates that a PR does not require a changelog entry MCP MCP Server related labels Jun 20, 2025
@greedy52 greedy52 mentioned this pull request Jun 20, 2025
14 tasks
@greedy52 greedy52 changed the title MCP access part 11: resumable connection MCP access part 11: tsh auto reconnect Jun 20, 2025
@greedy52 greedy52 force-pushed the STeve/54705_part_11_resumable_conn branch 2 times, most recently from 5c8137f to 86e327f Compare June 25, 2025 19:18
@greedy52 greedy52 added the ux label Jun 25, 2025
@greedy52 greedy52 force-pushed the STeve/54705_part_11_resumable_conn branch from 86e327f to 5334c15 Compare June 25, 2025 19:47
@greedy52 greedy52 force-pushed the STeve/54705_part_11_resumable_conn branch from 5334c15 to 4c93961 Compare June 25, 2025 20:03
@greedy52 greedy52 self-assigned this Jul 4, 2025
@greedy52 greedy52 marked this pull request as ready for review July 4, 2025 20:24
@github-actions github-actions Bot added size/lg tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Jul 4, 2025
@greedy52 greedy52 force-pushed the STeve/54705_part_11_resumable_conn branch from 405ee81 to 783b455 Compare July 4, 2025 20:30
Copy link
Copy Markdown
Contributor

@gabrielcorado gabrielcorado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a few minor comments. Tested with Claude Desktop.

Comment thread tool/tsh/common/mcp_app.go Outdated
Comment thread lib/client/mcp/reconnect.go Outdated
Comment thread tool/tsh/common/mcp_app.go Outdated
Comment thread tool/tsh/common/mcp_app.go Outdated
Comment thread tool/tsh/common/mcp_app.go Outdated
Comment thread lib/client/mcp/errors.go
Comment thread lib/client/mcp/errors.go
Comment thread tool/tsh/common/mcp_app.go Outdated
@greedy52 greedy52 added this pull request to the merge queue Jul 22, 2025
Merged via the queue into master with commit 15f88b6 Jul 22, 2025
41 of 42 checks passed
@greedy52 greedy52 deleted the STeve/54705_part_11_resumable_conn branch July 22, 2025 18:49
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@greedy52 See the table below for backport results.

Branch Result
branch/v18 Failed

greedy52 added a commit that referenced this pull request Jul 22, 2025
* MCP access part 11: resumable connection

* revert app definition

* address pr comments

* special error message for server info changed
github-merge-queue Bot pushed a commit that referenced this pull request Jul 23, 2025
* MCP access part 11: resumable connection

* revert app definition

* address pr comments

* special error message for server info changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/branch/v18 MCP MCP Server related no-changelog Indicates that a PR does not require a changelog entry size/lg tsh tsh - Teleport's command line tool for logging into nodes running Teleport. ux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants