modelcontextprotocol / modelcontextprotocol/typescript-sdk

Allow Custom Client Features for MCP Tools

Open
#370 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs decision P3
Dominant language
TypeScript
Stars
13.4k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
4

Description

MCP tools can only utilize the predefined Client Roots and Sampling client features, which are quite restrictive. Tools often require dynamic information from the client/host, but the MCP currently does not facilitate this.

We can address this limitation by allowing the definition of custom client features.

For example, if the client defines a custom feature called get/context that returns some dynamic context information needed by the get-context-from-client-and-do-something tool:

server.tool(
  'get-context-from-client-and-do-something',
  async (_, { sendRequest }) => {
    const context = await sendRequest({ method: 'get/context', params }, resultSchema);
  
    // Do something with the context. 
    
    return {
      content: [
        {
          type: 'text',
          text: `${result}`,
        },
      ],
    };
);

Contributor guide

Open the contributing guide

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.

Research direction

Start by tracing the client feature handling for the predefined Roots and Sampling features, then inspect the server.tool callback and its sendRequest entry point. Compare the current request flow with the custom get/context example. Done means a client can define a custom feature and an MCP tool can request it with the expected result handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.