{"id":82749,"date":"2026-07-25T12:16:53","date_gmt":"2026-07-25T04:16:53","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/82749.html"},"modified":"2026-07-25T12:16:53","modified_gmt":"2026-07-25T04:16:53","slug":"springboot3-openspec-%e5%ae%9e%e7%8e%b0-mcp-%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%ae%9e%e8%b7%b5","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/82749.html","title":{"rendered":"SpringBoot3 + OpenSpec \u5b9e\u73b0 MCP \u670d\u52a1\u5668\u5b9e\u8df5"},"content":{"rendered":"<p>\u672c\u6b21\u4e3b\u8981\u5206\u4eab OpenSpec \u7684\u6574\u4f53\u5f00\u53d1\u6d41\u7a0b&#xff0c;\u5e76\u4ee5 MCP \u5de5\u5177\u4f5c\u4e3a\u793a\u4f8b\u8fdb\u884c\u6f14\u793a\u3002\u8be5\u793a\u4f8b\u529f\u80fd\u7b80\u5355&#xff0c;\u4f46\u8986\u76d6\u4e86\u4ece\u9700\u6c42\u3001\u8bbe\u8ba1\u5230\u5b9e\u73b0\u7684\u5b8c\u6574\u8fc7\u7a0b&#xff0c;\u65e2\u80fd\u5e2e\u52a9\u7406\u89e3 OpenSpec \u7684\u4f7f\u7528\u65b9\u5f0f&#xff0c;\u4e5f\u80fd\u8ba9\u5927\u5bb6\u638c\u63e1 MCP \u5de5\u5177\u7684\u57fa\u672c\u5f00\u53d1\u6d41\u7a0b\u3002<\/p>\n<p>\u9996\u5148\u5bf9 MCP \u4e0e OpenSpec \u8fdb\u884c\u4e00\u70b9\u6982\u5ff5\u666e\u53ca\u3002<\/p>\n<h2>\u4e00\u3001MCP \u534f\u8bae\u7b80\u4ecb<\/h2>\n<p>MCP&#xff08;Model Context Protocol&#xff09; \u662f Anthropic \u63a8\u51fa\u7684\u5f00\u653e\u534f\u8bae&#xff0c;\u7528\u4e8e\u89c4\u8303 AI \u5e94\u7528\u4e0e\u5916\u90e8\u6570\u636e\u6e90\u7684\u4ea4\u4e92\u3002<\/p>\n<h4>\u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898<\/h4>\n<p>\u4f20\u7edf\u6a21\u5f0f\u4e0b&#xff0c;\u8ba9 AI \u8bbf\u95ee\u6570\u636e\u5e93\u3001\u6587\u4ef6\u7cfb\u7edf\u3001\u7b2c\u4e09\u65b9 API&#xff0c;\u6bcf\u63a5\u4e00\u4e2a\u6570\u636e\u6e90\u90fd\u8981\u5199\u4e00\u5957\u5bf9\u63a5\u4ee3\u7801&#xff1a;\u8ba4\u8bc1\u3001\u6570\u636e\u683c\u5f0f\u89e3\u6790\u3001\u9519\u8bef\u5904\u7406\u2026 \u91cd\u590d\u52b3\u52a8\u591a&#xff0c;\u7ef4\u62a4\u6210\u672c\u9ad8\u3002<\/p>\n<p>MCP \u89c4\u8303\u4e86\u4e00\u5957\u7edf\u4e00\u63a5\u53e3&#xff0c;\u6570\u636e\u6e90\u6309\u6807\u51c6\u5b9e\u73b0\u540e&#xff0c;AI \u5c31\u80fd\u76f4\u63a5\u8c03\u7528\u3002<\/p>\n<h4>\u6838\u5fc3\u80fd\u529b<\/h4>\n<p>Tools &#8211; AI \u53ef\u8c03\u7528\u7684\u51fd\u6570<\/p>\n<p>Resources &#8211; AI \u53ef\u8bfb\u53d6\u7684\u6570\u636e<\/p>\n<p>Prompts &#8211; \u9884\u5b9a\u4e49\u7684\u63d0\u793a\u6a21\u677f<\/p>\n<p>\u534f\u8bae\u672c\u8eab\u4e0e\u4f20\u8f93\u5c42\u65e0\u5173&#xff0c;JSON-RPC 2.0 \u683c\u5f0f\u901a\u4fe1\u3002<\/p>\n<h2>\u4e8c\u3001OpenSpec \u6d41\u7a0b\u7b80\u4ecb<\/h2>\n<p>OpenSpec \u662f\u4e00\u4e2a\u5de5\u4ef6\u9a71\u52a8\u7684\u5f00\u53d1\u65b9\u6cd5&#xff0c;\u901a\u8fc7\u7ed3\u6784\u5316\u7684\u6587\u6863\u89c4\u8303\u5f00\u53d1\u8fc7\u7a0b\u3002<\/p>\n<h4>\u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898<\/h4>\n<p>AI \u8f85\u52a9\u7f16\u7a0b\u65f6&#xff0c;\u7ecf\u5e38\u51fa\u73b0&#xff1a;\u9700\u6c42\u7406\u89e3\u504f\u5dee\u3001\u4ee3\u7801\u504f\u79bb\u539f\u59cb\u610f\u56fe\u3001\u540e\u671f\u9a8c\u8bc1\u56f0\u96be\u7b49\u95ee\u9898\u3002OpenSpec \u901a\u8fc7\u524d\u7f6e\u8bbe\u8ba1\u548c\u540e\u671f\u9a8c\u8bc1&#xff0c;\u51cf\u5c11 AI \u5f00\u53d1\u4e2d\u7684\u9700\u6c42\u504f\u5dee\u548c\u8fd4\u5de5\u3002<\/p>\n<h4>\u6838\u5fc3\u5de5\u4ef6<\/h4>\n<table>\n<tr>\u5de5\u4ef6\u63cf\u8ff0\u63d0\u793a\u8bcd<\/tr>\n<tbody>\n<tr>\n<td>Proposal<\/td>\n<td>\u8bbe\u8ba1\u63d0\u6848&#xff0c;\u8bb0\u5f55\u51b3\u7b56\u548c\u6743\u8861<\/td>\n<td>\u201c\u6211\u9700\u8981\u4e3a xxx \u529f\u80fd\u521b\u5efa\u4e00\u4e2a\u63d0\u6848&#xff0c;\u5305\u542b\u6280\u672f\u9009\u578b\u3001\u67b6\u6784\u8bbe\u8ba1\u51b3\u7b56\u201d<\/td>\n<\/tr>\n<tr>\n<td>Tasks<\/td>\n<td>\u4efb\u52a1\u62c6\u5206<\/td>\n<td>\u201c\u57fa\u4e8e\u4e0a\u9762\u7684\u63d0\u6848&#xff0c;\u5e2e\u6211\u62c6\u89e3\u6210\u5177\u4f53\u7684\u5f00\u53d1\u4efb\u52a1\u201d<\/td>\n<\/tr>\n<tr>\n<td>Design<\/td>\n<td>\u8be6\u7ec6\u8bbe\u8ba1<\/td>\n<td>\u201c\u57fa\u4e8e\u4efb\u52a1\u5217\u8868&#xff0c;\u5e2e\u6211\u8bbe\u8ba1\u7c7b\u7ed3\u6784\u3001\u63a5\u53e3\u5b9a\u4e49\u201d<\/td>\n<\/tr>\n<tr>\n<td>Implementation<\/td>\n<td>\u4ee3\u7801\u5b9e\u73b0<\/td>\n<td>\u201c\u6309\u7167\u8bbe\u8ba1\u6587\u6863&#xff0c;\u5b9e\u73b0\u5177\u4f53\u7684\u4ee3\u7801\u201d<\/td>\n<\/tr>\n<tr>\n<td>Verification<\/td>\n<td>\u9a8c\u8bc1\u5f52\u6863<\/td>\n<td>\u201c\u9a8c\u8bc1\u5b9e\u73b0\u662f\u5426\u5b8c\u6574&#xff0c;\u6574\u7406\u5f52\u6863\u201d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>OpenSpec \u6d41\u7a0b\u7684\u4ef7\u503c<\/h4>\n<p>\u5728 AI \u8f85\u52a9\u7f16\u7a0b\u573a\u666f\u4e0b&#xff0c;OpenSpec \u6d41\u7a0b\u80fd\u89e3\u51b3\u51e0\u4e2a\u5e38\u89c1\u95ee\u9898&#xff1a;<\/p>\n<ul>\n<li>\u907f\u514d\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u9700\u6c42\u6f02\u79fb<\/li>\n<li>\u6bcf\u4e00\u6b65\u90fd\u6709\u660e\u786e\u7684\u4ea7\u51fa\u7269<\/li>\n<li>\u540e\u671f\u9a8c\u8bc1\u6709\u636e\u53ef\u4f9d<\/li>\n<li>\u5f52\u6863\u540e\u53ef\u8ffd\u6eaf\u51b3\u7b56\u8fc7\u7a0b<\/li>\n<\/ul>\n<h2>\u4e09\u3001MCP\u5de5\u5177\u5f00\u53d1<\/h2>\n<h4>\u529f\u80fd\u76ee\u6807<\/h4>\n<p>\u7528 SpringBoot3 &#043; SSE \u5b9e\u73b0\u4e00\u4e2a\u57fa\u7840\u7684 MCP \u670d\u52a1\u5668 Demo&#xff1a;<\/p>\n<ul>\n<li>\u652f\u6301 Tools \u80fd\u529b<\/li>\n<li>\u4ee3\u7801\u7ed3\u6784\u6e05\u6670<\/li>\n<li>\u4fbf\u4e8e\u6f14\u793a\u548c\u8bb2\u89e3<\/li>\n<\/ul>\n<h4>OpenSpec \u5de5\u4ef6\u6e05\u5355<\/h4>\n<p>\u672c\u9879\u76ee\u5c06\u4ea7\u51fa\u4ee5\u4e0b\u5de5\u4ef6&#xff1a;<\/p>\n<table>\n<tr>\u5de5\u4ef6\u5185\u5bb9<\/tr>\n<tbody>\n<tr>\n<td>Proposal<\/td>\n<td>\u6280\u672f\u9009\u578b\u3001\u67b6\u6784\u8bbe\u8ba1\u51b3\u7b56<\/td>\n<\/tr>\n<tr>\n<td>Tasks<\/td>\n<td>\u4efb\u52a1\u62c6\u5206\u548c\u4f9d\u8d56\u5173\u7cfb<\/td>\n<\/tr>\n<tr>\n<td>Design<\/td>\n<td>\u7c7b\u8bbe\u8ba1\u3001\u63a5\u53e3\u5b9a\u4e49<\/td>\n<\/tr>\n<tr>\n<td>Implementation<\/td>\n<td>\u6838\u5fc3\u4ee3\u7801\u5b9e\u73b0<\/td>\n<\/tr>\n<tr>\n<td>Verification<\/td>\n<td>\u6d4b\u8bd5\u7ed3\u679c\u548c\u5f52\u6863<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u56db\u3001Proposal&#xff1a;\u8bbe\u8ba1\u63d0\u6848<\/h2>\n<h4>\u63d0\u793a\u8bcd\u6a21\u677f<\/h4>\n<p>\u6211\u60f3\u7528 SpringBoot3 &#043; SSE \u5b9e\u73b0\u4e00\u4e2a MCP \u670d\u52a1\u5668 Demo&#xff0c;\u5e2e\u6211\u521b\u5efa\u4e00\u4e2a\u63d0\u6848\u3002<\/p>\n<p>\u9700\u6c42&#xff1a;<br \/>\n&#8211; \u5b9e\u73b0 Tools \u80fd\u529b&#xff08;initialize\u3001tools\/list\u3001tools\/call&#xff09;<br \/>\n&#8211; \u63d0\u4f9b\u4e00\u4e2a\u793a\u4f8b\u5de5\u5177&#xff1a;\u67e5\u8be2\u65e5\u7a0b&#xff08;get_calendar_events&#xff09;<br \/>\n&#8211; \u4ee3\u7801\u7ed3\u6784\u6e05\u6670&#xff0c;\u4fbf\u4e8e\u6f14\u793a<\/p>\n<h4>\u6280\u672f\u9009\u578b\u51b3\u7b56<\/h4>\n<p>\u4f20\u8f93\u5c42\u9009\u578b<\/p>\n<p>\u6700\u521d\u8003\u8651\u4e86\u4e09\u79cd\u65b9\u6848&#xff1a;Stdio\u3001WebSocket\u3001SSE\u3002<\/p>\n<ul>\n<li>Stdio \u6700\u7b80\u5355&#xff0c;\u5b98\u65b9\u793a\u4f8b\u90fd\u7528\u8fd9\u4e2a&#xff0c;\u4f46\u6211\u4eec\u7684\u9879\u76ee\u662f Web \u5e94\u7528&#xff0c;\u96c6\u6210\u8d77\u6765\u4e0d\u591f\u81ea\u7136<\/li>\n<li>WebSocket \u529f\u80fd\u6700\u5f3a&#xff0c;\u53cc\u5411\u901a\u4fe1&#xff0c;\u4f46\u5b9e\u73b0\u76f8\u5bf9\u590d\u6742<\/li>\n<li>SSE \u57fa\u4e8e HTTP \u957f\u8fde\u63a5&#xff0c;\u5b9e\u73b0\u7b80\u5355&#xff0c;\u4e5f\u7b26\u5408 MCP \u7684\u63a8\u9001\u6a21\u5f0f<\/li>\n<\/ul>\n<p>\u672c\u793a\u4f8b\u9879\u76ee\u4f7f\u7528sse\u65b9\u6848\u3002<\/p>\n<h4>\u6838\u5fc3\u62bd\u8c61\u8bbe\u8ba1<\/h4>\n<p>MCP \u534f\u8bae\u5b9a\u4e49\u4e86\u591a\u79cd\u80fd\u529b&#xff0c;\u672c Demo \u5148\u805a\u7126 Tools&#xff08;\u5de5\u5177&#xff09;\u3002\u5de5\u5177\u662f AI \u53ef\u8c03\u7528\u7684\u51fd\u6570&#xff0c;\u540e\u7eed\u53ef\u6839\u636e\u9700\u6c42\u6269\u5c55\u3002<\/p>\n<h4>\u534f\u8bae\u65b9\u6cd5<\/h4>\n<p>\u521d\u6b65\u786e\u5b9a\u5b9e\u73b0\u4ee5\u4e0b\u65b9\u6cd5&#xff1a;<\/p>\n<p>initialize     &#8211; \u521d\u59cb\u5316\u63e1\u624b&#xff0c;\u534f\u5546\u534f\u8bae\u7248\u672c<br \/>\ntools\/list     &#8211; \u8fd4\u56de\u6240\u6709\u53ef\u7528\u5de5\u5177<br \/>\ntools\/call     &#8211; \u6267\u884c\u6307\u5b9a\u5de5\u5177<\/p>\n<hr \/>\n<h2>\u4e94\u3001Tasks&#xff1a;\u4efb\u52a1\u62c6\u5206<\/h2>\n<h4>\u63d0\u793a\u8bcd\u6a21\u677f<\/h4>\n<p>\u57fa\u4e8e\u4e0a\u9762\u7684\u63d0\u6848&#xff0c;\u5e2e\u6211\u62c6\u89e3\u6210\u5177\u4f53\u7684\u5f00\u53d1\u4efb\u52a1\u3002<\/p>\n<h4>\u7b2c\u4e00\u6b21\u62c6\u89e3<\/h4>\n<p>\u6839\u636e\u63d0\u6848&#xff0c;\u628a\u5f00\u53d1\u62c6\u6210\u4ee5\u4e0b\u4efb\u52a1&#xff1a;<\/p>\n<table>\n<tr>\u4efb\u52a1\u63cf\u8ff0\u4f9d\u8d56<\/tr>\n<tbody>\n<tr>\n<td>T1<\/td>\n<td>\u9879\u76ee\u521d\u59cb\u5316&#xff0c;\u6dfb\u52a0 Web\u3001SSE \u4f9d\u8d56<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>T2<\/td>\n<td>\u5b9e\u73b0 JSON-RPC \u534f\u8bae\u6a21\u578b<\/td>\n<td>T1<\/td>\n<\/tr>\n<tr>\n<td>T3<\/td>\n<td>\u5b9e\u73b0 SSE Controller<\/td>\n<td>T1<\/td>\n<\/tr>\n<tr>\n<td>T4<\/td>\n<td>\u5b9e\u73b0\u534f\u8bae\u8def\u7531\u5668<\/td>\n<td>T2, T3<\/td>\n<\/tr>\n<tr>\n<td>T5<\/td>\n<td>\u5b9e\u73b0 Tool \u63a5\u53e3\u548c\u6ce8\u518c\u4e2d\u5fc3<\/td>\n<td>T2<\/td>\n<\/tr>\n<tr>\n<td>T6<\/td>\n<td>\u5b9e\u73b0\u793a\u4f8b\u5de5\u5177<\/td>\n<td>T5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u516d\u3001Design&#xff1a;\u8be6\u7ec6\u8bbe\u8ba1<\/h2>\n<h4>\u63d0\u793a\u8bcd\u6a21\u677f<\/h4>\n<p>\u57fa\u4e8e\u4efb\u52a1\u5217\u8868&#xff0c;\u5e2e\u6211\u505a\u8be6\u7ec6\u8bbe\u8ba1&#xff1a;\u7c7b\u7ed3\u6784\u3001\u6838\u5fc3\u63a5\u53e3\u3001\u6570\u636e\u6d41\u8f6c\u3002<\/p>\n<h4>\u6574\u4f53\u67b6\u6784<\/h4>\n<p>                    AI Client<br \/>\n                        \u2502<br \/>\n                        SSE<br \/>\n                        \u2502<br \/>\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502         SpringBoot Server             \u2502<br \/>\n\u2502                                      \u2502<br \/>\n\u2502   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u2502<br \/>\n\u2502   \u2502     MCP Protocol Handler     \u2502   \u2502<br \/>\n\u2502   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518   \u2502<br \/>\n\u2502                    \u2502                  \u2502<br \/>\n\u2502   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502<br \/>\n\u2502   \u25bc               \u25bc               \u25bc \u2502<br \/>\n\u2502 Tool Registry  Resource Registry  Prompt \u2502<br \/>\n\u2502      \u2502              \u2502               \u2502    \u2502<br \/>\n\u2502      \u25bc              \u25bc               \u25bc    \u2502<br \/>\n\u2502   \u5de5\u5177\u5b9e\u73b0       \u8d44\u6e90\u5b9e\u73b0        \u63d0\u793a\u5b9e\u73b0   \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<h4>\u7c7b\u8bbe\u8ba1\u601d\u8003<\/h4>\n<p>\u534f\u8bae\u5c42<\/p>\n<ul>\n<li>JsonRpcRequest \/ JsonRpcResponse &#8211; \u7eaf\u7cb9\u7684 POJO&#xff0c;\u53ea\u505a\u5e8f\u5217\u5316\/\u53cd\u5e8f\u5217\u5316<\/li>\n<li>McpHandler &#8211; \u8d1f\u8d23\u8bf7\u6c42\u8def\u7531&#xff0c;\u4e0d\u5173\u5fc3\u4f20\u8f93\u7ec6\u8282<\/li>\n<\/ul>\n<p>\u6ce8\u518c\u4e2d\u5fc3<\/p>\n<ul>\n<li>ToolRegistry &#8211; \u5de5\u5177\u6ce8\u518c\u4e2d\u5fc3&#xff0c;\u5229\u7528 Spring \u7684 List&lt;Tool&gt; \u81ea\u52a8\u6ce8\u5165<\/li>\n<li>\u8fd9\u6837\u7684\u597d\u5904\u662f\u65b0\u589e\u5de5\u5177\u53ea\u9700\u5199\u4e00\u4e2a\u7c7b&#xff0c;\u4e0d\u7528\u6539\u914d\u7f6e<\/li>\n<\/ul>\n<p>Controller<\/p>\n<ul>\n<li>\u63a5\u6536 HTTP POST \u8bf7\u6c42<\/li>\n<li>\u8fd4\u56de SseEmitter \u5b9e\u73b0\u670d\u52a1\u7aef\u63a8\u9001<\/li>\n<li>\u8d85\u65f6\u65f6\u95f4\u8bbe\u4e3a 60 \u79d2<\/li>\n<\/ul>\n<h4>\u5de5\u5177\u63a5\u53e3\u8bbe\u8ba1<\/h4>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">interface<\/span> <span class=\"token class-name\">McpTool<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token class-name\">String<\/span> <span class=\"token function\">getName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>           <span class=\"token comment\">\/\/ \u5de5\u5177\u540d\u5b57<\/span><br \/>\n    <span class=\"token class-name\">String<\/span> <span class=\"token function\">getDescription<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>    <span class=\"token comment\">\/\/ \u63cf\u8ff0&#xff0c;\u544a\u8bc9 AI \u4ec0\u4e48\u65f6\u5019\u7528\u5b83<\/span><br \/>\n    <span class=\"token class-name\">Map<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">Object<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> <span class=\"token function\">getInputSchema<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u53c2\u6570\u683c\u5f0f<\/span><br \/>\n    <span class=\"token class-name\">String<\/span> <span class=\"token function\">execute<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Map<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">Object<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> arguments<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6267\u884c\u903b\u8f91<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h2>\u4e03\u3001Implementation&#xff1a;\u5b9e\u73b0<\/h2>\n<h4>\u63d0\u793a\u8bcd\u6a21\u677f<\/h4>\n<p>\u6309\u7167\u8bbe\u8ba1\u6587\u6863&#xff0c;\u5b9e\u73b0\u4ee5\u4e0b\u529f\u80fd&#xff1a;<br \/>\n1. JSON-RPC \u534f\u8bae\u6a21\u578b&#xff08;JsonRpcRequest\u3001JsonRpcResponse&#xff09;<br \/>\n2. \u534f\u8bae\u5904\u7406\u5668&#xff08;initialize\u3001tools\/list\u3001tools\/call&#xff09;<br \/>\n3. SSE Controller&#xff08;SseEmitter&#xff09;<br \/>\n4. Tool \u63a5\u53e3\u548c\u6ce8\u518c\u4e2d\u5fc3<br \/>\n5. \u65e5\u7a0b\u67e5\u8be2\u5de5\u5177&#xff08;GetCalendarEventsTool&#xff09;&#xff0c;\u6839\u636e\u65e5\u671f\u67e5\u8be2\u65e5\u7a0b<\/p>\n<p>\u4f7f\u7528 SpringBoot3 &#043; Spring Web&#xff0c;\u7528 &#064;Component\u3001&#064;Autowired \u8fdb\u884c\u4f9d\u8d56\u6ce8\u5165\u3002<\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u5747\u7531AI\u6839\u636e\u63d0\u6848\u76f8\u5173\u5185\u5bb9\u751f\u6210&#xff0c;\u6b64\u5904\u4e3b\u8981\u4e3a\u4e86\u65b9\u4fbf\u7406\u89e3\u8d34\u51fa\u4e86\u90e8\u5206\u5173\u952e\u4ee3\u7801\u3002<\/p>\n<h4>7.1 \u9879\u76ee\u521d\u59cb\u5316<\/h4>\n<p>\u7528 start.spring.io \u751f\u6210\u9879\u76ee\u9aa8\u67b6&#xff0c;\u6dfb\u52a0\u4e86 Spring Web \u4f9d\u8d56\u3002<\/p>\n<h4>7.2 JSON-RPC \u534f\u8bae\u6a21\u578b<\/h4>\n<p>\u534f\u8bae\u683c\u5f0f\u662f MCP \u89c4\u8303\u5b9a\u4e49\u597d\u7684&#xff0c;\u76f4\u63a5\u7167\u642c&#xff1a;<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">JsonRpcRequest<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token class-name\">String<\/span> jsonrpc <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;2.0&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token class-name\">String<\/span> method<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token class-name\">Object<\/span> params<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token class-name\">Object<\/span> id<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>7.3 \u534f\u8bae\u5904\u7406\u5668\u7684\u5b9e\u73b0<\/h4>\n<p>\u8fd9\u90e8\u5206\u662f\u6838\u5fc3&#xff0c;\u8def\u7531\u903b\u8f91\u5982\u4e0b&#xff1a;<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token class-name\">JsonRpcResponse<\/span> <span class=\"token function\">handle<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">JsonRpcRequest<\/span> request<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token keyword\">switch<\/span> <span class=\"token punctuation\">(<\/span>request<span class=\"token punctuation\">.<\/span><span class=\"token function\">getMethod<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">case<\/span> <span class=\"token string\">&#034;initialize&#034;<\/span> <span class=\"token operator\">-&gt;<\/span> <span class=\"token function\">handleInitialize<\/span><span class=\"token punctuation\">(<\/span>request<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">case<\/span> <span class=\"token string\">&#034;tools\/list&#034;<\/span> <span class=\"token operator\">-&gt;<\/span> <span class=\"token function\">handleListTools<\/span><span class=\"token punctuation\">(<\/span>request<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">case<\/span> <span class=\"token string\">&#034;tools\/call&#034;<\/span> <span class=\"token operator\">-&gt;<\/span> <span class=\"token function\">handleCallTool<\/span><span class=\"token punctuation\">(<\/span>request<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">default<\/span> <span class=\"token operator\">-&gt;<\/span> <span class=\"token class-name\">JsonRpcResponse<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">error<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token number\">32601<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;\u65b9\u6cd5\u4e0d\u5b58\u5728&#034;<\/span><span class=\"token punctuation\">,<\/span> request<span class=\"token punctuation\">.<\/span><span class=\"token function\">getId<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>7.4 SSE \u63a5\u53e3<\/h4>\n<p>SSE \u63a5\u53e3\u5b9e\u73b0&#xff1a;<\/p>\n<p><span class=\"token annotation punctuation\">&#064;PostMapping<\/span><span class=\"token punctuation\">(<\/span>value <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;\/mcp&#034;<\/span><span class=\"token punctuation\">,<\/span> produces <span class=\"token operator\">&#061;<\/span> <span class=\"token class-name\">MediaType<\/span><span class=\"token punctuation\">.<\/span><span class=\"token constant\">TEXT_EVENT_STREAM_VALUE<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token class-name\">ResponseBodyEmitter<\/span> <span class=\"token function\">handle<\/span><span class=\"token punctuation\">(<\/span><span class=\"token annotation punctuation\">&#064;RequestBody<\/span> <span class=\"token class-name\">JsonRpcRequest<\/span> request<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token class-name\">SseEmitter<\/span> emitter <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">SseEmitter<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">60_000L<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token class-name\">CompletableFuture<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">runAsync<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">-&gt;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token class-name\">JsonRpcResponse<\/span> response <span class=\"token operator\">&#061;<\/span> mcpHandler<span class=\"token punctuation\">.<\/span><span class=\"token function\">handle<\/span><span class=\"token punctuation\">(<\/span>request<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            emitter<span class=\"token punctuation\">.<\/span><span class=\"token function\">send<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">SseEmitter<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">event<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n                    <span class=\"token punctuation\">.<\/span><span class=\"token function\">data<\/span><span class=\"token punctuation\">(<\/span>objectMapper<span class=\"token punctuation\">.<\/span><span class=\"token function\">writeValueAsString<\/span><span class=\"token punctuation\">(<\/span>response<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            emitter<span class=\"token punctuation\">.<\/span><span class=\"token function\">complete<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">catch<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Exception<\/span> e<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            emitter<span class=\"token punctuation\">.<\/span><span class=\"token function\">completeWithError<\/span><span class=\"token punctuation\">(<\/span>e<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> emitter<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>7.5 \u5de5\u5177\u6ce8\u518c<\/h4>\n<p>\u5229\u7528 Spring \u7684\u4f9d\u8d56\u6ce8\u5165&#xff1a;<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Component<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">ToolRegistry<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">final<\/span> <span class=\"token class-name\">Map<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">Tool<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> tools <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">ConcurrentHashMap<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;Autowired<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">registerAllTools<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">List<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">Tool<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> toolList<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        toolList<span class=\"token punctuation\">.<\/span><span class=\"token function\">forEach<\/span><span class=\"token punctuation\">(<\/span>tool <span class=\"token operator\">-&gt;<\/span> tools<span class=\"token punctuation\">.<\/span><span class=\"token function\">put<\/span><span class=\"token punctuation\">(<\/span>tool<span class=\"token punctuation\">.<\/span><span class=\"token function\">getName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> tool<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd9\u6837\u6240\u6709\u5b9e\u73b0 Tool \u63a5\u53e3\u7684 &#064;Component \u90fd\u4f1a\u81ea\u52a8\u6ce8\u518c\u8fdb\u6765\u3002<\/p>\n<h4>7.6 \u793a\u4f8b\u5de5\u5177<\/h4>\n<p>\u5199\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u65e5\u7a0b\u67e5\u8be2\u5de5\u5177&#xff1a;<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Component<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">GetCalendarEventsTool<\/span> <span class=\"token keyword\">implements<\/span> <span class=\"token class-name\">Tool<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token class-name\">String<\/span> <span class=\"token function\">getName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token string\">&#034;get_calendar_events&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token class-name\">String<\/span> <span class=\"token function\">getDescription<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token string\">&#034;\u67e5\u8be2\u6307\u5b9a\u65e5\u671f\u7684\u65e5\u5386\u4e8b\u4ef6&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token class-name\">String<\/span> <span class=\"token function\">execute<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Map<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">Object<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> arguments<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">String<\/span> date <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">)<\/span> arguments<span class=\"token punctuation\">.<\/span><span class=\"token function\">get<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;date&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token string\">&#034;2026-02-10 \u6709 3 \u4e2a\u4f1a\u8bae&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h2>\u516b\u3001Verification&#xff1a;\u9a8c\u8bc1\u4e0e\u5f52\u6863<\/h2>\n<h4>\u63d0\u793a\u8bcd\u6a21\u677f<\/h4>\n<p>\u9a8c\u8bc1\u5b9e\u73b0\u662f\u5426\u5b8c\u6574&#xff0c;\u5e2e\u6211\u751f\u6210\u5f52\u6863\u62a5\u544a\u3002<\/p>\n<p>\u9700\u8981\u9a8c\u8bc1&#xff1a;<br \/>\n&#8211; JSON-RPC \u534f\u8bae\u89e3\u6790\u548c\u54cd\u5e94&#xff08;initialize\u3001tools\/list\u3001tools\/call&#xff09;<br \/>\n&#8211; SSE \u4f20\u8f93\u5c42<br \/>\n&#8211; \u65e5\u7a0b\u67e5\u8be2\u5de5\u5177&#xff08;get_calendar_events&#xff09;\u8c03\u7528<\/p>\n<h4>\u6d4b\u8bd5\u7ed3\u679c<\/h4>\n<p>\u6b63\u5411\u6d4b\u8bd5<\/p>\n<p>\u2192 POST \/mcp {&#034;method&#034;:&#034;tools\/list&#034;,&#034;id&#034;:1}<br \/>\n\u2190 {&#034;jsonrpc&#034;:&#034;2.0&#034;,&#034;result&#034;:{&#034;tools&#034;:[{&#034;name&#034;:&#034;get_calendar_events&#034;,&#8230;}]},&#034;id&#034;:1}<\/p>\n<p>\u2192 POST \/mcp {&#034;method&#034;:&#034;tools\/call&#034;,&#034;params&#034;:{&#034;name&#034;:&#034;get_calendar_events&#034;,&#034;arguments&#034;:{&#034;date&#034;:&#034;2026-02-10&#034;}},&#034;id&#034;:2}<br \/>\n\u2190 {&#034;jsonrpc&#034;:&#034;2.0&#034;,&#034;result&#034;:{&#034;content&#034;:[{&#034;type&#034;:&#034;text&#034;,&#034;text&#034;:&#034;&#8230;&#034;}]},&#034;id&#034;:2}<\/p>\n<p>\u5f02\u5e38\u6d4b\u8bd5<\/p>\n<p>\u2192 POST \/mcp {&#034;method&#034;:&#034;unknown&#034;,&#034;id&#034;:1}<br \/>\n\u2190 {&#034;jsonrpc&#034;:&#034;2.0&#034;,&#034;error&#034;:{&#034;code&#034;:-32601,&#034;message&#034;:&#034;\u65b9\u6cd5\u4e0d\u5b58\u5728&#034;},&#034;id&#034;:1}<\/p>\n<h4>\u5f52\u6863<\/h4>\n<p>openspec archive &#8211;change &#034;&lt;change-name&gt;&#034;<\/p>\n<hr \/>\n<h2>\u4e5d\u3001\u5728 Claude Code \u4e2d\u6d4b\u8bd5 MCP \u670d\u52a1\u5668<\/h2>\n<h4>\u524d\u7f6e\u6761\u4ef6<\/h4>\n<p>\u786e\u4fdd MCP \u670d\u52a1\u5668\u5df2\u542f\u52a8&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u7f16\u8bd1\u5e76\u542f\u52a8 SpringBoot \u5e94\u7528<\/span><br \/>\n.\/gradlew bootRun<\/p>\n<p><span class=\"token comment\"># \u670d\u52a1\u5668\u9ed8\u8ba4\u5728 http:\/\/localhost:8080 \u8fd0\u884c<\/span><\/p>\n<h4>\u914d\u7f6e\u65b9\u6cd5<\/h4>\n<p>SSE \u65b9\u5f0f\u9700\u8981\u5728 MCP \u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u5efa\u7acb HTTP \u8fde\u63a5\u3002\u4e00\u79cd\u7b80\u5355\u65b9\u5f0f\u662f\u4f7f\u7528 npx \u76f4\u63a5\u8c03\u7528&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u542f\u52a8 MCP \u670d\u52a1\u5668&#xff08;\u53e6\u4e00\u4e2a\u7ec8\u7aef&#xff09;<\/span><\/p>\n<p><span class=\"token comment\"># \u6dfb\u52a0MCP\u670d\u52a1<\/span><br \/>\nclaude mcp <span class=\"token function\">add<\/span> <span class=\"token parameter variable\">&#8211;transport<\/span> http <span class=\"token parameter variable\">&#8211;scope<\/span> user calendar-mcp http:\/\/localhost:8080\/mcp<\/p>\n<h4>\u5728 Claude Code \u4e2d\u4f7f\u7528<\/h4>\n<li>\u786e\u4fdd MCP \u670d\u52a1\u5668\u5df2\u542f\u52a8\u8fd0\u884c<\/li>\n<li>\u5728 Claude Code \u5bf9\u8bdd\u4e2d\u76f4\u63a5\u6d4b\u8bd5&#xff1a;\u8bf7\u8c03\u7528 get_calendar_events \u5de5\u5177&#xff0c;\u67e5\u8be2\u4eca\u5929\u7684\u65e5\u7a0b\n<\/li>\n<li>\u5982\u679c\u914d\u7f6e\u6b63\u786e&#xff0c;Claude Code \u4f1a\u81ea\u52a8\u53d1\u73b0\u53ef\u7528\u5de5\u5177\u5e76\u8c03\u7528<\/li>\n<h4>\u9a8c\u8bc1\u6b65\u9aa4<\/h4>\n<li>\u670d\u52a1\u5668\u542f\u52a8\u540e&#xff0c;\u786e\u8ba4\u63a7\u5236\u53f0\u8f93\u51fa Started McpServerApplication in x seconds<\/li>\n<li>\u6d4b\u8bd5\u63a5\u53e3\u662f\u5426\u6b63\u5e38\u8fd4\u56de&#xff1a;<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-X<\/span> POST http:\/\/localhost:8080\/mcp <span class=\"token punctuation\">\\\\<\/span><br \/>\n  <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#034;Content-Type: application\/json&#034;<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n  <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;{&#034;jsonrpc&#034;:&#034;2.0&#034;,&#034;method&#034;:&#034;tools\/list&#034;,&#034;id&#034;:1}&#039;<\/span><\/p>\n<\/li>\n<h4>\u9a8c\u8bc1\u914d\u7f6e<\/h4>\n<li>\u91cd\u542f Claude Code<\/li>\n<li>\u5bf9\u8bdd\u4e2d\u5c1d\u8bd5\u8c03\u7528\u5de5\u5177&#xff1a;\n<ul>\n<li>\u201c\u5217\u51fa\u6240\u6709\u53ef\u7528\u5de5\u5177\u201d<\/li>\n<li>\u201c\u67e5\u8be2\u4eca\u5929\u7684\u65e5\u7a0b\u201d<\/li>\n<\/ul>\n<\/li>\n<li>\u5982\u679c\u5de5\u5177\u6b63\u5e38\u8fd4\u56de&#xff0c;\u8bf4\u660e MCP \u670d\u52a1\u5668\u914d\u7f6e\u6210\u529f<\/li>\n<h2>\u5341\u3001\u603b\u7ed3<\/h2>\n<p>\u672c\u6587\u57fa\u4e8e SpringBoot3 \u548c SSE \u5b9e\u73b0\u6700\u5c0f\u53ef\u7528 MCP \u670d\u52a1\u5668&#xff0c;\u5e76\u901a\u8fc7 OpenSpec \u5de5\u4ef6\u9a71\u52a8\u6d41\u7a0b&#xff0c;\u4ece\u63d0\u6848\u5230\u5b9e\u73b0\u5b8c\u6574\u6f14\u793a AI \u8f85\u52a9\u540e\u7aef\u5f00\u53d1\u7684\u6280\u672f\u843d\u5730\u5b9e\u8df5&#xff0c;\u5e0c\u671b\u548c\u80fd\u7ed9\u5927\u5bb6\u4e00\u4e9b\u5173\u4e8eOpenSpec \u4e0e MCP \u5f00\u53d1\u4f7f\u7528\u7684\u53c2\u8003\u3002<\/p>\n<p>https:\/\/github.com\/yuboon\/ai-examples\/tree\/main\/002-springboot-mcp<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6b21\u4e3b\u8981\u5206\u4eab OpenSpec \u7684\u6574\u4f53\u5f00\u53d1\u6d41\u7a0b&#xff0c;\u5e76\u4ee5 MCP \u5de5\u5177\u4f5c\u4e3a\u793a\u4f8b\u8fdb\u884c\u6f14\u793a\u3002\u8be5\u793a\u4f8b\u529f\u80fd\u7b80\u5355&#xff0c;\u4f46\u8986\u76d6\u4e86\u4ece\u9700\u6c42\u3001\u8bbe\u8ba1\u5230\u5b9e\u73b0\u7684\u5b8c\u6574\u8fc7\u7a0b&#xff0c;\u65e2\u80fd\u5e2e\u52a9\u7406\u89e3 OpenSpec \u7684\u4f7f\u7528\u65b9\u5f0f&#xff0c;\u4e5f\u80fd\u8ba9\u5927\u5bb6\u638c\u63e1 MCP \u5de5\u5177\u7684\u57fa\u672c\u5f00\u53d1\u6d41\u7a0b\u3002<br \/>\n\u9996\u5148\u5bf9 MCP \u4e0e OpenSpec \u8fdb\u884c\u4e00\u70b9\u6982\u5ff5\u666e\u53ca\u3002<br \/>\n\u4e00\u3001MCP \u534f\u8bae\u7b80\u4ecb<br \/>\nMCP&#xff08;Model Context Protocol&#xff09; \u662f Anthropic \u63a8\u51fa\u7684\u5f00<\/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":[99,98,292],"topic":[],"class_list":["post-82749","post","type-post","status-publish","format-standard","hentry","category-server","tag-java","tag-spring-boot","tag-292"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SpringBoot3 + OpenSpec \u5b9e\u73b0 MCP \u670d\u52a1\u5668\u5b9e\u8df5 - \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\/82749.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SpringBoot3 + OpenSpec \u5b9e\u73b0 MCP \u670d\u52a1\u5668\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6b21\u4e3b\u8981\u5206\u4eab OpenSpec \u7684\u6574\u4f53\u5f00\u53d1\u6d41\u7a0b&#xff0c;\u5e76\u4ee5 MCP \u5de5\u5177\u4f5c\u4e3a\u793a\u4f8b\u8fdb\u884c\u6f14\u793a\u3002\u8be5\u793a\u4f8b\u529f\u80fd\u7b80\u5355&#xff0c;\u4f46\u8986\u76d6\u4e86\u4ece\u9700\u6c42\u3001\u8bbe\u8ba1\u5230\u5b9e\u73b0\u7684\u5b8c\u6574\u8fc7\u7a0b&#xff0c;\u65e2\u80fd\u5e2e\u52a9\u7406\u89e3 OpenSpec \u7684\u4f7f\u7528\u65b9\u5f0f&#xff0c;\u4e5f\u80fd\u8ba9\u5927\u5bb6\u638c\u63e1 MCP \u5de5\u5177\u7684\u57fa\u672c\u5f00\u53d1\u6d41\u7a0b\u3002 \u9996\u5148\u5bf9 MCP \u4e0e OpenSpec \u8fdb\u884c\u4e00\u70b9\u6982\u5ff5\u666e\u53ca\u3002 \u4e00\u3001MCP \u534f\u8bae\u7b80\u4ecb MCP&#xff08;Model Context Protocol&#xff09; \u662f Anthropic \u63a8\u51fa\u7684\u5f00\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/82749.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-25T04:16:53+00:00\" \/>\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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/82749.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/82749.html\",\"name\":\"SpringBoot3 + OpenSpec \u5b9e\u73b0 MCP \u670d\u52a1\u5668\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-25T04:16:53+00:00\",\"dateModified\":\"2026-07-25T04:16:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/82749.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/82749.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/82749.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SpringBoot3 + OpenSpec \u5b9e\u73b0 MCP \u670d\u52a1\u5668\u5b9e\u8df5\"}]},{\"@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":"SpringBoot3 + OpenSpec \u5b9e\u73b0 MCP \u670d\u52a1\u5668\u5b9e\u8df5 - \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\/82749.html","og_locale":"zh_CN","og_type":"article","og_title":"SpringBoot3 + OpenSpec \u5b9e\u73b0 MCP \u670d\u52a1\u5668\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u672c\u6b21\u4e3b\u8981\u5206\u4eab OpenSpec \u7684\u6574\u4f53\u5f00\u53d1\u6d41\u7a0b&#xff0c;\u5e76\u4ee5 MCP \u5de5\u5177\u4f5c\u4e3a\u793a\u4f8b\u8fdb\u884c\u6f14\u793a\u3002\u8be5\u793a\u4f8b\u529f\u80fd\u7b80\u5355&#xff0c;\u4f46\u8986\u76d6\u4e86\u4ece\u9700\u6c42\u3001\u8bbe\u8ba1\u5230\u5b9e\u73b0\u7684\u5b8c\u6574\u8fc7\u7a0b&#xff0c;\u65e2\u80fd\u5e2e\u52a9\u7406\u89e3 OpenSpec \u7684\u4f7f\u7528\u65b9\u5f0f&#xff0c;\u4e5f\u80fd\u8ba9\u5927\u5bb6\u638c\u63e1 MCP \u5de5\u5177\u7684\u57fa\u672c\u5f00\u53d1\u6d41\u7a0b\u3002 \u9996\u5148\u5bf9 MCP \u4e0e OpenSpec \u8fdb\u884c\u4e00\u70b9\u6982\u5ff5\u666e\u53ca\u3002 \u4e00\u3001MCP \u534f\u8bae\u7b80\u4ecb MCP&#xff08;Model Context Protocol&#xff09; \u662f Anthropic \u63a8\u51fa\u7684\u5f00","og_url":"https:\/\/www.wsisp.com\/helps\/82749.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-25T04:16:53+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/82749.html","url":"https:\/\/www.wsisp.com\/helps\/82749.html","name":"SpringBoot3 + OpenSpec \u5b9e\u73b0 MCP \u670d\u52a1\u5668\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-25T04:16:53+00:00","dateModified":"2026-07-25T04:16:53+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/82749.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/82749.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/82749.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"SpringBoot3 + OpenSpec \u5b9e\u73b0 MCP \u670d\u52a1\u5668\u5b9e\u8df5"}]},{"@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\/82749","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=82749"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/82749\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=82749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=82749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=82749"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=82749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}