René's URL Explorer Experiment


Title: Add initialize(InitializeRequest) overload to MCP client by nquinquenel · Pull Request #1055 · modelcontextprotocol/java-sdk · GitHub

Open Graph Title: Add initialize(InitializeRequest) overload to MCP client by nquinquenel · Pull Request #1055 · modelcontextprotocol/java-sdk

X Title: Add initialize(InitializeRequest) overload to MCP client by nquinquenel · Pull Request #1055 · modelcontextprotocol/java-sdk

Description: Summary Add initialize(InitializeRequest) overloads to McpAsyncClient and McpSyncClient, consistent with callTool(CallToolRequest) Thread caller-provided initialize requests through LifecycleInitializer, with client-side protocol version validation and defensive copying of _meta Remember a successful custom initialize request and resend it when the transport session is re-established (e.g. after McpTransportSessionNotFoundException); clear stored request on client close Document the overload, ordering constraint, and session-recovery behavior in docs/client.md Design notes This follows the approach agreed in #940 (not the closed builder-level initializeRequestMeta() approach from #1046). Call initialize(InitializeRequest) before any other client method if custom metadata is required; lazy initialization triggered by methods like listTools() or callTool() uses the default request built from client builder settings. Test plan ./mvnw -pl mcp-core -Dtest=LifecycleInitializerTests,McpAsyncClientTest,McpSyncClientTest test ./mvnw -pl mcp-core verify Unit tests cover custom request propagation, defensive _meta copy, unsupported protocol version rejection, init reuse, re-init with stored custom request, default request on re-init when none stored, and clear on close / closeGracefully Client wire tests cover async/sync paths via MockMcpClientTransport Fixes #940

Open Graph Description: Summary Add initialize(InitializeRequest) overloads to McpAsyncClient and McpSyncClient, consistent with callTool(CallToolRequest) Thread caller-provided initialize requests through LifecycleIniti...

X Description: Summary Add initialize(InitializeRequest) overloads to McpAsyncClient and McpSyncClient, consistent with callTool(CallToolRequest) Thread caller-provided initialize requests through LifecycleIniti...

Opengraph URL: https://github.com/modelcontextprotocol/java-sdk/pull/1055

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:935be5e9-bd6e-f876-b12d-d52e2d44ad10
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id90DE:32AC14:43A51BE:5837561:6A5D390B
html-safe-nonce2f3f6c37d05e931b9e315d5ac03462cf2bb585d3f4bb73f59ff85f267884a7de
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MERFOjMyQUMxNDo0M0E1MUJFOjU4Mzc1NjE6NkE1RDM5MEIiLCJ2aXNpdG9yX2lkIjoiNjE1MjI2NDA3MzQ3MTA4MTA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd53f2e512357826dc8573b21bf3b37133e5d082b587ed831bebcc4e34c8b6cc7
hovercard-subject-tagpull_request:3997140883
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/modelcontextprotocol/java-sdk/pull/1055/files
twitter:imagehttps://avatars.githubusercontent.com/u/14952624?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/14952624?s=400&v=4
og:image:altSummary Add initialize(InitializeRequest) overloads to McpAsyncClient and McpSyncClient, consistent with callTool(CallToolRequest) Thread caller-provided initialize requests through LifecycleIniti...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/modelcontextprotocol/java-sdk git https://github.com/modelcontextprotocol/java-sdk.git
octolytics-dimension-user_id182288589
octolytics-dimension-user_loginmodelcontextprotocol
octolytics-dimension-repository_id919609219
octolytics-dimension-repository_nwomodelcontextprotocol/java-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id919609219
octolytics-dimension-repository_network_root_nwomodelcontextprotocol/java-sdk
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9c975978430e9ad293956f2bbdaf153b1bd84a99
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fjava-sdk%2Fpull%2F1055%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fjava-sdk%2Fpull%2F1055%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=modelcontextprotocol%2Fjava-sdk
Reloadhttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files
Reloadhttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files
Reloadhttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files
Please reload this pagehttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files
modelcontextprotocol https://github.com/modelcontextprotocol
java-sdkhttps://github.com/modelcontextprotocol/java-sdk
Notifications https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fjava-sdk
Fork 978 https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fjava-sdk
Star 3.6k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fjava-sdk
Code https://github.com/modelcontextprotocol/java-sdk
Issues 135 https://github.com/modelcontextprotocol/java-sdk/issues
Pull requests 147 https://github.com/modelcontextprotocol/java-sdk/pulls
Discussions https://github.com/modelcontextprotocol/java-sdk/discussions
Actions https://github.com/modelcontextprotocol/java-sdk/actions
Projects https://github.com/modelcontextprotocol/java-sdk/projects
Models https://github.com/modelcontextprotocol/java-sdk/models
Security and quality 2 https://github.com/modelcontextprotocol/java-sdk/security
Insights https://github.com/modelcontextprotocol/java-sdk/pulse
Code https://github.com/modelcontextprotocol/java-sdk
Issues https://github.com/modelcontextprotocol/java-sdk/issues
Pull requests https://github.com/modelcontextprotocol/java-sdk/pulls
Discussions https://github.com/modelcontextprotocol/java-sdk/discussions
Actions https://github.com/modelcontextprotocol/java-sdk/actions
Projects https://github.com/modelcontextprotocol/java-sdk/projects
Models https://github.com/modelcontextprotocol/java-sdk/models
Security and quality https://github.com/modelcontextprotocol/java-sdk/security
Insights https://github.com/modelcontextprotocol/java-sdk/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fmodelcontextprotocol%2Fjava-sdk%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmodelcontextprotocol%2Fjava-sdk%2Fissues%2Fnew%2Fchoose
nquinquenelhttps://github.com/nquinquenel
modelcontextprotocol:mainhttps://github.com/modelcontextprotocol/java-sdk/tree/main
nquinquenel:feature/940-initialize-request-overloadhttps://github.com/nquinquenel/java-sdk/tree/feature/940-initialize-request-overload
Conversation 0 https://github.com/modelcontextprotocol/java-sdk/pull/1055
Commits 1 https://github.com/modelcontextprotocol/java-sdk/pull/1055/commits
Checks 0 https://github.com/modelcontextprotocol/java-sdk/pull/1055/checks
Files changed https://github.com/modelcontextprotocol/java-sdk/pull/1055/files
Please reload this pagehttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files
Add initialize(InitializeRequest) overload to MCP client https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#top
Show all changes 1 commit https://github.com/modelcontextprotocol/java-sdk/pull/1055/files
3d063e3 Add initialize(InitializeRequest) overload to MCP client nquinquenel Jul 6, 2026 https://github.com/modelcontextprotocol/java-sdk/pull/1055/commits/3d063e3e4b3b21aaca207bf090fb07777a3d89e3
Clear filters https://github.com/modelcontextprotocol/java-sdk/pull/1055/files
Please reload this pagehttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files
Please reload this pagehttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files
client.md https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-5323dcc2b5e999ce4ad5b916d9f63514e20a8d40d86ff16d89a1c21aad7179f0
LifecycleInitializer.java https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
McpAsyncClient.java https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-4a7b3cc0ca46d3a01ae36554a9f4ba0cd914bcdb9e9fa7bbdaad3ed3f1856ad1
McpSyncClient.java https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-5da95b24ea63b6c69383a36dfe79d0f2ebaa86164d34253865dc645a2a4924d8
LifecycleInitializerTests.java https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-6f8d7d3a0d76ff2a0fd9b7e42a9d3436432c324b0436864164ddd993acad2fcd
McpAsyncClientTest.java https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-c5bcf516e6a8fee47b54152745ef040ddcad5e79afce21c6086d9e2e6cc17ddc
McpSyncClientTest.java https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-e5133501a0040e68842f690f3944837ab51a325f2d6b3ceba9dcc48a93a50745
docs/client.mdhttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-5323dcc2b5e999ce4ad5b916d9f63514e20a8d40d86ff16d89a1c21aad7179f0
View file https://github.com/modelcontextprotocol/java-sdk/blob/3d063e3e4b3b21aaca207bf090fb07777a3d89e3/docs/client.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/java-sdk/pull/1055/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-5323dcc2b5e999ce4ad5b916d9f63514e20a8d40d86ff16d89a1c21aad7179f0
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-5323dcc2b5e999ce4ad5b916d9f63514e20a8d40d86ff16d89a1c21aad7179f0
mcp-core/src/main/java/io/modelcontextprotocol/client/LifecycleInitializer.javahttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
View file https://github.com/modelcontextprotocol/java-sdk/blob/3d063e3e4b3b21aaca207bf090fb07777a3d89e3/mcp-core/src/main/java/io/modelcontextprotocol/client/LifecycleInitializer.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/java-sdk/pull/1055/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-dcff9fbc0a06ad16d7eaee680a4d5435bc7982378f6cb32519876b836def00a4
mcp-core/src/main/java/io/modelcontextprotocol/client/McpAsyncClient.javahttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-4a7b3cc0ca46d3a01ae36554a9f4ba0cd914bcdb9e9fa7bbdaad3ed3f1856ad1
View file https://github.com/modelcontextprotocol/java-sdk/blob/3d063e3e4b3b21aaca207bf090fb07777a3d89e3/mcp-core/src/main/java/io/modelcontextprotocol/client/McpAsyncClient.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/java-sdk/pull/1055/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-4a7b3cc0ca46d3a01ae36554a9f4ba0cd914bcdb9e9fa7bbdaad3ed3f1856ad1
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-4a7b3cc0ca46d3a01ae36554a9f4ba0cd914bcdb9e9fa7bbdaad3ed3f1856ad1
mcp-core/src/main/java/io/modelcontextprotocol/client/McpSyncClient.javahttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-5da95b24ea63b6c69383a36dfe79d0f2ebaa86164d34253865dc645a2a4924d8
View file https://github.com/modelcontextprotocol/java-sdk/blob/3d063e3e4b3b21aaca207bf090fb07777a3d89e3/mcp-core/src/main/java/io/modelcontextprotocol/client/McpSyncClient.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/java-sdk/pull/1055/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-5da95b24ea63b6c69383a36dfe79d0f2ebaa86164d34253865dc645a2a4924d8
https://github.com/modelcontextprotocol/java-sdk/pull/1055/files#diff-5da95b24ea63b6c69383a36dfe79d0f2ebaa86164d34253865dc645a2a4924d8
Please reload this pagehttps://github.com/modelcontextprotocol/java-sdk/pull/1055/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.