Justin Spahr-Summers
0c5d6c4f18
Missed one
2025-01-06 21:37:30 +00:00
Justin Spahr-Summers
b5711be1ad
Can just reuse z.infer instead of using ReturnType
2025-01-03 14:01:17 +00:00
Justin Spahr-Summers
73ea68cf13
Disable ESLint warning
2025-01-03 13:49:07 +00:00
Justin Spahr-Summers
9b5efc4286
Recursively flatten types for better inference
2025-01-03 13:47:19 +00:00
Sumitesh Naithani
ca319138b9
chore: pulled upstream origin branch
2025-01-03 07:36:18 +05:30
Sumitesh Naithani
21e3d465ca
chore: updated documentation comment in ErrorCode enum and set protocol test timeout to 0
2025-01-03 06:59:01 +05:30
Chris Dickinson
d55f966562
feat(client/sse): add {EventSource,Request}Init options param
...
This enables users of the SSE client to optionally send cookie-based credentials
to the event source MCP server using `EventSourceInit` [1] parameters and set
the outgoing request headers for the POST call.
[1]: https://developer.mozilla.org/en-US/docs/Web/API/EventSource/EventSource#options
2024-12-30 23:11:00 -08:00
Sumitesh Naithani
8fa0a5c88b
test: added tests for checking correct error codes are thrown on request timeout and connection closed scenarios
2024-12-23 00:10:14 +05:30
Sumitesh Naithani
d77cd0deb3
style: fixed linting issues
2024-12-22 23:20:35 +05:30
Sumitesh Naithani
e7d08c738e
fix(protocol): restrict SDK error codes to JSON-RPC server error range
...
The SDK's custom error codes were previously using arbitrary negative numbers
(-1, -2) which could conflict with application-specific error codes. This change:
- Updates ConnectionClosed from -1 to -32000
- Updates RequestTimeout from -2 to -32001
- Keeps standard JSON-RPC error codes unchanged
- Adds documentation explaining the server error range usage
This modification ensures compliance with the JSON-RPC 2.0 specification, which
reserves -32000 to -32099 for implementation-defined server errors. This change
allows applications to freely use other error code ranges without potential
conflicts with SDK-generated errors.
Issue: #85
2024-12-22 23:12:22 +05:30
Jerome
881a0ce0e8
Destructured progress and total from notification params object
2024-12-16 16:50:05 +00:00
Justin Spahr-Summers
1f835e044f
Whitespace tweaks
2024-12-09 13:43:17 +00:00
brn
6535f93f2d
feat: Add a parsedBody optional parameter
...
Please enter the commit message for your changes. Lines starting
2024-12-05 13:18:52 +09:00
Eric Fritz
3d15050960
Fix cancellation notification mismatch
...
The server registers a notification handler on `CancelledNotificationSchema`, but is never called on client cancellation because of a mismatch in the method name. This fixes that mismatch.
2024-11-27 23:48:44 -06:00
Anaïs Betts
9fd52c861e
Use windowsHide because detached seems to break stdio redirection on npx
2024-11-26 15:41:23 +01:00
Justin Spahr-Summers
1025b3fc55
Add way to get child process stderr pipe
2024-11-20 21:19:06 +00:00
Anaïs Betts
e0c821cad9
Special-case this fix to Electron apps
2024-11-20 15:55:11 +01:00
Anaïs Betts
17a32b14d4
Use detached: true on Windows
...
Unfortunately, the fix in #55 was not sufficient - the behavior of spawn
depends on the "console'ness" of the originally launched process, which has the
effect of development behavior for Claude Desktop on Windows being
different than in production, since the launching process is Claude.exe
(a Win32 Subsystem app) vs `yarn start` which is effectively a Console
Subsystem app.
2024-11-20 14:41:53 +01:00
Justin Spahr-Summers
437a870029
Tests for request timeout
2024-11-16 16:37:24 +00:00
Justin Spahr-Summers
35396f4a8d
Report errors sending cancellation
2024-11-16 16:31:45 +00:00
Justin Spahr-Summers
2cc3bc8a40
Add RequestOptions.timeout
2024-11-16 16:30:20 +00:00
Justin Spahr-Summers
53f55b8edf
Remove abortAfterTimeout
...
It's fundamentally flawed because it doesn't support easy cancellation of the timeout.
2024-11-16 16:18:35 +00:00
Justin Spahr-Summers
7d50d8ca16
Add missing options to request methods
2024-11-16 15:59:03 +00:00
Justin Spahr-Summers
65e3555620
Add message when aborting due to timeout
2024-11-16 15:57:15 +00:00
Justin Spahr-Summers
c3495d2f7a
Merge pull request #56 from modelcontextprotocol/justin/configurable-stderr
...
Make stderr behavior configurable
2024-11-15 13:39:30 +00:00
Justin Spahr-Summers
9db00579b0
Merge pull request #54 from modelcontextprotocol/justin/cancellation
...
Implement cancellation notifications and handling
2024-11-15 13:39:17 +00:00
Justin Spahr-Summers
b59c381abf
Make stderr behavior configurable
2024-11-14 20:13:13 +00:00
Anaïs Betts
8e2e917992
Don't open a terminal window on Windows
2024-11-14 16:11:10 +01:00
Justin Spahr-Summers
9882f1c919
Add abortAfterTimeout() utility to make it easy to add timeouts
2024-11-14 14:25:16 +00:00
Justin Spahr-Summers
6ec4c09325
Add tests for issuing cancellation notifications
2024-11-14 14:11:11 +00:00
Justin Spahr-Summers
1451d0ea24
Explicitly allow cancelled notifications without any capability
2024-11-14 14:07:28 +00:00
Justin Spahr-Summers
15bd2dc7aa
Fix cancelled notification method name
2024-11-14 14:07:16 +00:00
Justin Spahr-Summers
1b08f203ea
Catch errors that occur when a handler is invoked, but before it returns a Promise
2024-11-14 14:02:51 +00:00
Justin Spahr-Summers
90ba8950d2
Pass an AbortSignal to request handlers
2024-11-14 13:57:04 +00:00
Justin Spahr-Summers
54d146bbdc
Support passing an AbortSignal to request()
2024-11-14 13:42:18 +00:00
Justin Spahr-Summers
347e8905a9
Add types for cancellation notifications
2024-11-14 13:39:43 +00:00
Justin Spahr-Summers
d0c83e946c
Fix notification params schemas not permitting _meta
2024-11-14 13:26:24 +00:00
Justin Spahr-Summers
002f82332d
Merge branch 'main' into justin/call-tool-iserror
2024-11-12 13:47:43 +00:00
Justin Spahr-Summers
70cfb0f0d4
Unify error text
2024-11-12 12:17:35 +00:00
Justin Spahr-Summers
8b307a5d62
Check capabilities when request handlers are set
2024-11-12 12:16:43 +00:00
Justin Spahr-Summers
64c2862883
Check and add tests for notification capabilities too
2024-11-12 12:02:10 +00:00
Justin Spahr-Summers
dc45f5d148
Handle capabilities checks at the request() level, make non-strict by default
2024-11-12 10:57:59 +00:00
Justin Spahr-Summers
8e369b7171
Lint
2024-11-11 22:49:53 +00:00
Justin Spahr-Summers
af03a74f5a
Fix missing argument in cli.ts
2024-11-11 22:42:01 +00:00
Justin Spahr-Summers
7ab5880569
Use explicit capabilities lists for now
2024-11-11 22:38:43 +00:00
Justin Spahr-Summers
90e91cdd62
Tests and assertions for client/server capabilities
...
Resolves #45 .
2024-11-11 22:30:50 +00:00
Justin Spahr-Summers
852ebb9ec0
Add an InMemoryTransport
2024-11-11 22:27:45 +00:00
Justin Spahr-Summers
c82d633d8d
Disconnect from client side if initialization fails
...
Resolves #24 .
2024-11-11 22:08:46 +00:00
Justin Spahr-Summers
8ea66e7df9
Tests for protocol version negotiation
...
Resolves #44 .
2024-11-11 22:05:13 +00:00
Justin Spahr-Summers
7631cdb6d1
CallToolResult.isError should not be required
2024-11-11 21:27:02 +00:00