一个由Spring AI驱动的Spring Boot HTTP MCP(模型上下文协议)服务器。作为OAuth2资源服务器(JWT)进行安全保护,具有基于组和范围的授权、内置的Jira工具以及与外部Atlassian Token Broker集成的功能。
POST /mcp上通过HTTP进行JSON-RPC通信weather_lookupgroups → GROUP_<name> roles → ROLE_<role> 权限;范围 → SCOPE_<scope>ssl配置文件使用PKCS12密钥库;TLS 1.2/1.3注意:操作系统环境变量优先于
.env文件中的设置。
# JWT验证(根据您的IdP选择以下之一)
JWK_SET_URI=https://your-issuer/.well-known/jwks.json
# 或
ISSUER_URI=https://your-issuer
# Jira工具
JIRA_URL_TEMPLATE=https://your-domain.atlassian.net/browse/{key}
ATLASSIAN_TOKEN_BROKER_URL=https://your-token-broker.example.com/broker/atlassian/token
ATLASSIAN_TOKEN_BROKER_ISSUER_URI=https://your-authz-server/oauth2/token
ATLASSIAN_TOKEN_BROKER_CLIENT_ID=your-client-id
ATLASSIAN_TOKEN_BROKER_CLIENT_SECRET=your-client-secret
JIRA_CLOUD_ID_PATH=/path/to/your/cloud-id
注意:操作系统环境变量优先于
.env文件中的设置。
# 构建
./mvnw clean verify
# 运行(默认配置文件)
./mvnw spring-boot:run
提示:要启用本地HTTPS,请使用配置文件
prod,ssl运行: ./mvnw spring-boot:run -Dspring-boot.run.profiles=prod,ssl
发送MCP初始化请求(替换占位符):
curl -k \
-H "Authorization: Bearer <YOUR_JWT_ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-X POST https://localhost:9443/mcp \
-d '{
"jsonrpc": "2.0",
"id": "1",
"method": "initialize",
"params": {"protocolVersion": "2024-11-05", "client": {"name": "curl", "version": "1.0"}}
}'
为了获得更丰富的客户端体验,请参阅客户端,了解MCP Inspector和Claude Desktop示例。
参见:
准备好使用MCP构建了吗?请参阅快速开始。