Commit graph typescript-sdk/src
Author SHA1 Message Date
Henry Mao
abcf91b463
Fix oauth-protected-resource to also be path aware 2025-07-04 11:10:07 +08:00
bhosmer-ant
9879d7a98e
Merge pull request #725 from sushichan044/revert-670-feat/structured-content-with-type-safety
Revert "fix: add type safety for tool output schemas in ToolCallback"
2025-07-03 17:03:31 -04:00
Inna Harper
0b0ea5b1a1
Merge pull request #721 from cliffhall/allow-custom-fetch
Allow custom fetch
2025-07-03 17:17:35 +01:00
ihrpr
d868c4a147
build 2025-07-03 16:01:14 +01:00
ihrpr
25048b9eaf
rename reject to decline 2025-07-03 15:51:16 +01:00
Kentaro Suzuki
a45e4febd9
Revert "fix: add type safety for tool output schemas in ToolCallback" 2025-07-03 22:13:24 +09:00
cliffhall
f383a9cb8c * In sse.test.ts
- More specific expectations in test "uses custom fetch implementation from options"

* In sse.ts
  - Import FetchLike from transport.ts

* In steramableHttp.ts
  - Import FetchLike from transport.ts
  - Export StartSSEOptions interface for testing

* In streamableHttp.test.ts
  - import StartSSEOptions from streamableHttp.ts
  - use StartSSEOptions instead of any in test "uses custom fetch implementation"

* In transport.ts
  - Add FetchLike function type
2025-07-01 14:00:56 -04:00
Cliff Hall
242c8248f7
Update src/client/streamableHttp.ts
nullish coalescing operator ?? instead of the logical OR operator || to handle the case where this?._eventSourceInit?.fetch or this._fetch might be null or undefined but not falsy

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-07-01 13:34:04 -04:00
Cliff Hall
7d8c061028
Update src/client/streamableHttp.ts
nullish coalescing operator ?? instead of the logical OR operator || to handle the case where this?._eventSourceInit?.fetch or this._fetch might be null or undefined but not falsy

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-07-01 13:33:56 -04:00
Cliff Hall
8e02df150e
Update src/client/sse.ts
nullish coalescing operator ?? instead of the logical OR operator || to handle the case where this?._eventSourceInit?.fetch or this._fetch might be null or undefined but not falsy

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-07-01 13:33:48 -04:00
Cliff Hall
a3c4e28138
Update src/client/streamableHttp.ts
nullish coalescing operator ?? instead of the logical OR operator || to handle the case where this?._eventSourceInit?.fetch or this._fetch might be null or undefined but not falsy

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-07-01 13:33:39 -04:00
Cliff Hall
3300a43742
Update src/client/sse.ts
nullish coalescing operator ?? instead of the logical OR operator || to handle the case where this?._eventSourceInit?.fetch or this._fetch might be null or undefined but not falsy

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-07-01 13:33:31 -04:00
Cliff Hall
e5167cbe20 Update streamableHttp custom fetch test 2025-07-01 13:20:28 -04:00
Glen Maddern
6f5e53b44b
Returning undefined from discoverOAuthMetadata for CORS errors (#717)
* Returning undefined from `discoverOAuthMetadata` for CORS errors

This behaviour was already happening for the root URL, but the new `fetchWithCorsRetry` logic differed.

The issue was if the server returns a 404 for `/.well-known/oauth-authorization-server/xyz` that didn't have the `access-control-allow-origin`, a TypeError was being thrown. There was logic there already to handle a TypeError for a _preflight_ request (cause by custom headers), but not the fallback. I refactored so all combinations return `undefined`.

* Add test for CORS error handling that should return undefined

This test covers the scenario where both the initial request with headers
and the retry without headers fail with CORS TypeErrors. The desired
behavior is to return undefined instead of throwing.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix test comment

---------

Co-authored-by: Glen Maddern <glen@glenmaddern.com>
Co-authored-by: Paul Carleton <paulc@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Paul Carleton <paulcarletonjr@gmail.com>
2025-07-01 16:24:27 +01:00
Inna Harper
fb4d07f0ee
Merge pull request #698 from RishiNandha/main
Added Sampling Example to README
2025-06-30 16:31:42 +01:00
ihrpr
a8fa0b342a
build 2025-06-30 16:25:26 +01:00
ihrpr
3d6acd3d9a
add an example and update readme 2025-06-30 16:23:19 +01:00
bhosmer-ant
a40b353fb6
Merge branch 'main' into feat/structured-content-with-type-safety 2025-06-30 10:08:09 -04:00
ihrpr
0db4407d43
Merge branch 'main' into xiaofhua/pid-StdioClientTransport 2025-06-30 14:44:36 +01:00
Inna Harper
7682c4cf4f
Merge pull request #598 from sinedied/fix-empty-schema
fix: missing "properties" property in empty schema
2025-06-30 13:20:42 +01:00
sushichan044
fb303d748f
tidying up 2025-06-28 14:56:02 +09:00
Inna Harper
64a60c4ecd
Merge pull request #571 from garciasdos/main
fix: extra headers when they are a Headers object
2025-06-27 17:29:06 +01:00
Inna Harper
99c75281bd
Merge pull request #661 from kentcdodds/resource-types
add overloads for registerResource method in McpServer class
2025-06-27 17:05:01 +01:00
Felix Weinberger
d54ebee8fe
Merge branch 'main' into hotfix/windows-default-env 2025-06-27 15:50:27 +01:00
ihrpr
53ad0a01d5
fix lint 2025-06-27 14:14:21 +01:00
David Dworken
8bc7374f5e
Fix merge conflict 2025-06-26 16:12:26 -07:00
David Dworken
185fb23f34
Merge branch 'main' into main 2025-06-26 16:10:00 -07:00
Christian Bromann
f76652bb10
Update src/server/sse.test.ts 2025-06-26 10:22:27 -07:00
Christian Bromann
08c767f8e1
Merge branch 'main' into cb/sse-tests 2025-06-26 09:50:41 -07:00
Inna Harper
71d309d0d8
Merge pull request #477 from nichtsam/pr/protocol-overwriting-transport-hooks
Pr/protocol overwriting transport hooks
2025-06-26 14:04:16 +01:00
Konstantin Konstantinov
a94a63a2d0
Merge branch 'main' into request-propagation-in-tools 2025-06-25 16:25:24 +03:00
Konstantin Konstantinov
924c1ce56b
Merge branch 'request-propagation-in-tools' of github.com:KKonstantinov/typescript-sdk into request-propagation-in-tools 2025-06-25 16:25:09 +03:00
Konstantin Konstantinov
606c278668
clean up tests - remove mockRequestInfo 2025-06-25 16:24:30 +03:00
Inna Harper
f733207dae
Merge pull request #640 from cliffhall/report-session-id-per-request
Show session id per request in simpleStreamableHttp example server
2025-06-25 14:18:49 +01:00
Konstantin Konstantinov
384095c30b
Merge branch 'main' into request-propagation-in-tools 2025-06-25 14:16:18 +03:00
Chris Dickinson
05d98bb3a4
feat(shared/auth): support software_statement in OAuthClientMetadata (#696)
Per [Section 3.1.1][ref], `software_statement` is an OPTIONAL member
of the client creation request, which may contain a JWT encoding claims
about client software.

[ref]: https://datatracker.ietf.org/doc/html/rfc7591#section-3.1.1
2025-06-25 11:20:26 +01:00
Konstantin Konstantinov
166da76b00
extra parameter - remain optional for backwards compatibility 2025-06-24 19:39:37 +03:00
Konstantin Konstantinov
33895f4520
Merge branch 'main' into request-propagation-in-tools 2025-06-24 19:32:49 +03:00
ihrpr
33e03f499e
Merge branch 'main' into fix/skip_validate_if_error 2025-06-24 17:12:34 +01:00
ihrpr
c20a47a79f
small fixes 2025-06-24 17:09:29 +01:00
Konstantin Konstantinov
dff036ecb8
Merge branch 'main' into request-propagation-in-tools 2025-06-24 18:28:04 +03:00
Konstantin Konstantinov
96ff8573cf
Merge branch 'main' into request-propagation-in-tools 2025-06-24 17:21:09 +03:00
Paul Carleton
15a2277c89
refactor resource selection to not include resource if PRM is not present 2025-06-24 14:47:54 +01:00
ihrpr
03da7cfc66
fallback 2025-06-24 11:38:55 +01:00
Henry Mao
1ff08e41d7
Add path test 2025-06-23 17:32:08 -04:00
Henry Mao
6220701352
Fix trailing slash 2025-06-23 17:13:13 -04:00
Henry Mao
da6ac79c1e
Fix missing issuer 2025-06-24 04:41:26 +08:00
Henry Mao
4f24b8bc6f
Fix /.well-known/oauth-authorization-server dropping path 2025-06-24 04:36:54 +08:00
Chris Dickinson
d89e854133
fix(client/sse): extract protected resource from eventsource 401
Previously the SSE connection would always default to the
`/.well-known/oauth-protected-resource` URI, ignoring the `resource_metadata`
portion of the `www-authenticate` returned in a 401.

Extract the metadata from the initial 401, so RS servers with
custom protected resource URIs (as in RFC9728, [section 3.1][1]))
continue to work as expected.

[1]: https://datatracker.ietf.org/doc/html/rfc9728#section-3.1
2025-06-20 12:54:29 -07:00
Samuel Jensen
9edb619600 make protocol class not overwrite existing hooks when connecting transports 2025-06-20 19:59:30 +02:00