modelcontextprotocol / modelcontextprotocol/typescript-sdk
Allow Custom Client Features for MCP Tools
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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