Commit graph

1,613 commits

Author SHA1 Message Date
Jerome
0ddf6827b6
feat: support async callbacks for onsessioninitialized and onsessionclosed
Updated StreamableHTTPServerTransport to support both sync and async callbacks:
- Changed callback types to return void | Promise<void>
- Used await Promise.resolve() to handle both sync and async callbacks
- Added comprehensive tests for async callback functionality
- Errors in callbacks now properly propagate to HTTP responses

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 14:48:40 +01:00
Inna Harper
d681f14b33
Merge pull request #749 from modelcontextprotocol/ochafik/check-addrinuse
Add missing app.listen error handling to server examples
2025-07-09 12:36:19 +01:00
Olivier Chafik
4056c098a1
Add missing app.listen error handling to server examples 2025-07-09 11:23:24 +01:00
Felix Weinberger
22dc79b2a4
Merge pull request #284 from HoberMin/feat/improve-stdio-test-windows-compatibility
Improve stdio test Windows compatibility and refactor command logic

I've pushed updates to address my own comments - thank you @HoberMin for this contribution!
2025-07-08 15:32:55 +01:00
Felix Weinberger
88ede3783e
Address review feedback: move getDefaultServerParameters to test file
- Moved getDefaultServerParameters from stdio.ts to stdio.test.ts since it's only used in tests
- Reverted unrelated changes to inMemory.ts and inMemory.test.ts
- Kept the core Windows compatibility fix for stdio tests

Co-authored-by: HoberMin <99346635+HoberMin@users.noreply.github.com>
2025-07-08 15:21:09 +01:00
HoberMin
a7dc125850
feat: improve stdio test Windows compatibility and refactor command logic 2025-07-08 15:21:09 +01:00
HoberMin
60310e9478
feat: Add error handling tests for InMemoryTransport 2025-07-08 15:21:09 +01:00
anthonjn
6ae4a5727c
add custom headers on initial _startOrAuth call (#318)
* add custom headers on initial _startOrAuth call

* update client/sse.ts: align commonHeaders w/ streamableHttp version

---------

Co-authored-by: Olivier Chafik <ochafik@anthropic.com>
2025-07-07 19:54:44 +01:00
Inna Harper
7d7896fc72
Merge pull request #743 from modelcontextprotocol/jerome/feature/ondelete-shttp-hook
Add onsessionclosed hook to StreamableHTTPServerTransport
2025-07-07 17:11:30 +01:00
Jerome
61052b1fa8
Add comprehensive tests for onsessionclosed callback in StreamableHTTPServerTransport
• Tests callback is called when session is closed via DELETE
• Tests system works correctly when callback is not provided
• Tests callback is not called for invalid session DELETE requests
• Tests correct session ID is passed when multiple sessions exist
• Follows existing test patterns and includes proper cleanup

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-07 15:19:40 +01:00
Jerome
52e22ad7cb
Refactor ondelete hook to onsessionclosed in StreamableHTTPServerTransport
- Renamed ondelete callback to onsessionclosed for better clarity
- Moved callback from public property to private field following options pattern
- Added comprehensive JSDoc documentation explaining the callback's purpose
- Updated DELETE request handler to use the new callback structure

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-07 14:57:41 +01:00
Jerome
afb8971569
Add ondelete hook to StreamableHTTPServerTransport
Adds optional ondelete callback that fires when DELETE request is received, providing the sessionId for cleanup handling.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-07 14:44:35 +01:00
Olivier Chafik
96a4f714e5
removed checkResourceReference (sdk's ResourceReference is deprecated / aliased to ResourceTemplateReference) 2025-07-07 13:22:41 +01:00
Olivier Chafik
98a04e6e38
moved src/spec.types.ts to . 2025-07-07 13:22:15 +01:00
Jerome
1bd56ee46d
Merge pull request #713 from modelcontextprotocol/jerome/cors-browser-support
feat: Add CORS configuration for browser-based MCP clients
2025-07-07 12:44:34 +01:00
Jerome
0aea3feb66
Merge branch 'main' into jerome/cors-browser-support 2025-07-07 12:42:08 +01:00
Jerome
7c374fd81e
Merged the CORS tips 2025-07-07 12:40:28 +01:00
Jerome
3d381df2bc
Added cors settings to simpleStreamableHttp example server 2025-07-07 12:35:52 +01:00
Olivier Chafik
c9947a92fc
Merge branch 'main' into ochafik/spec-type-tests 2025-07-07 11:28:56 +01:00
Inna Harper
593b1f7416
Merge pull request #394 from sunrabbit123/fix/1
fix(client): Some mcp server need default env(#393, #196)
2025-07-07 11:28:47 +01:00
ihrpr
0ff7ae09f9
simplify tests 2025-07-07 11:23:32 +01:00
sunrabbit123
d4bfe556bf
fix: format error with merge
Signed-off-by: sunrabbit123 <qudwls185@naver.com>
2025-07-07 18:50:24 +09:00
오병진
4607f37953
Merge branch 'main' into fix/1 2025-07-07 18:45:13 +09:00
Henry Mao
3bdecfc1b9
Update auth.ts 2025-07-07 03:59:06 +08:00
Henry Mao
7b02c5cda3
Retain URL search parameter 2025-07-07 03:56:42 +08:00
Jerome
bda811a950
feat: Add CORS configuration for browser-based MCP clients
- Add cors middleware to example servers with Mcp-Session-Id exposed
- Add CORS documentation section to README
- Configure minimal CORS settings (only expose required headers)

This enables browser-based clients to connect to MCP servers by properly
exposing the Mcp-Session-Id header required for session management.

Reported-by: Jerome
2025-07-04 16:06:20 +01:00
Olivier Chafik
0c0b075511
Merge branch 'main' into ochafik/spec-type-tests 2025-07-04 11:55:07 +01:00
Olivier Chafik
a7e4289f3e
Update spec.types.test.ts 2025-07-04 10:34:50 +01:00
Olivier Chafik
b6e00f9a49
Update spec.types.test.ts 2025-07-04 10:33:14 +01:00
Olivier Chafik
3ae5522193
Update spec.types.test.ts 2025-07-04 10:30:36 +01:00
Olivier Chafik
2fc1581dfb
widen type extraction regex, introduce + test MISSING_SDK_TYPES, check LoggingLevel 2025-07-04 10:28:25 +01:00
Henry Mao
c5fcba4617
Update auth.ts 2025-07-04 11:14:14 +08:00
Henry Mao
abcf91b463
Fix oauth-protected-resource to also be path aware 2025-07-04 11:10:07 +08:00
bhosmer-ant
1ac2e5926c
Merge pull request #730 from modelcontextprotocol/basil/bump_version 1.15.0
bump version to 1.15.0
2025-07-03 18:19:22 -04:00
Basil Hosmer
979700a7b7
npm install 2025-07-03 18:13:48 -04:00
Basil Hosmer
42d4abf383
bump version to 1.15 2025-07-03 18:06:29 -04: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
Olivier Chafik
a19175a26e
Update spec.types.test.ts 2025-07-03 20:44:58 +01:00
Olivier Chafik
0cd88db1f7
Update spec.types.test.ts 2025-07-03 20:43:45 +01:00
Olivier Chafik
e3888069f9
add MakeUnknownsNotOptional to fix optionality of Zod unknown() fields 2025-07-03 20:40:43 +01:00
Olivier Chafik
d57d35e348
Update spec.types.test.ts 2025-07-03 19:41:51 +01:00
Olivier Chafik
b3c5d27c70
Update spec.types.test.ts 2025-07-03 19:38:58 +01:00
Olivier Chafik
e0fc39066d
rename + switch position of RemovePassthrough<T> 2025-07-03 19:37:50 +01:00
Olivier Chafik
d1a30ab2d2
disable lints in spec.types.test.ts 2025-07-03 19:29:30 +01:00
Olivier Chafik
ead6fb5046
Add type compatibility test between SDK and spec types 2025-07-03 19:06:17 +01:00
Inna Harper
0b0ea5b1a1
Merge pull request #721 from cliffhall/allow-custom-fetch
Allow custom fetch
2025-07-03 17:17:35 +01:00
Inna Harper
bf4c5be38e
Merge pull request #728 from modelcontextprotocol/ihrpr/1.14.0 1.14.0
1.14.0
2025-07-03 16:39:10 +01:00
ihrpr
fc197e01f8
1.14.0 2025-07-03 16:09:00 +01:00
Inna Harper
d94386cd70
Merge pull request #727 from modelcontextprotocol/ihrpr/decline-reject
Rename reject to decline
2025-07-03 16:04:25 +01:00
ihrpr
d868c4a147
build 2025-07-03 16:01:14 +01:00