Let hosts own independent client connections and cancel async calls

Open
#130 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
python, r

Research direction

Start by reviewing the current client registry and synchronous tool invocation, then compare the related discussions in #86, #109, and #118. Done would mean defining whether hosts can own independent client lifetimes and cancel asynchronous calls while preserving the existing transport and cancellation handling.

Written by the indexing model from the issue text.

Description

I’m looking at using mcptools with mcp-repl to give a Deputy agent an R or Python session that persists across tool calls.

In a Shiny app, I’d like two agents to keep separate interpreter state, even when both use the same server configuration. The host would own each connection, close it when the conversation ends, and let the user cancel a long-running call while the app stays responsive.

The current client registry identifies connections by configured server name. Loading that name again closes the previous connection, so I can’t use the name alone as the ownership boundary for two independent agents. Tool invocation also waits synchronously for the response; sending an R interrupt is useful, but doesn’t by itself give a Shiny host an asynchronous call it can cancel.

Would a client connection object with an explicit lifetime fit the direction of mcptools? I’d like to reuse its transport and cancellation handling, with mcp-repl continuing to own interpreter execution and reset behavior.

This seems related to #86 and #109. My use case is the client connection to an external server, rather than the server-side async handlers in #118. I’m tracking the Deputy work in JamesHWade/deputy#69 and JamesHWade/deputy#48.

Dominant language
R
Stars
207
Forks
24
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from posit-dev/mcptools

All issues in posit-dev/mcptools

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.