{"id":114557,"date":"2026-10-09T14:24:58","date_gmt":"2026-10-09T06:24:58","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/114557.html"},"modified":"2026-10-09T14:24:58","modified_gmt":"2026-10-09T06:24:58","slug":"%e4%b8%ba-mcp-%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%8e%a5%e5%85%a5-oauth2%ef%bc%9a%e5%9f%ba%e4%ba%8e-spring-authorization-server-%e4%b8%8e-azure-api-management-%e7%9a%84%e5%ae%8c%e6%95%b4%e5%ae%9e%e6%88%98","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/114557.html","title":{"rendered":"\u4e3a MCP \u670d\u52a1\u5668\u63a5\u5165 OAuth2\uff1a\u57fa\u4e8e Spring Authorization Server \u4e0e Azure API Management \u7684\u5b8c\u6574\u5b9e\u6218\uff08mcp-for-beginners\uff09"},"content":{"rendered":"<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u6559\u7a0b<\/span><\/li>\n<li><span class=\"gcb-tag\">\u6587\u6863<\/span><\/li>\n<li><span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011mcp-for-beginners<\/h3>\n<p class=\"gcb-project-desc\">This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/GitHub_Trending\/mc\/mcp-for-beginners<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<p>\u672c\u6587\u56f4\u7ed5 mcp-for-beginners \u4ed3\u5e93\u4e2d 05-AdvancedTopics\/mcp-oauth2-demo \u7684\u5b9e\u6218\u6837\u4f8b\u5c55\u5f00&#xff0c;\u8bb2\u89e3\u5982\u4f55\u7528 Spring Boot \u628a MCP \u670d\u52a1\u5668\u540c\u65f6\u6539\u9020\u6210 OAuth2 \u6388\u6743\u670d\u52a1\u5668&#xff08;Authorization Server&#xff09;\u4e0e\u8d44\u6e90\u670d\u52a1\u5668&#xff08;Resource Server&#xff09;&#xff0c;\u4ee5 client_credentials \u6d41\u7a0b\u4e3a AI Agent \u7b49\u673a\u5668\u5ba2\u6237\u7aef\u7b7e\u53d1 JWT \u8bbf\u95ee\u4ee4\u724c&#xff0c;\u5e76\u901a\u8fc7 Azure Container Apps \u90e8\u7f72\u3001Azure API Management \u7f51\u5173\u7edf\u4e00\u9a8c\u7b7e\u3002\u8bfb\u5b8c\u672c\u6587\u4f60\u5c06\u638c\u63e1\u4ece\u672c\u5730 curl \u9a8c\u8bc1\u5230\u4e91\u7aef\u5bb9\u5668\u5316\u90e8\u7f72\u7684\u5b8c\u6574\u94fe\u8def&#xff0c;\u5e76\u7406\u89e3\u6e90\u7801\u7ea7\u7684\u5b89\u5168\u914d\u7f6e\u8981\u70b9\u3002<\/p>\n<h3>\u4e00\u3001\u8fd9\u4e2a Demo \u89e3\u51b3\u4ec0\u4e48\u95ee\u9898<\/h3>\n<p>\u5728 MCP&#xff08;Model Context Protocol&#xff0c;\u6a21\u578b\u4e0a\u4e0b\u6587\u534f\u8bae&#xff09;\u7684\u5b9e\u73b0\u4e2d&#xff0c;\u5ba2\u6237\u7aef&#xff08;\u4f8b\u5982 AI Agent&#xff09;\u9700\u8981\u4ee5\u5b89\u5168\u3001\u6807\u51c6\u5316\u7684\u65b9\u5f0f\u8bbf\u95ee MCP \u670d\u52a1\u5668\u53ca\u5176\u5de5\u5177\u3002OAuth2 \u6b63\u662f\u884c\u4e1a\u6807\u51c6\u7684\u6388\u6743\u534f\u8bae&#xff1a;\u5b83\u5141\u8bb8\u5728\u4e0d\u5171\u4eab\u7528\u6237\u51ed\u636e\u7684\u524d\u63d0\u4e0b&#xff0c;\u5411\u5df2\u8ba4\u8bc1\u7684\u5ba2\u6237\u7aef\u7b7e\u53d1\u53d7\u9650\u8303\u56f4\u7684\u8bbf\u95ee\u4ee4\u724c\u3002<\/p>\n<p>mcp-oauth2-demo \u662f\u4e00\u4e2a\u6700\u5c0f\u5316\u7684 Spring Boot \u5e94\u7528&#xff0c;\u540c\u65f6\u626e\u6f14\u4e24\u4e2a\u89d2\u8272&#xff1a;<\/p>\n<ul>\n<li>Spring \u6388\u6743\u670d\u52a1\u5668&#xff08;Spring Authorization Server&#xff09;&#xff1a;\u901a\u8fc7 client_credentials&#xff08;\u5ba2\u6237\u7aef\u51ed\u636e&#xff09;\u6d41\u7a0b\u7b7e\u53d1 JWT \u8bbf\u95ee\u4ee4\u724c&#xff1b;<\/li>\n<li>\u8d44\u6e90\u670d\u52a1\u5668&#xff08;Resource Server&#xff09;&#xff1a;\u4fdd\u62a4\u81ea\u5df1\u7684 \/hello \u7aef\u70b9&#xff0c;\u4efb\u4f55\u672a\u643a\u5e26\u6709\u6548\u4ee4\u724c\u7684\u8bf7\u6c42\u90fd\u4f1a\u88ab\u62d2\u7edd\u3002<\/li>\n<\/ul>\n<p>\u5b83\u590d\u523b\u4e86 Spring \u5b98\u65b9\u535a\u5ba2\u300cSecuring Spring AI MCP servers with OAuth2\u300d\u6240\u5c55\u793a\u7684\u914d\u7f6e\u601d\u8def&#xff0c;\u9002\u5408\u4f01\u4e1a\u7ea7\u4e0e\u751f\u4ea7\u5316\u90e8\u7f72\u573a\u666f\u3002\u5728\u5b66\u4e60\u4e4b\u524d&#xff0c;\u8bf7\u5148\u786e\u8ba4&#xff1a;<\/p>\n<ul>\n<li>\u5177\u5907 Java \u4e0e Spring Boot \u7684\u57fa\u7840\u77e5\u8bc6&#xff1b;<\/li>\n<li>\u5df2\u719f\u6089\u524d\u9762\u7ae0\u8282\u7684 MCP \u6838\u5fc3\u6982\u5ff5&#xff1b;<\/li>\n<li>\u672c\u5730\u5df2\u5b89\u88c5 Maven \u6216 Gradle&#xff08;\u672c\u6837\u4f8b\u4f7f\u7528 Maven&#xff09;\u3002<\/li>\n<\/ul>\n<p>[!WARNING] \u8fd9\u662f\u4e00\u4e2a\u672c\u5730\u5b66\u4e60\u6837\u4f8b&#xff0c;\u4e0d\u662f\u751f\u4ea7\u6388\u6743\u670d\u52a1\u3002\u5b83\u4f7f\u7528\u5185\u5b58\u5ba2\u6237\u7aef&#xff0c;\u5e76\u5728\u6bcf\u6b21\u542f\u52a8\u65f6\u91cd\u65b0\u751f\u6210\u7b7e\u540d\u5bc6\u94a5\u3002\u7edd\u4e0d\u8981\u5c06\u5171\u4eab\u7684\u3001\u9ed8\u8ba4\u7684\u6216\u7eb3\u5165\u7248\u672c\u63a7\u5236\u7684\u5ba2\u6237\u7aef\u5bc6\u94a5\u90e8\u7f72\u5230\u751f\u4ea7\u73af\u5883\u3002\u8be6\u89c1\u4e0b\u6587\u300c\u751f\u4ea7\u5b89\u5168\u300d\u4e00\u8282\u3002<\/p>\n<h3>\u4e8c\u3001\u9879\u76ee\u7ed3\u6784\u4e0e\u6e90\u7801\u7ec4\u6210<\/h3>\n<p>\u6837\u4f8b\u4f4d\u4e8e\u4ed3\u5e93\u7684 05-AdvancedTopics\/mcp-oauth2-demo \u76ee\u5f55&#xff0c;\u5305\u542b\u56db\u4e2a\u6838\u5fc3\u6e90\u7801\u6587\u4ef6&#xff1a;<\/p>\n<table>\n<tr>\u6587\u4ef6\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>Application.java<\/td>\n<td>Spring Boot \u542f\u52a8\u5165\u53e3<\/td>\n<\/tr>\n<tr>\n<td>SecurityConfiguration.java<\/td>\n<td>\u6388\u6743\u670d\u52a1\u5668 &#043; \u8d44\u6e90\u670d\u52a1\u5668\u7684\u5168\u90e8\u5b89\u5168\u914d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td>HelloController.java<\/td>\n<td>\u53d7\u4fdd\u62a4\u7aef\u70b9 \/hello<\/td>\n<\/tr>\n<tr>\n<td>SecurityConfigurationTest.java<\/td>\n<td>\u5b89\u5168\u914d\u7f6e\u7684\u5355\u5143\u6d4b\u8bd5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6784\u5efa\u914d\u7f6e\u65b9\u9762&#xff0c;pom.xml \u91c7\u7528 Spring Boot 3.2.5 \u4f5c\u4e3a\u7236\u5de5\u7a0b\u3001Java 17&#xff0c;\u5e76\u58f0\u660e\u4e86\u4e09\u4e2a\u5173\u952e\u4f9d\u8d56&#xff1a;<\/p>\n<ul>\n<li>spring-boot-starter-web&#xff1a;\u63d0\u4f9b REST \u7aef\u70b9&#xff1b;<\/li>\n<li>spring-boot-starter-oauth2-resource-server&#xff1a;\u542f\u7528 JWT \u4ee4\u724c\u6821\u9a8c&#xff1b;<\/li>\n<li>spring-boot-starter-oauth2-authorization-server&#xff1a;\u542f\u7528 OAuth2 \u6388\u6743\u670d\u52a1\u5668\u80fd\u529b\u3002<\/li>\n<\/ul>\n<h3>\u4e09\u3001\u5feb\u901f\u5f00\u59cb&#xff08;\u672c\u5730\u8fd0\u884c&#xff09;<\/h3>\n<p>\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b&#xff0c;\u5148\u8bbe\u7f6e\u4e00\u4e2a\u552f\u4e00\u7684\u672c\u5730\u5bc6\u94a5\u5e76\u5c3d\u53ef\u80fd\u907f\u514d\u8fdb\u5165 shell \u5386\u53f2\u8bb0\u5f55&#xff1a;<\/p>\n<p># \u4f7f\u7528\u4e00\u4e2a\u552f\u4e00\u7684\u672c\u5730\u503c&#xff0c;\u5e76\u5c3d\u53ef\u80fd\u8ba9\u5b83\u4e0d\u8fdb\u5165 shell \u5386\u53f2<br \/>\nexport OAUTH_CLIENT_SECRET&#061;&#034;replace-with-a-random-local-secret&#034;<br \/>\nmvn spring-boot:run<\/p>\n<p>\u5e94\u7528\u542f\u52a8\u540e&#xff08;\u9ed8\u8ba4\u7aef\u53e3 8081&#xff09;&#xff0c;\u4f9d\u6b21\u6267\u884c\u4e09\u6761\u547d\u4ee4\u5b8c\u6210\u300c\u53d6\u4ee4\u724c \u2192 \u8c03\u63a5\u53e3\u300d\u7684\u95ed\u73af&#xff1a;<\/p>\n<p># \u83b7\u53d6\u4ee4\u724c<br \/>\ncurl -u &#034;mcp-client:${OAUTH_CLIENT_SECRET}&#034; -d grant_type&#061;client_credentials \\\\<br \/>\n     http:\/\/localhost:8081\/oauth2\/token | jq -r .access_token &gt; token.txt<\/p>\n<p># \u8c03\u7528\u53d7\u4fdd\u62a4\u7aef\u70b9<br \/>\ncurl -H &#034;Authorization: Bearer $(cat token.txt)&#034; http:\/\/localhost:8081\/hello<\/p>\n<p>\u5728 PowerShell \u73af\u5883\u4e0b&#xff0c;\u5148\u8bbe\u7f6e\u672c\u5730\u5bc6\u94a5\u518d\u8fd0\u884c Maven&#xff1a;<\/p>\n<p>$env:OAUTH_CLIENT_SECRET &#061; &#034;replace-with-a-random-local-secret&#034;<br \/>\nmvn spring-boot:run<\/p>\n<h3>\u56db\u3001\u5206\u6b65\u6d4b\u8bd5 OAuth2 \u5b89\u5168\u914d\u7f6e<\/h3>\n<h4>\u6b65\u9aa4 1&#xff1a;\u786e\u8ba4\u670d\u52a1\u5668\u5df2\u542f\u52a8\u4e14\u88ab\u5b89\u5168\u4fdd\u62a4<\/h4>\n<p>\u76f4\u63a5\u8bbf\u95ee\u6839\u8def\u5f84&#xff0c;\u5e94\u8fd4\u56de 401 Unauthorized&#xff0c;\u8fd9\u8bc1\u660e OAuth2 \u5b89\u5168\u673a\u5236\u5df2\u7ecf\u751f\u6548&#xff1a;<\/p>\n<p>curl -v http:\/\/localhost:8081\/<\/p>\n<h4>\u6b65\u9aa4 2&#xff1a;\u7528\u5ba2\u6237\u7aef\u51ed\u636e\u83b7\u53d6\u8bbf\u95ee\u4ee4\u724c<\/h4>\n<p>\u4ee5 mcp-client \u4f5c\u4e3a\u5ba2\u6237\u7aef ID\u3001${OAUTH_CLIENT_SECRET} \u4f5c\u4e3a\u5ba2\u6237\u7aef\u5bc6\u94a5&#xff0c;\u5411\u4ee4\u724c\u7aef\u70b9\u53d1\u8d77\u8868\u5355\u8bf7\u6c42&#xff0c;\u5e76\u58f0\u660e mcp.access \u4f5c\u7528\u57df&#xff1a;<\/p>\n<p># \u83b7\u53d6\u5e76\u6253\u5370\u5b8c\u6574\u4ee4\u724c\u54cd\u5e94<br \/>\ncurl -v -X POST http:\/\/localhost:8081\/oauth2\/token \\\\<br \/>\n  -H &#034;Content-Type: application\/x-www-form-urlencoded&#034; \\\\<br \/>\n  -u &#034;mcp-client:${OAUTH_CLIENT_SECRET}&#034; \\\\<br \/>\n  -d &#034;grant_type&#061;client_credentials&amp;scope&#061;mcp.access&#034;<\/p>\n<p># \u6216\u8005\u53ea\u63d0\u53d6\u4ee4\u724c\u672c\u8eab&#xff08;\u9700\u8981 jq&#xff09;<br \/>\ncurl -s -X POST http:\/\/localhost:8081\/oauth2\/token \\\\<br \/>\n  -H &#034;Content-Type: application\/x-www-form-urlencoded&#034; \\\\<br \/>\n  -u &#034;mcp-client:${OAUTH_CLIENT_SECRET}&#034; \\\\<br \/>\n  -d &#034;grant_type&#061;client_credentials&amp;scope&#061;mcp.access&#034; | jq -r .access_token &gt; token.txt<\/p>\n<h4>\u6b65\u9aa4 3&#xff1a;\u7528\u4ee4\u724c\u8bbf\u95ee\u53d7\u4fdd\u62a4\u7aef\u70b9<\/h4>\n<p># \u4f7f\u7528\u5df2\u4fdd\u5b58\u7684\u4ee4\u724c<br \/>\ncurl -H &#034;Authorization: Bearer $(cat token.txt)&#034; http:\/\/localhost:8081\/hello<\/p>\n<p># \u6216\u76f4\u63a5\u4f7f\u7528\u4ee4\u724c\u503c<br \/>\ncurl -H &#034;Authorization: Bearer eyJra&#8230;token_value&#8230;xyz&#034; http:\/\/localhost:8081\/hello<\/p>\n<p>\u8fd4\u56de Hello from MCP OAuth2 Demo! \u5373\u8868\u793a OAuth2 \u914d\u7f6e\u5de5\u4f5c\u6b63\u5e38\u2014\u2014\u8be5\u54cd\u5e94\u6587\u672c\u6b63\u662f HelloController.java \u4e2d \/hello \u6620\u5c04\u65b9\u6cd5\u7684\u8fd4\u56de\u503c\u3002<\/p>\n<h3>\u4e94\u3001\u6e90\u7801\u7ea7\u89e3\u6790&#xff1a;\u5b89\u5168\u914d\u7f6e\u5982\u4f55\u5de5\u4f5c<\/h3>\n<p>\u7406\u89e3\u4e86\u5916\u90e8\u884c\u4e3a\u540e&#xff0c;\u6df1\u5165 SecurityConfiguration.java \u53ef\u4ee5\u770b\u6e05\u4e09\u4e2a\u6838\u5fc3 Bean \u7684\u5b9e\u73b0\u539f\u7406\u3002<\/p>\n<h4>5.1 \u5b89\u5168\u8fc7\u6ee4\u5668\u94fe&#xff1a;\u6388\u6743\u670d\u52a1\u5668 &#043; \u8d44\u6e90\u670d\u52a1\u5668\u5408\u4f53<\/h4>\n<p>&#064;Bean<br \/>\npublic SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {<br \/>\n    OAuth2AuthorizationServerConfigurer authorizationServerConfigurer &#061;<br \/>\n            new OAuth2AuthorizationServerConfigurer();<\/p>\n<p>    http.apply(authorizationServerConfigurer);<\/p>\n<p>    http.authorizeHttpRequests(auth -&gt; auth.anyRequest().authenticated())<br \/>\n        .oauth2ResourceServer(oauth2 -&gt; oauth2.jwt(Customizer.withDefaults()))<br \/>\n        .csrf(Customizer.withDefaults());<\/p>\n<p>    return http.build();<br \/>\n}<\/p>\n<ul>\n<li>apply(authorizationServerConfigurer) \u6302\u8f7d\u6388\u6743\u670d\u52a1\u5668\u9ed8\u8ba4\u7aef\u70b9&#xff0c;\u4f8b\u5982 \/oauth2\/token \u4e0e \/oauth2\/jwks&#xff1b;<\/li>\n<li>anyRequest().authenticated() \u8981\u6c42\u6240\u6709\u8bf7\u6c42\u90fd\u5fc5\u987b\u901a\u8fc7\u8ba4\u8bc1&#xff1b;<\/li>\n<li>oauth2ResourceServer(&#8230;).jwt(&#8230;) \u5f00\u542f JWT \u8d44\u6e90\u670d\u52a1\u5668\u6a21\u5f0f&#xff0c;\u6536\u5230\u8bf7\u6c42\u65f6\u6821\u9a8c Authorization: Bearer \u5934\u4e2d\u7684\u4ee4\u724c\u7b7e\u540d\u3001\u6709\u6548\u671f\u7b49\u5c5e\u6027\u3002<\/li>\n<\/ul>\n<h4>5.2 JWK \u6e90&#xff1a;\u542f\u52a8\u65f6\u751f\u6210 RSA \u7b7e\u540d\u5bc6\u94a5<\/h4>\n<p>&#064;Bean<br \/>\npublic JWKSource&lt;SecurityContext&gt; jwkSource() throws Exception {<br \/>\n    KeyPairGenerator kpg &#061; KeyPairGenerator.getInstance(&#034;RSA&#034;);<br \/>\n    kpg.initialize(2048);<br \/>\n    KeyPair kp &#061; kpg.generateKeyPair();<br \/>\n    RSAKey rsaKey &#061; new RSAKey.Builder((RSAPublicKey) kp.getPublic())<br \/>\n            .privateKey((RSAPrivateKey) kp.getPrivate())<br \/>\n            .keyID(&#034;demo-key&#034;)<br \/>\n            .build();<br \/>\n    JWKSet jwkSet &#061; new JWKSet(rsaKey);<br \/>\n    return new ImmutableJWKSet&lt;&gt;(jwkSet);<br \/>\n}<\/p>\n<p>\u4ece\u6e90\u7801\u53ef\u4ee5\u6e05\u6670\u770b\u5230&#xff1a;\u5bc6\u94a5\u5bf9\u5728\u6bcf\u6b21\u5e94\u7528\u542f\u52a8\u65f6\u91cd\u65b0\u751f\u6210&#xff08;RSA-2048&#xff0c;keyID \u4e3a demo-key&#xff09;&#xff0c;\u5e76\u901a\u8fc7 \/oauth2\/jwks \u53d1\u5e03\u516c\u94a5\u3002\u8fd9\u6b63\u662f README \u5f00\u5934\u8b66\u544a\u300c\u6bcf\u6b21\u542f\u52a8\u751f\u6210\u65b0\u7b7e\u540d\u5bc6\u94a5\u300d\u7684\u76f4\u63a5\u539f\u56e0\u2014\u2014\u751f\u4ea7\u73af\u5883\u5fc5\u987b\u66ff\u6362\u4e3a\u6301\u4e45\u5316\u5bc6\u94a5\u3002<\/p>\n<h4>5.3 \u5185\u5b58\u6ce8\u518c\u5ba2\u6237\u7aef&#xff1a;client_credentials &#043; mcp.access<\/h4>\n<p>&#064;Bean<br \/>\npublic RegisteredClientRepository registeredClientRepository(<br \/>\n        &#064;Value(&#034;${demo.oauth.client-id}&#034;) String clientId,<br \/>\n        &#064;Value(&#034;${demo.oauth.client-secret}&#034;) String clientSecret) {<br \/>\n    Assert.hasText(clientId, &#034;demo.oauth.client-id must not be blank&#034;);<br \/>\n    Assert.hasText(clientSecret, &#034;demo.oauth.client-secret must not be blank&#034;);<\/p>\n<p>    PasswordEncoder passwordEncoder &#061; PasswordEncoderFactories.createDelegatingPasswordEncoder();<br \/>\n    RegisteredClient registeredClient &#061; RegisteredClient.withId(UUID.randomUUID().toString())<br \/>\n            .clientId(clientId)<br \/>\n            .clientSecret(passwordEncoder.encode(clientSecret))<br \/>\n            .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC)<br \/>\n            .authorizationGrantType(AuthorizationGrantType.CLIENT_CREDENTIALS)<br \/>\n            .scope(&#034;mcp.access&#034;)<br \/>\n            .clientSettings(ClientSettings.builder().requireAuthorizationConsent(false).build())<br \/>\n            .build();<\/p>\n<p>    return new InMemoryRegisteredClientRepository(registeredClient);<br \/>\n}<\/p>\n<p>\u5173\u952e\u70b9\u89e3\u8bfb&#xff1a;<\/p>\n<ul>\n<li>\u5ba2\u6237\u7aef ID \u4e0e\u5bc6\u94a5\u5206\u522b\u901a\u8fc7 ${demo.oauth.client-id}\u3001${demo.oauth.client-secret} \u914d\u7f6e\u9879\u6ce8\u5165&#xff0c;\u9ed8\u8ba4\u5ba2\u6237\u7aef ID \u4e3a mcp-client&#xff0c;\u5bc6\u94a5\u6765\u81ea\u73af\u5883\u53d8\u91cf OAUTH_CLIENT_SECRET&#xff08;\u5bf9\u5e94 README \u4e2d\u7684 export\/$env \u8bbe\u7f6e&#xff09;&#xff1b;<\/li>\n<li>\u5ba2\u6237\u7aef\u5bc6\u94a5\u4f7f\u7528 PasswordEncoderFactories.createDelegatingPasswordEncoder() \u52a0\u5bc6\u540e\u5b58\u50a8&#xff0c;\u4e0d\u4f1a\u4ee5\u660e\u6587\u843d\u5e93&#xff1b;<\/li>\n<li>\u8ba4\u8bc1\u65b9\u5f0f\u4e3a CLIENT_SECRET_BASIC&#xff08;\u5373 curl -u client:secret \u7684 HTTP Basic \u8ba4\u8bc1&#xff09;&#xff1b;<\/li>\n<li>\u6388\u6743\u7c7b\u578b\u9650\u5b9a\u4e3a CLIENT_CREDENTIALS&#xff0c;\u8fd9\u662f\u673a\u5668\u4e0e\u673a\u5668&#xff08;M2M&#xff09;\u901a\u4fe1\u7684\u6807\u51c6\u6d41\u7a0b&#xff0c;\u65e0\u9700\u7528\u6237\u6388\u6743&#xff0c;\u56e0\u6b64 requireAuthorizationConsent(false)\u3002<\/li>\n<\/ul>\n<h4>5.4 \u5355\u5143\u6d4b\u8bd5\u5370\u8bc1<\/h4>\n<p>SecurityConfigurationTest.java \u7528\u4e24\u6761\u6d4b\u8bd5\u9a8c\u8bc1\u4e86\u914d\u7f6e\u7684\u5065\u58ee\u6027&#xff1a;\u5f53 clientId \u4e3a\u7a7a\u767d\u6216 clientSecret \u4e3a\u7a7a\u5b57\u7b26\u4e32\u65f6&#xff0c;registeredClientRepository(&#8230;) \u4f1a\u629b\u51fa IllegalArgumentException\u3002\u8fd9\u8bf4\u660e\u300c\u5bc6\u94a5\u5fc5\u987b\u663e\u5f0f\u63d0\u4f9b\u300d\u662f\u88ab\u6d4b\u8bd5\u9501\u5b9a\u7684\u786c\u6027\u7ea6\u675f&#xff0c;\u4e5f\u662f\u9632\u6b62\u8bef\u7528\u9ed8\u8ba4\u5bc6\u94a5\u7684\u7b2c\u4e00\u9053\u9632\u7ebf\u3002<\/p>\n<h4>5.5 \u4f9d\u8d56\u4e0e\u7248\u672c\u7ea6\u675f<\/h4>\n<p>\u4ece pom.xml \u53ef\u786e\u8ba4\u8fd0\u884c\u524d\u63d0&#xff1a;Java 17 &#043; Spring Boot 3.2.5&#xff0c;\u4e14 spring-boot-starter-oauth2-authorization-server \u4e0e spring-boot-starter-oauth2-resource-server \u5fc5\u987b\u540c\u65f6\u5b58\u5728&#xff0c;\u7f3a\u4e00\u4e0d\u53ef\u2014\u2014\u524d\u8005\u63d0\u4f9b\u7b7e\u53d1\u80fd\u529b&#xff0c;\u540e\u8005\u63d0\u4f9b\u6821\u9a8c\u80fd\u529b\u3002<\/p>\n<h3>\u516d\u3001\u5bb9\u5668\u5316\u6784\u5efa\u4e0e\u672c\u5730\u8fd0\u884c<\/h3>\n<p>\u4ed3\u5e93\u81ea\u5e26\u7684 Dockerfile \u91c7\u7528\u591a\u9636\u6bb5\u6784\u5efa&#xff1a;<\/p>\n<li>\u6784\u5efa\u9636\u6bb5&#xff1a;\u57fa\u4e8e maven:3.9-eclipse-temurin-17&#xff0c;\u6267\u884c mvn -ntp -B clean package -DskipTests \u4ea7\u51fa\u53ef\u6267\u884c JAR&#xff1b;<\/li>\n<li>\u8fd0\u884c\u9636\u6bb5&#xff1a;\u57fa\u4e8e eclipse-temurin:17-jammy&#xff0c;\u53ea\u62f7\u8d1d JAR&#xff0c;\u66b4\u9732 8081 \u7aef\u53e3&#xff0c;\u4ee5 java -jar \u542f\u52a8\u3002<\/li>\n<p>\u672c\u5730\u6784\u5efa\u5e76\u8fd0\u884c\u5bb9\u5668&#xff1a;<\/p>\n<p>docker build -t mcp-oauth2-demo .<br \/>\ndocker run &#8211;rm -p 8081:8081 \\\\<br \/>\n  -e OAUTH_CLIENT_SECRET&#061;&#034;$OAUTH_CLIENT_SECRET&#034; \\\\<br \/>\n  mcp-oauth2-demo<\/p>\n<p>\u6ce8\u610f&#xff1a;\u8fd0\u884c\u65f6\u901a\u8fc7 -e \u6ce8\u5165 OAUTH_CLIENT_SECRET&#xff0c;\u4e0d\u8981\u628a\u5b83\u5199\u8fdb\u955c\u50cf\u5c42\u6216 Dockerfile\u3002<\/p>\n<h3>\u4e03\u3001\u751f\u4ea7\u5b89\u5168&#xff1a;\u4ece Demo \u5230\u751f\u4ea7\u5fc5\u987b\u505a\u7684\u56db\u4ef6\u4e8b<\/h3>\n<p>README \u660e\u786e\u5f3a\u8c03&#xff0c;\u751f\u4ea7\u90e8\u7f72\u5e94\u5f53\u7528\u4e13\u7528\u8eab\u4efd\u63d0\u4f9b\u65b9&#xff08;IdP&#xff09;\u66ff\u4ee3\u8fd9\u4e2a\u8fdb\u7a0b\u5185\u6f14\u793a\u6388\u6743\u670d\u52a1\u5668&#xff0c;\u5e76\u81f3\u5c11\u505a\u5230&#xff1a;<\/p>\n<li>\u51ed\u636e\u5165\u6258\u7ba1\u5bc6\u94a5\u5e93&#xff1a;\u628a\u5ba2\u6237\u7aef\u5bc6\u94a5\u5b58\u653e\u5728\u6258\u7ba1\u5bc6\u94a5\u5b58\u50a8\u4e2d&#xff0c;\u5b9a\u671f\u8f6e\u6362&#xff1b;<\/li>\n<li>\u7b7e\u540d\u5bc6\u94a5\u6301\u4e45\u5316&#xff1a;\u4f7f\u7528\u6301\u4e45\u5316\u7684\u7b7e\u540d\u5bc6\u94a5&#xff0c;\u800c\u4e0d\u662f\u542f\u52a8\u65f6\u4e34\u65f6\u751f\u6210&#xff1b;<\/li>\n<li>\u6536\u655b\u4f5c\u7528\u57df&#xff1a;\u4e25\u683c\u9650\u5236\u4ee4\u724c\u643a\u5e26\u7684 scope \u6743\u9650\u8303\u56f4&#xff1b;<\/li>\n<li>\u663e\u5f0f\u8bbe\u7f6e issuer&#xff1a;\u4e3a\u4ee4\u724c\u58f0\u660e\u663e\u5f0f\u7684\u7b7e\u53d1\u8005&#xff08;issuer&#xff09;\u5730\u5740\u3002<\/li>\n<p>\u6b64\u5916&#xff0c;\u7edd\u4e0d\u8981\u628a\u5ba2\u6237\u7aef\u5bc6\u94a5\u653e\u8fdb\u6e90\u4ee3\u7801\u3001\u5bb9\u5668\u955c\u50cf\u3001\u90e8\u7f72\u6e05\u5355\u6216\u547d\u4ee4\u884c\u8f93\u51fa\u4e2d\u3002<\/p>\n<p>\u9488\u5bf9 Azure Container Apps \u573a\u666f&#xff0c;\u5efa\u8bae\u628a\u5bc6\u94a5\u503c\u5b58\u4e3a Container Apps \u673a\u5bc6&#xff08;secret&#xff09;&#xff0c;\u5c3d\u53ef\u80fd\u7531 Key Vault \u80cc\u4e66&#xff0c;\u7136\u540e\u4ec5\u901a\u8fc7 OAUTH_CLIENT_SECRET \u73af\u5883\u53d8\u91cf\u7684\u65b9\u5f0f\u66b4\u9732\u673a\u5bc6\u5f15\u7528&#xff0c;\u800c\u4e0d\u662f\u660e\u6587\u503c\u3002<\/p>\n<h3>\u516b\u3001\u90e8\u7f72\u5230 Azure Container Apps<\/h3>\n<p>\u4f7f\u7528 Azure CLI \u4e00\u6761\u547d\u4ee4\u5373\u53ef\u5b8c\u6210\u90e8\u7f72&#xff1a;<\/p>\n<p>az containerapp up -n mcp-oauth2 \\\\<br \/>\n  -g demo-rg -l westeurope \\\\<br \/>\n  &#8211;image &lt;your-registry&gt;\/mcp-oauth2-demo:latest \\\\<br \/>\n  &#8211;ingress external &#8211;target-port 8081<\/p>\n<p>\u90e8\u7f72\u5b8c\u6210\u540e\u4e24\u4e2a\u5173\u952e\u4e8b\u5b9e&#xff1a;<\/p>\n<ul>\n<li>\u5165\u53e3&#xff08;ingress&#xff09;\u7684 FQDN \u5c31\u662f\u4f60\u7684 issuer&#xff08;\u7b7e\u53d1\u8005&#xff09;&#xff1a;https:\/\/&lt;fqdn&gt;&#xff1b;<\/li>\n<li>Azure \u4f1a\u4e3a *.azurecontainerapps.io \u57df\u540d\u81ea\u52a8\u7b7e\u53d1\u53ef\u4fe1 TLS \u8bc1\u4e66&#xff0c;\u8fd9\u4fdd\u8bc1\u4e86\u4ee4\u724c\u7aef\u70b9\u4e0e JWKS \u7aef\u70b9\u90fd\u8d70 HTTPS&#xff0c;\u662f APIM \u7f51\u5173\u9a8c\u7b7e\u7684\u524d\u63d0\u3002<\/li>\n<\/ul>\n<p>\u66f4\u5b8c\u6574\u7684\u90e8\u7f72\u793a\u4f8b&#xff08;\u542b\u67e5\u8be2 FQDN \u7684 &#8211;query \u53c2\u6570&#xff09;\u53ef\u53c2\u8003\u4ed3\u5e93\u4e2d\u7684 apimoauth.md\u3002\u90e8\u7f72\u540e&#xff0c;\u5e94\u7528\u5bf9\u5916\u66b4\u9732\u4e09\u7c7b\u7aef\u70b9&#xff1a;<\/p>\n<table>\n<tr>\u7aef\u70b9\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>https:\/\/&lt;fqdn&gt;\/oauth2\/token<\/td>\n<td>\u4ee4\u724c\u7aef\u70b9&#xff0c;\u5ba2\u6237\u7aef\u5728\u6b64\u83b7\u53d6\u4ee4\u724c&#xff08;client_credentials \u6d41\u7a0b&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>https:\/\/&lt;fqdn&gt;\/oauth2\/jwks<\/td>\n<td>JWKS \u7aef\u70b9&#xff0c;\u8fd4\u56de\u7b7e\u540d\u516c\u94a5\u96c6\u5408<\/td>\n<\/tr>\n<tr>\n<td>https:\/\/&lt;fqdn&gt;\/.well-known\/openid-configuration<\/td>\n<td>OIDC \u53d1\u73b0\u6587\u6863&#xff0c;\u5305\u542b issuer\u3001token_endpoint\u3001jwks_uri \u7b49\u5143\u6570\u636e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4e5d\u3001\u63a5\u5165 Azure API Management&#xff08;APIM&#xff09;<\/h3>\n<h4>9.1 \u6dfb\u52a0 validate-jwt \u5165\u7ad9\u7b56\u7565<\/h4>\n<p>\u5728 APIM \u7684 API \u4e0a\u6dfb\u52a0\u5982\u4e0b\u5165\u7ad9\u7b56\u7565&#xff0c;\u8ba9\u7f51\u5173\u5728\u8f6c\u53d1\u524d\u7edf\u4e00\u6821\u9a8c JWT&#xff1a;<\/p>\n<p>&lt;inbound&gt;<br \/>\n  &lt;validate-jwt header-name&#061;&#034;Authorization&#034;&gt;<br \/>\n    &lt;openid-config url&#061;&#034;https:\/\/&lt;fqdn&gt;\/.well-known\/openid-configuration&#034;\/&gt;<br \/>\n    &lt;audiences&gt;<br \/>\n      &lt;audience&gt;mcp-client&lt;\/audience&gt;<br \/>\n    &lt;\/audiences&gt;<br \/>\n  &lt;\/validate-jwt&gt;<br \/>\n  &lt;base\/&gt;<br \/>\n&lt;\/inbound&gt;<\/p>\n<p>APIM \u4f1a\u81ea\u52a8\u6293\u53d6 JWKS \u5e76\u5bf9\u6bcf\u4e2a\u8bf7\u6c42\u9a8c\u7b7e&#xff0c;\u65e0\u9700\u624b\u5de5\u7ef4\u62a4\u516c\u94a5\u3002<\/p>\n<h4>9.2 \u4e09\u4e2a\u8ba9 APIM \u9a8c\u7b7e\u6210\u529f\u7684\u5148\u51b3\u6761\u4ef6<\/h4>\n<p>\u7ed3\u5408 apimoauth.md \u7684\u6392\u969c\u6e05\u5355&#xff0c;\u52a1\u5fc5\u786e\u8ba4&#xff1a;<\/p>\n<li>\u542f\u7528 OIDC \u53d1\u73b0&#xff1a;Spring Authorization Server \u9ed8\u8ba4\u4e0d\u66b4\u9732 \/.well-known\/openid-configuration&#xff0c;\u9700\u8981\u5728\u5b89\u5168\u914d\u7f6e\u4e2d\u52a0\u5165 .oidc(Customizer.withDefaults())&#xff0c;\u5426\u5219 APIM \u7684 &lt;openid-config&gt; \u62c9\u53d6\u5143\u6570\u636e\u4f1a\u5f97\u5230 404&#xff1b;<\/li>\n<li>audience \u4e0e\u4ee4\u724c\u5339\u914d&#xff1a;\u82e5 APIM \u7684 &lt;audience&gt; \u6821\u9a8c\u5931\u8d25&#xff0c;\u9700\u8981\u81ea\u5b9a\u4e49 JWT \u7684 aud \u58f0\u660e&#xff08;\u4f8b\u5982\u901a\u8fc7 OAuth2TokenCustomizer \u628a audience \u8bbe\u4e3a mcp-client&#xff09;&#xff0c;\u4f7f\u4ee4\u724c\u4e2d\u7684 aud \u4e0e\u7b56\u7565\u4e2d\u7684 &lt;audience&gt; \u4e00\u81f4&#xff1b;<\/li>\n<li>HTTPS \u4e0e\u53ef\u8fbe\u6027&#xff1a;APIM \u7f51\u5173\u8981\u6c42 OpenID\/JWKS \u7aef\u70b9\u5fc5\u987b\u8d70 HTTPS \u4e14\u8bc1\u4e66\u53ef\u4fe1&#xff1b;\u540c\u65f6 Spring \u5e94\u7528\u7684\u7aef\u70b9\u5fc5\u987b\u80fd\u4ece APIM \u8bbf\u95ee&#xff08;&#8211;ingress external \u662f\u6700\u7b80\u5355\u7684\u6d4b\u8bd5\u9009\u62e9&#xff09;\u3002<\/li>\n<h4>9.3 \u5e38\u89c1\u9677\u9631\u901f\u67e5<\/h4>\n<table>\n<tr>\u9677\u9631\u73b0\u8c61\u5bf9\u7b56<\/tr>\n<tbody>\n<tr>\n<td>\u672a\u542f\u7528 OIDC<\/td>\n<td>&lt;openid-config&gt; \u8fd4\u56de 404<\/td>\n<td>\u5b89\u5168\u914d\u7f6e\u52a0 .oidc(&#8230;)<\/td>\n<\/tr>\n<tr>\n<td>audience \u4e0d\u5339\u914d<\/td>\n<td>APIM \u62d2\u7edd\u5408\u6cd5\u4ee4\u724c<\/td>\n<td>\u5b9a\u5236 token \u7684 aud \u6216\u8c03\u6574 &lt;audience&gt;<\/td>\n<\/tr>\n<tr>\n<td>\u81ea\u5b9a\u4e49\u57df\u540d\u65e0\u8bc1\u4e66<\/td>\n<td>APIM \u62c9\u53d6\u5143\u6570\u636e\u5931\u8d25<\/td>\n<td>\u7ed1\u5b9a\u514d\u8d39\u6258\u7ba1\u8bc1\u4e66\u6216\u4f7f\u7528\u9ed8\u8ba4\u57df\u540d<\/td>\n<\/tr>\n<tr>\n<td>\u7b56\u7565\u987a\u5e8f\u9519\u8bef<\/td>\n<td>\u8bf7\u6c42\u7ed5\u8fc7\u6821\u9a8c\u76f4\u8fbe\u540e\u7aef<\/td>\n<td>&lt;validate-jwt&gt; \u7f6e\u4e8e &lt;inbound&gt; \u4e0b\u3001\u8def\u7531\u4e4b\u524d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7b56\u7565\u8bf4\u660e&#xff1a;&lt;validate-jwt&gt; \u5e94\u653e\u5728 &lt;inbound&gt; \u5757\u5185\u4e14\u4f4d\u4e8e\u4efb\u4f55\u540e\u7aef\u8def\u7531\u4e4b\u524d&#xff1b;\u4ee4\u724c\u7ecf\u8fc7 APIM \u9a8c\u8bc1\u540e&#xff0c;\u539f Authorization \u5934\u4f1a\u7ee7\u7eed\u8f6c\u53d1\u7ed9\u540e\u7aef\u3002\u867d\u7136 Spring \u8d44\u6e90\u670d\u52a1\u5668\u8fd8\u4f1a\u518d\u6821\u9a8c\u4e00\u6b21&#xff0c;\u4f46\u4fdd\u7559\u53cc\u5c42\u6821\u9a8c\u66f4\u5b89\u5168\u3002<\/p>\n<h3>\u5341\u3001\u4e0b\u4e00\u6b65<\/h3>\n<p>\u672c Demo \u5c5e\u4e8e\u9ad8\u7ea7\u4e3b\u9898\u7ae0\u8282\u300c05-AdvancedTopics\u300d\u7684\u7ec4\u6210\u90e8\u5206\u3002\u5b8c\u6210 OAuth2 \u96c6\u6210\u540e&#xff0c;\u53ef\u4ee5\u7ee7\u7eed\u5b66\u4e60\u6839\u4e0a\u4e0b\u6587&#xff08;Root Contexts&#xff09;\u673a\u5236&#xff1a;5.4 \u6839\u4e0a\u4e0b\u6587\u3002\u5728\u52a8\u624b\u5b9e\u8df5\u65f6\u8bf7\u7262\u8bb0&#xff1a;\u5148\u672c\u5730\u7528 curl \u9a8c\u8bc1\u4ee4\u724c\u95ed\u73af&#xff0c;\u518d\u5bb9\u5668\u5316\u90e8\u7f72&#xff0c;\u6700\u540e\u63a5\u5165 APIM\u2014\u2014\u6bcf\u4e00\u6b65\u90fd\u4ee5\u300c\u5bc6\u94a5\u4e0d\u843d\u4ee3\u7801\u3001\u7b7e\u540d\u5bc6\u94a5\u6301\u4e45\u5316\u3001\u663e\u5f0f issuer\u3001\u4f5c\u7528\u57df\u6700\u5c0f\u5316\u300d\u4e3a\u5b89\u5168\u5e95\u7ebf\u3002<\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" class=\"gcb-icon-like\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261009062457-6ac888b9804dc.svg\" alt=\"\" width=\"16\" height=\"16\" \/> <span class=\"gcb-like-text\">\u8d5e<\/span>  <\/p>\n<p>   <span class=\"gcb-share-text\">\u5206\u4eab<\/span>  <\/p>\n<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u6559\u7a0b<\/span><\/li>\n<li><span class=\"gcb-tag\">\u6587\u6863<\/span><\/li>\n<li><span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011mcp-for-beginners<\/h3>\n<p class=\"gcb-project-desc\">This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/GitHub_Trending\/mc\/mcp-for-beginners<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<h4 class=\"gcb-related-title\">\u76f8\u5173\u63a8\u8350<\/h4>\n<ul class=\"gcb-related-list\">\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">\u7528 Azure API Management \u5c06 REST API \u66b4\u9732\u4e3a MCP \u670d\u52a1\u5668&#xff1a;MCP for Beginners \u5b9e\u6218\u6848\u4f8b<\/h5>\n<p class=\"gcb-related-item-desc\">\u7528 Azure API Management \u5c06 REST API \u66b4\u9732\u4e3a MCP \u670d\u52a1\u5668&#xff1a;MCP for Beginners \u5b9e\u6218\u6848\u4f8b Azure API M<\/p>\n<p>     <span class=\"gcb-tag\">\u6559\u7a0b<\/span><br \/>\n     <span class=\"gcb-tag\">\u6587\u6863<\/span><br \/>\n     <span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">\u4f7f\u7528 Spring Authorization Server \u4e3a MCP \u670d\u52a1\u5668\u5b9e\u73b0 OAuth2 \u8ba4\u8bc1&#xff1a;\u4ece\u672c\u5730 client_credentials \u5230 Azure \u4e91\u4e0a\u90e8\u7f72<\/h5>\n<p class=\"gcb-related-item-desc\">\u4f7f\u7528 Spring Authorization Server \u4e3a MCP \u670d\u52a1\u5668\u5b9e\u73b0 OAuth2 \u8ba4\u8bc1&#xff1a;\u4ece\u672c\u5730 client_credentials \u5230 Az<\/p>\n<p>     <span class=\"gcb-tag\">\u6559\u7a0b<\/span><br \/>\n     <span class=\"gcb-tag\">\u6587\u6863<\/span><br \/>\n     <span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">\u57fa\u4e8e Spring Boot WebFlux \u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1&#xff1a;mcp-for-beginners \u7684 Java \u5165\u95e8\u5b9e\u6218\u6307\u5357<\/h5>\n<p class=\"gcb-related-item-desc\">\u57fa\u4e8e Spring Boot WebFlux \u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1&#xff1a;mcp for beginners \u7684 Java \u5165\u95e8\u5b9e\u6218\u6307\u5357 \u672c\u7bc7\u6280\u672f\u6307\u5357\u56f4\u7ed5\u5f00\u6e90\u8bfe\u7a0b<\/p>\n<p>     <span class=\"gcb-tag\">\u6559\u7a0b<\/span><br \/>\n     <span class=\"gcb-tag\">\u6587\u6863<\/span><br \/>\n     <span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span>\n      <\/li>\n<\/ul>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0a\u4e00\u7bc7&#xff1a;<\/span><br \/>\n  \u6a21\u578b\u90e8\u7f72\u5b9e\u6218\u6307\u5357&#xff1a;Interview-for-Algorithm-Engineer\u4e2d\u7684vLLM\u3001SGLang\u7b49\u6846\u67b6\u5b9e\u6218\u89e3\u6790 <\/p>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0b\u4e00\u7bc7&#xff1a;<\/span><br \/>\n  \u684c\u9762\u5ba0\u7269RunCat\u8fd0\u884c\u5f02\u5e38\u6392\u67e5\u4e0e\u4fee\u590d\u6307\u5357&#xff1a;\u8ba9\u53ef\u7231\u732b\u54aa\u91cd\u56de\u4efb\u52a1\u680f <\/p>\n<p>\u521b\u4f5c\u58f0\u660e\uff1a\u672c\u6587\u90e8\u5206\u5185\u5bb9\u7531AI\u8f85\u52a9\u751f\u6210\uff08AIGC\uff09\uff0c\u4ec5\u4f9b\u53c2\u8003<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6559\u7a0b\u6587\u6863\u4eba\u5de5\u667a\u80fd \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011mcp-for-beginners This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for deve<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-114557","post","type-post","status-publish","format-standard","hentry","category-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4e3a MCP \u670d\u52a1\u5668\u63a5\u5165 OAuth2\uff1a\u57fa\u4e8e Spring Authorization Server \u4e0e Azure API Management \u7684\u5b8c\u6574\u5b9e\u6218\uff08mcp-for-beginners\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/114557.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4e3a MCP \u670d\u52a1\u5668\u63a5\u5165 OAuth2\uff1a\u57fa\u4e8e Spring Authorization Server \u4e0e Azure API Management \u7684\u5b8c\u6574\u5b9e\u6218\uff08mcp-for-beginners\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6559\u7a0b\u6587\u6863\u4eba\u5de5\u667a\u80fd \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011mcp-for-beginners This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for deve\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/114557.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-09T06:24:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261009062457-6ac888b9804dc.svg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/114557.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/114557.html\",\"name\":\"\u4e3a MCP \u670d\u52a1\u5668\u63a5\u5165 OAuth2\uff1a\u57fa\u4e8e Spring Authorization Server \u4e0e Azure API Management \u7684\u5b8c\u6574\u5b9e\u6218\uff08mcp-for-beginners\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-09T06:24:58+00:00\",\"dateModified\":\"2026-10-09T06:24:58+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/114557.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/114557.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/114557.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4e3a MCP \u670d\u52a1\u5668\u63a5\u5165 OAuth2\uff1a\u57fa\u4e8e Spring Authorization Server \u4e0e Azure API Management \u7684\u5b8c\u6574\u5b9e\u6218\uff08mcp-for-beginners\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4e3a MCP \u670d\u52a1\u5668\u63a5\u5165 OAuth2\uff1a\u57fa\u4e8e Spring Authorization Server \u4e0e Azure API Management \u7684\u5b8c\u6574\u5b9e\u6218\uff08mcp-for-beginners\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/114557.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4e3a MCP \u670d\u52a1\u5668\u63a5\u5165 OAuth2\uff1a\u57fa\u4e8e Spring Authorization Server \u4e0e Azure API Management \u7684\u5b8c\u6574\u5b9e\u6218\uff08mcp-for-beginners\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6559\u7a0b\u6587\u6863\u4eba\u5de5\u667a\u80fd \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011mcp-for-beginners This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for deve","og_url":"https:\/\/www.wsisp.com\/helps\/114557.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-09T06:24:58+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261009062457-6ac888b9804dc.svg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/114557.html","url":"https:\/\/www.wsisp.com\/helps\/114557.html","name":"\u4e3a MCP \u670d\u52a1\u5668\u63a5\u5165 OAuth2\uff1a\u57fa\u4e8e Spring Authorization Server \u4e0e Azure API Management \u7684\u5b8c\u6574\u5b9e\u6218\uff08mcp-for-beginners\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-09T06:24:58+00:00","dateModified":"2026-10-09T06:24:58+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/114557.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/114557.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/114557.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4e3a MCP \u670d\u52a1\u5668\u63a5\u5165 OAuth2\uff1a\u57fa\u4e8e Spring Authorization Server \u4e0e Azure API Management \u7684\u5b8c\u6574\u5b9e\u6218\uff08mcp-for-beginners\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/114557","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=114557"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/114557\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=114557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=114557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=114557"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=114557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}