@@ -32,11 +32,26 @@ The project enables developers to:
3232Provides OAuth 2.0 resource server capabilities for MCP servers.
3333This module is compatible with Spring WebMVC-based servers only.
3434
35- ### Usage
35+ ### Add to your project
36+
37+ * Maven*
38+
39+ ``` xml
40+
41+ <dependency >
42+ <groupId >org.springaicommunity</groupId >
43+ <artifactId >mcp-server-security</artifactId >
44+ <version >0.0.1</version >
45+ </dependency >
46+ ```
47+
48+ * Gradle*
3649
37- To configure, import the dependency in your project.
50+ ``` groovy
51+ implementation("org.springaicommunity:mcp-server-security:0.0.1")
52+ ```
3853
39- // TODO: add import instructions for both maven and gradle
54+ ### Usage
4055
4156Ensure that MCP server is enabled in your ` application.properties ` :
4257
@@ -57,10 +72,11 @@ In this example, we have set the authz server's issuer URI in the well known Spr
5772@EnableWebSecurity
5873class McpServerConfiguration {
5974
75+ @Value (" ${spring.security.oauth2.resourceserver.jwt.issuer-uri}" )
76+ private String issuerUrl;
77+
6078 @Bean
61- SecurityFilterChain securityFilterChain (HttpSecurity http ,
62- @Value (" ${spring.security.oauth2.resourceserver.jwt.issuer-uri}" ) String issuerUrl
63- ) throws Exception {
79+ SecurityFilterChain securityFilterChain (HttpSecurity http ) throws Exception {
6480 return http
6581 // Enforce authentication with token on EVERY request
6682 .authorizeHttpRequests(auth - > auth. anyRequest(). authenticated())
@@ -95,14 +111,15 @@ It is also possible to secure the tools only, and not the rest of the MCP Server
95111@EnableMethodSecurity // ⚠ enable annotation-driven security
96112class McpServerConfiguration {
97113
114+ @Value (" ${spring.security.oauth2.resourceserver.jwt.issuer-uri}" )
115+ private String issuerUrl;
116+
98117 @Bean
99- SecurityFilterChain securityFilterChain (HttpSecurity http ,
100- @Value (" ${spring.security.oauth2.resourceserver.jwt.issuer-uri}" ) String issuerUrl
101- ) throws Exception {
118+ SecurityFilterChain securityFilterChain (HttpSecurity http ) throws Exception {
102119 return http
103120 // Open every request on the server
104- .authorizeHttpRequests(auth - > auth. anyRequest(). permitAll()) // ⚠
105- // Configure OAuth2 on the MCP server
121+ .authorizeHttpRequests(auth - > auth. anyRequest(). permitAll())
122+ // ⚠ Configure OAuth2 on the MCP server
106123 .with(
107124 McpResourceServerConfigurer . mcpServerAuthorization(),
108125 (mcpAuthorization) - > {
@@ -169,9 +186,22 @@ This module supports `McpSyncClient`s only.
169186
170187### Add to your project
171188
172- To configure, import the dependency in your project.
189+ * Maven*
190+
191+ ``` xml
192+
193+ <dependency >
194+ <groupId >org.springaicommunity</groupId >
195+ <artifactId >mcp-client-security</artifactId >
196+ <version >0.0.1</version >
197+ </dependency >
198+ ```
173199
174- // TODO: add import instructions for both maven and gradle
200+ * Gradle*
201+
202+ ``` groovy
203+ implementation("org.springaicommunity:mcp-client-security:0.0.1")
204+ ```
175205
176206### Authorization flows
177207
@@ -352,11 +382,25 @@ with the RFCs and features relevant to the MCP authorization spec, such as Dynam
352382Indicators.
353383It provides a simple configurer for an MCP server.
354384
355- ### Usage
385+ ### Add to your project
386+
387+ * Maven*
388+
389+ ``` xml
390+ <dependency >
391+ <groupId >org.springaicommunity</groupId >
392+ <artifactId >mcp-authorization-server</artifactId >
393+ <version >0.0.1</version >
394+ </dependency >
395+ ```
356396
357- To configure, import the dependency in your project.
397+ * Gradle *
358398
359- // TODO: add import instructions for both maven and gradle
399+ ``` groovy
400+ implementation("org.springaicommunity:mcp-authorization-server:0.0.1")
401+ ```
402+
403+ ### Usage
360404
361405Then configure the authorization server (
362406see [ reference documentatio] ( https://docs.spring.io/spring-security/reference/7.0/servlet/oauth2/authorization-server/getting-started.html#oauth2AuthorizationServer-developing-your-first-application ) ).
0 commit comments