Commit Graph

217 Commits

Author SHA1 Message Date
cliffhall
ae1e7a5500 Fix #3234 -
"Everything Server crashes when multiple clients reconnect"

* In index.ts
  - added a variable to hold the initialize timeout
  - store the timeout in the oninitialized handler
  - clear the timeout in the cleanup callback

* In roots.ts
  - In the catch block of syncRoots, log the error to the console via .error rather than attempting to send to the client because the most probable case here is that we don't have a connection.
2026-01-23 13:35:32 -05:00
cliffhall
9ade57133f Fix #3234 -
"Everything Server crashes when multiple clients reconnect"

* In index.ts
  - added a variable to hold the initialize timeout
  - store the timeout in the oninitialized handler
  - clear the timeout in the cleanup callback

* In roots.ts
  - In the catch block of syncRoots, log the error to the console via .error rather than attempting to send to the client because the most probable case here is that we don't have a connection.

* In simulate-research-query.ts
  - remove redundant local variable in getTask
* Everywhere else, prettier.
2026-01-23 13:26:02 -05:00
olaservo
1542b65154 fix(everything): move task to params.task and remove pollInterval from requests
- Use params.task instead of params._meta.task for task metadata
- Remove pollInterval from task requests (only available on result)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:39:29 -07:00
Ola Hungerford
a160653441 Apply suggestions from code review
Co-authored-by: Cliff Hall <cliff@futurescale.com>
2026-01-21 17:55:10 -07:00
olaservo
5156cff9dc fix(everything): implement graceful HTTP elicitation degradation
Implement graceful degradation for elicitation on HTTP transport:
- STDIO: Full elicitation works via sendRequest
- HTTP: Catches elicitation failure, uses default interpretation
- Task completes successfully on both transports

simulate-research-query now uses try-catch around sendRequest and
includes explanatory message when elicitation is skipped on HTTP.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 19:19:32 -07:00
olaservo
1cda86effb docs(everything): update features.md for direct elicitation flow
Update documentation to reflect that simulate-research-query now sends
elicitation requests directly from the background task instead of using
the tasks/result side-channel approach.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 17:44:55 -07:00
olaservo
c53a0f3799 fix(everything): send elicitation directly from background task
Instead of waiting for the client to call tasks/result to trigger
elicitation, the server now sends elicitation/create directly from
the background process using sendRequest. This simplifies the flow:

- Server sends elicitation proactively when clarification is needed
- Client receives and handles it via existing elicitation handler
- Task resumes and completes after receiving the response
- Client's polling sees completed status

This approach avoids requiring the client to detect input_required
status and call tasks/result as a side-channel.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 17:42:26 -07:00
Ola Hungerford
6556e339cb Merge branch 'main' into add-tasks-support 2026-01-17 14:05:35 -07:00
cliffhall
677f40a38f In roots.ts, clientCapabilites.roots and response.roots are optional.
Fixes #2818
2026-01-10 17:40:58 -05:00
cliffhall
7300631a5c In roots.ts, clientCapabilites.roots and response.roots are optional.
Fixes #2818
2026-01-10 17:32:20 -05:00
olaservo
9d863fb7e6 feat: add async sampling and elicitation tools
Add tools that demonstrate bidirectional MCP tasks where the server
sends requests to the client for async execution:

- trigger-sampling-request-async: Send sampling request with task
  params, client creates task and executes LLM call in background,
  server polls for completion and retrieves result

- trigger-elicitation-request-async: Same pattern for user input,
  useful when user may take time to fill out forms

Both tools:
- Check client capabilities (tasks.requests.sampling/elicitation)
- Accept both CreateTaskResult and direct result responses
- Poll tasks/get for status updates
- Fetch final result via tasks/result

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 09:14:30 -07:00
olaservo
0208e93f85 feat(everything): add SEP-1686 Tasks support
- Add tasks capability with list, cancel, and requests.tools.call
- Add InMemoryTaskStore and InMemoryTaskMessageQueue from SDK experimental
- Add simulate-research-query tool demonstrating task lifecycle
- Task demonstrates working -> input_required -> completed status flow
- Uses elicitation for ambiguous queries when client supports it

Closes #3037

🦉 Generated with [Claude Code](https://claude.ai/code)
2026-01-09 06:48:53 -07:00
dependabot[bot]
737ce98e4a Bump @modelcontextprotocol/sdk
Bumps the npm_and_yarn group with 1 update in the / directory: [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/typescript-sdk).


Updates `@modelcontextprotocol/sdk` from 1.24.0 to 1.25.2
- [Release notes](https://github.com/modelcontextprotocol/typescript-sdk/releases)
- [Commits](https://github.com/modelcontextprotocol/typescript-sdk/compare/1.24.0...v1.25.2)

---
updated-dependencies:
- dependency-name: "@modelcontextprotocol/sdk"
  dependency-version: 1.25.2
  dependency-type: direct:production
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-07 16:49:05 +00:00
cliffhall
44faf3a200 Remove console log statements 2025-12-19 10:18:55 -05:00
Cliff Hall
53cc385d4e Update src/everything/AGENTS.md
Co-authored-by: adam jones <domdomegg+git@gmail.com>
2025-12-18 15:03:44 -05:00
cliffhall
17aaa455bb Sync roots at startup. This was deferred to list_roots tool is used, but I'm putting it back.
* In server/roots.ts
  - Updated function doc
2025-12-17 17:49:35 -05:00
cliffhall
f8933ec3e6 Sync roots at startup. This was deferred to list_roots tool is used, but I'm putting it back.
The syncRoots call should be idempotent, requesting roots if they haven't been yet for the session, but always retuning the cached roots otherwise. That could be deferred but setting the handler for roots_list changed note should not.

* In server/roots.ts
  - only set the notification handler and call for initial roots list if the roots aren't already cached for this client.

* In server/index.ts
  - in the oninitialized handler
    - get the sessionId from the transport
    - set a 350ms timeout to call syncRoots with the server and sessionId
      - this delay cause it to run after the `notifications/initialized` handler finishes, otherwise, the request gets lost.

* All other changes attributable to prettier
2025-12-17 17:46:24 -05:00
cliffhall
c6daef707a Get roots unconditionally when syncRoots is called
* In server/roots.ts
  - in syncRoots, if roots are supported fetch them

* In get-roots-list.ts,
  - Don't import and inspect current roots map, just call syncRoots to get the list.
2025-12-15 19:37:56 -05:00
cliffhall
1b8f376b90 Demonstrate registration of tools conditioned upon client capability support. Also, obviated need for clientConnected callback to pass sessionId because we defer initial fetching of roots happens when you run the get-roots-list tool.
* In how-it-works.md,
  - added a section on conditional tool registration

* In server/index.ts
  - import registerConditionalTools
  - in an oninitialized handler for the server, call registerConditionalTools
  - removed clientConnected from ServerFactoryResponse and all mentions in docs

* In tools/index.ts
  - export a registerConditionalTools function
  - refactor/move calls to registerGetRootsListTool, registerTriggerElicitationRequestTool, and registerTriggerSamplingRequestTool out of registerTools and into registerConditionalTools

* In server/roots.ts
  - only act if client supports roots
  - remove setInterval from call to requestRoots. It isn't happening during the initialze handshake anymore, so it doesn't interfere with that process if called immediaately

* In get-roots-list.ts, trigger-elicitation-request.ts, and trigger-sampling-request.ts,
  - only register tool if client supports capability

* Throughout the rest of the files, removing all references to `clientConnected`
2025-12-15 17:51:30 -05:00
cliffhall
ebac6314cf Updated server instructions.md. See https://github.com/modelcontextprotocol/servers/pull/3121#discussion_r2616651611 2025-12-15 17:04:59 -05:00
cliffhall
8758a11b37 Updated server instructions.md. See https://github.com/modelcontextprotocol/servers/pull/3121#discussion_r2616651611 2025-12-15 17:04:35 -05:00
cliffhall
734d5c3ebb Updated server instructions.md. See https://github.com/modelcontextprotocol/servers/pull/3121#discussion_r2616651611 2025-12-15 17:01:33 -05:00
cliffhall
70feb6f2b0 Remove includeContext: "thisServer" from CreateMessageRequest in trigger-sampling-request.ts 2025-12-15 14:40:11 -05:00
cliffhall
e0f1c42159 Add listChanged capability for tools, prompts, and resources in servers/index.ts 2025-12-15 14:39:20 -05:00
cliffhall
cdbcdc551a Cache roots in get-roots-list.ts if list was not already present and had to be requested. 2025-12-13 16:25:28 -05:00
cliffhall
20527e4175 Updated doc in all tools 2025-12-13 15:55:07 -05:00
cliffhall
7b8592538f Updated doc in all tools 2025-12-13 15:52:32 -05:00
cliffhall
eed70bbbda Updated doc in trigger-sampling-request.ts 2025-12-13 15:48:41 -05:00
cliffhall
0ba86f8d4f Updated doc in echo.ts 2025-12-13 15:48:13 -05:00
cliffhall
29a20bfd0a Updated doc in get-annotated-message.ts 2025-12-13 15:46:57 -05:00
cliffhall
82cda366d6 Updated doc in get-env.ts 2025-12-13 15:45:24 -05:00
cliffhall
6ad8af7130 Updated doc in get-resource-reference.ts 2025-12-13 15:44:17 -05:00
cliffhall
8126179a0a Run pretter:fix 2025-12-13 15:43:00 -05:00
cliffhall
e1c1dcfac8 Use roots cache in get-roots-list tool
* In get-roots-list.ts, query the server's cache of the latest roots from the client and only request the list from the client if it doesn't exist.
* In roots.ts, export the roots map
2025-12-13 15:42:24 -05:00
cliffhall
6854902775 Use roots cache in get-roots-list tool
* In get-roots-list.ts, query the server's cache of the latest roots from the client and only request the list from the client if it doesn't exist.
* In roots.ts, export the roots map
2025-12-13 15:41:44 -05:00
cliffhall
77deef08ce Update doc in tools/gzip-file-as-resource.ts 2025-12-13 15:24:10 -05:00
cliffhall
cd5b728fb6 Update doc in tools/toggle-subscriber-updates.ts 2025-12-13 15:21:38 -05:00
cliffhall
ba098427d6 Update doc in tools/toggle-subscriber-updates.ts 2025-12-13 15:19:26 -05:00
cliffhall
45ea1e21f9 Update doc in tools/toggle-subscriber-updates.ts 2025-12-13 15:18:15 -05:00
cliffhall
b8074f9b9c Update doc in tools/trigger-elicitation-request.ts and trigger-long-running-operation.ts 2025-12-13 15:16:37 -05:00
cliffhall
8291c0b290 Update doc in tools/trigger-elicitation-request.ts 2025-12-13 15:12:51 -05:00
cliffhall
00b8c539f8 Update doc in tools/trigger-long-running-operation.ts 2025-12-13 15:11:12 -05:00
cliffhall
3f5e5cfb81 Update doc in tools/trigger-elicitation-request.ts 2025-12-13 15:09:26 -05:00
cliffhall
299aae2f4b Update doc in tools/toggle-subscriber-updates.ts 2025-12-13 15:07:13 -05:00
cliffhall
cb5f70cf20 Update doc in server/index.ts 2025-12-13 15:00:18 -05:00
cliffhall
90d1b664ee Update doc in server/index.ts 2025-12-13 14:58:49 -05:00
cliffhall
79c4e51038 Update README.md and doc in server/index.ts 2025-12-13 14:56:36 -05:00
cliffhall
a235ed8016 Updated package.json and ran prettier 2025-12-13 14:33:16 -05:00
cliffhall
919b2e0138 Updated AGENTS.md with guidance on tool naming 2025-12-13 14:24:38 -05:00
cliffhall
2b60822057 Refactor-renamed long-running-operation.ts to trigger-long-running-operation.ts 2025-12-13 14:20:24 -05:00