{"id":99826,"date":"2026-09-03T11:41:14","date_gmt":"2026-09-03T03:41:14","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/99826.html"},"modified":"2026-09-03T11:41:14","modified_gmt":"2026-09-03T03:41:14","slug":"mcp-%e5%8d%8f%e8%ae%ae%e5%bc%80%e5%8f%91%e5%ae%9e%e6%88%98%ef%bc%9a%e4%bb%8e%e9%9b%b6%e6%90%ad%e5%bb%ba-ai-agent-%e5%b7%a5%e5%85%b7%e9%93%be","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/99826.html","title":{"rendered":"MCP \u534f\u8bae\u5f00\u53d1\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa AI Agent \u5de5\u5177\u94fe"},"content":{"rendered":"<h3>1. \u5f15\u8a00<\/h3>\n<p>TL;DR&#xff1a;\u9762\u5411 Python \u5f00\u53d1\u8005&#xff0c;\u4ece\u96f6\u638c\u63e1 MCP \u534f\u8bae&#xff0c;\u624b\u628a\u624b\u642d\u5efa MCP Server \u4e0e Agent \u5ba2\u6237\u7aef&#xff0c;\u5b8c\u6210\u300c\u667a\u80fd\u8fd0\u7ef4\u52a9\u624b\u300d\u5b9e\u6218&#xff0c;\u5feb\u901f\u843d\u5730\u53ef\u590d\u7528\u7684 AI Agent \u5de5\u5177\u94fe\u3002<\/p>\n<p>\u5173\u952e\u8bcd&#xff1a;MCP\u3000AI Agent\u3000Python\u3000Streamable HTTP\u3000\u5de5\u5177\u94fe<\/p>\n<p>\u968f\u7740\u5927\u8bed\u8a00\u6a21\u578b\u80fd\u529b\u7684\u5feb\u901f\u63d0\u5347&#xff0c;AI Agent \u7684\u5e94\u7528\u573a\u666f\u8d8a\u6765\u8d8a\u5e7f\u6cdb\u3002\u7136\u800c&#xff0c;\u6a21\u578b\u672c\u8eab\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u5916\u90e8\u6570\u636e\u6e90\u3001\u8c03\u7528\u4e1a\u52a1\u7cfb\u7edf\u6216\u64cd\u4f5c\u672c\u5730\u6587\u4ef6&#xff0c;\u8fd9\u6210\u4e3a Agent \u843d\u5730\u7684\u6838\u5fc3\u74f6\u9888\u3002MCP&#xff08;Model Context Protocol&#xff0c;\u6a21\u578b\u4e0a\u4e0b\u6587\u534f\u8bae&#xff09;\u6b63\u662f\u4e3a\u89e3\u51b3\u8fd9\u4e00\u95ee\u9898\u800c\u8bde\u751f\u7684\u5f00\u653e\u6807\u51c6\u3002<\/p>\n<p>MCP \u7684\u4ef7\u503c\u5728\u4e8e\u7edf\u4e00\u4e86 Agent \u4e0e\u5916\u90e8\u5de5\u5177\u3001\u6570\u636e\u6e90\u7684\u63a5\u5165\u65b9\u5f0f&#xff0c;\u907f\u514d\u4e3a\u6bcf\u4e2a\u6570\u636e\u6e90\u5355\u72ec\u5f00\u53d1\u5b9a\u5236\u5316\u96c6\u6210&#xff0c;\u8ba9\u5de5\u5177\u80fd\u529b\u53ef\u590d\u7528\u3001\u53ef\u5171\u4eab\u3001\u53ef\u8de8\u5e73\u53f0\u8fc1\u79fb\u3002\u57fa\u4e8e\u8fd9\u5957\u6807\u51c6&#xff0c;\u5f00\u53d1\u8005\u53ea\u9700\u5b9e\u73b0\u4e00\u6b21\u5de5\u5177\u63a5\u5165&#xff0c;\u5373\u53ef\u88ab\u4efb\u610f\u652f\u6301 MCP \u7684 AI \u5e94\u7528\u590d\u7528&#xff0c;\u5927\u5e45\u964d\u4f4e\u96c6\u6210\u6210\u672c\u3002<\/p>\n<p>\u672c\u6587\u5c06\u4ece\u96f6\u5f00\u59cb&#xff0c;\u624b\u628a\u624b\u5e26\u4f60\u642d\u5efa\u4e00\u5957\u57fa\u4e8e MCP \u7684 AI Agent \u5de5\u5177\u94fe&#xff0c;\u6db5\u76d6\u534f\u8bae\u539f\u7406\u3001\u670d\u52a1\u7aef\u5f00\u53d1\u3001\u5ba2\u6237\u7aef\u63a5\u5165\u4e0e\u5b9e\u6218\u6848\u4f8b&#xff0c;\u5e2e\u52a9\u4f60\u5feb\u901f\u638c\u63e1\u8fd9\u4e00\u5173\u952e\u6280\u672f\u7684\u843d\u5730\u65b9\u6cd5\u3002<\/p>\n<h3>2. MCP \u534f\u8bae\u6838\u5fc3\u6982\u5ff5<\/h3>\n<h4>2.1 \u4ec0\u4e48\u662f MCP<\/h4>\n<p>MCP \u662f\u4e00\u79cd\u57fa\u4e8e JSON-RPC 2.0 \u7684\u5f00\u653e\u534f\u8bae&#xff0c;\u5b9a\u4e49\u4e86 AI \u5e94\u7528&#xff08;Host&#xff09;\u4e0e\u5916\u90e8\u5de5\u5177\/\u6570\u636e\u6e90&#xff08;Server&#xff09;\u4e4b\u95f4\u7684\u6807\u51c6\u5316\u901a\u4fe1\u65b9\u5f0f\u3002<\/p>\n<h4>2.2 \u6838\u5fc3\u89d2\u8272<\/h4>\n<ul>\n<li>\n<p>Host&#xff1a;AI \u5e94\u7528\u4e3b\u4f53&#xff0c;\u5982 Claude Desktop\u3001\u81ea\u7814 Agent \u6846\u67b6<\/p>\n<\/li>\n<li>\n<p>Client&#xff1a;\u4e0e Server \u5efa\u7acb\u8fde\u63a5\u7684\u534f\u8bae\u5ba2\u6237\u7aef<\/p>\n<\/li>\n<li>\n<p>Server&#xff1a;\u66b4\u9732\u5de5\u5177\u3001\u8d44\u6e90\u548c\u63d0\u793a\u8bcd\u7684\u670d\u52a1\u7aef### 2.3 \u4e09\u5927\u6838\u5fc3\u539f\u8bed<\/p>\n<\/li>\n<li>\n<p>Tools&#xff08;\u5de5\u5177&#xff09;&#xff1a;\u53ef\u88ab\u6a21\u578b\u8c03\u7528\u7684\u51fd\u6570&#xff0c;\u5982\u67e5\u8be2\u5929\u6c14\u3001\u64cd\u4f5c\u6570\u636e\u5e93<\/p>\n<\/li>\n<li>\n<p>Resources&#xff08;\u8d44\u6e90&#xff09;&#xff1a;\u53ef\u88ab\u8bfb\u53d6\u7684\u6570\u636e&#xff0c;\u5982\u6587\u4ef6\u5185\u5bb9\u3001API \u8fd4\u56de<\/p>\n<\/li>\n<li>\n<p>Prompts&#xff08;\u63d0\u793a\u8bcd&#xff09;&#xff1a;\u53ef\u590d\u7528\u7684\u63d0\u793a\u6a21\u677f<\/p>\n<\/li>\n<\/ul>\n<h4>2.4 \u901a\u4fe1\u673a\u5236<\/h4>\n<ul>\n<li>\u57fa\u4e8e JSON-RPC 2.0 \u7684\u6d88\u606f\u683c\u5f0f<\/li>\n<li>\u652f\u6301 stdio \u4e0e Streamable HTTP \u4e24\u79cd\u4f20\u8f93\u65b9\u5f0f<\/li>\n<li>\u4f1a\u8bdd\u521d\u59cb\u5316\u4e0e\u80fd\u529b\u534f\u5546\u6d41\u7a0b<\/li>\n<\/ul>\n<h3>3. \u5f00\u53d1\u73af\u5883\u51c6\u5907<\/h3>\n<h4>3.1 \u6280\u672f\u6808\u9009\u578b<\/h4>\n<ul>\n<li>\u8bed\u8a00&#xff1a;Python 3.10&#043;&#xff08;\u672c\u6587\u4ee5 Python \u4e3a\u4f8b&#xff09;<\/li>\n<li>\u5b98\u65b9 SDK&#xff1a;mcp Python SDK<\/li>\n<li>\u6846\u67b6&#xff1a;FastAPI&#xff08;\u7528\u4e8e HTTP \u4f20\u8f93&#xff09;<\/li>\n<\/ul>\n<h4>3.2 \u73af\u5883\u642d\u5efa<\/h4>\n<p><span class=\"token comment\"># \u521b\u5efa\u865a\u62df\u73af\u5883<\/span><br \/>\npython <span class=\"token parameter variable\">-m<\/span> venv .venv<br \/>\n<span class=\"token builtin class-name\">source<\/span> .venv\/bin\/activate<\/p>\n<p><span class=\"token comment\"># \u5b89\u88c5 MCP SDK<\/span><br \/>\npip <span class=\"token function\">install<\/span> mcp<\/p>\n<p><span class=\"token comment\"># \u5b89\u88c5 FastAPI&#xff08;HTTP \u4f20\u8f93\u9700\u8981&#xff09;<\/span><br \/>\npip <span class=\"token function\">install<\/span> <span class=\"token string\">&#034;mcp[fastapi]&#034;<\/span><\/p>\n<h4>3.3 \u9879\u76ee\u7ed3\u6784\u89c4\u5212<\/h4>\n<p>mcp-agent-toolchain\/<br \/>\n\u251c\u2500\u2500 server\/<br \/>\n\u2502   \u251c\u2500\u2500 __init__.py<br \/>\n\u2502   \u251c\u2500\u2500 main.py          # \u670d\u52a1\u7aef\u5165\u53e3<br \/>\n\u2502   \u251c\u2500\u2500 tools\/           # \u5de5\u5177\u5b9a\u4e49<br \/>\n\u2502   \u2514\u2500\u2500 resources\/       # \u8d44\u6e90\u5b9a\u4e49<br \/>\n\u251c\u2500\u2500 client\/<br \/>\n\u2502   \u251c\u2500\u2500 __init__.py<br \/>\n\u2502   \u2514\u2500\u2500 agent.py         # Agent \u5ba2\u6237\u7aef<br \/>\n\u2514\u2500\u2500 tests\/<\/p>\n<h3>4. \u5f00\u53d1\u7b2c\u4e00\u4e2a MCP Server<\/h3>\n<h4>4.1 \u6700\u5c0f\u670d\u52a1\u7aef\u5b9e\u73b0<\/h4>\n<p><span class=\"token comment\"># \u5bfc\u5165 MCP Server \u6838\u5fc3\u7c7b&#xff0c;\u7528\u4e8e\u521b\u5efa\u670d\u52a1\u7aef\u5b9e\u4f8b<\/span><br \/>\n<span class=\"token keyword\">from<\/span> mcp<span class=\"token punctuation\">.<\/span>server <span class=\"token keyword\">import<\/span> Server<br \/>\n<span class=\"token comment\"># \u5bfc\u5165 stdio \u4f20\u8f93\u5c42&#xff0c;\u8d1f\u8d23\u901a\u8fc7\u6807\u51c6\u8f93\u5165\/\u8f93\u51fa\u4e0e\u5ba2\u6237\u7aef\u901a\u4fe1<\/span><br \/>\n<span class=\"token keyword\">from<\/span> mcp<span class=\"token punctuation\">.<\/span>server<span class=\"token punctuation\">.<\/span>stdio <span class=\"token keyword\">import<\/span> stdio_server<\/p>\n<p><span class=\"token comment\"># \u521b\u5efa MCP Server \u5b9e\u4f8b&#xff0c;\u53c2\u6570 &#034;demo-server&#034; \u662f\u670d\u52a1\u7aef\u540d\u79f0&#xff0c;\u7528\u4e8e\u6807\u8bc6\u548c\u65e5\u5fd7\u8bb0\u5f55<\/span><br \/>\napp <span class=\"token operator\">&#061;<\/span> Server<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;demo-server&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># &#064;app.list_tools() \u88c5\u9970\u5668\u6ce8\u518c&#034;\u5de5\u5177\u5217\u8868&#034;\u5904\u7406\u5668<\/span><br \/>\n<span class=\"token comment\"># \u5f53\u5ba2\u6237\u7aef\u8c03\u7528 list_tools \u8bf7\u6c42\u65f6&#xff0c;MCP \u6846\u67b6\u4f1a\u81ea\u52a8\u8c03\u7528\u6b64\u51fd\u6570<\/span><br \/>\n<span class=\"token decorator annotation punctuation\">&#064;app<span class=\"token punctuation\">.<\/span>list_tools<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">list_tools<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token comment\"># \u8fd4\u56de\u5de5\u5177\u5b9a\u4e49\u5217\u8868&#xff0c;\u6bcf\u4e2a\u5de5\u5177\u662f\u4e00\u4e2a\u5b57\u5178&#xff0c;\u5305\u542b\u4e09\u4e2a\u5173\u952e\u5b57\u6bb5&#xff1a;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n        <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token string\">&#034;name&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;get_time&#034;<\/span><span class=\"token punctuation\">,<\/span>          <span class=\"token comment\"># \u5de5\u5177\u540d\u79f0&#xff0c;\u5ba2\u6237\u7aef\u901a\u8fc7\u5b83\u6765\u8c03\u7528<\/span><br \/>\n            <span class=\"token string\">&#034;description&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;\u83b7\u53d6\u5f53\u524d\u65f6\u95f4&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token comment\"># \u5de5\u5177\u63cf\u8ff0&#xff0c;LLM \u636e\u6b64\u5224\u65ad\u4f55\u65f6\u8c03\u7528<\/span><br \/>\n            <span class=\"token string\">&#034;inputSchema&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">{<\/span>              <span class=\"token comment\"># \u8f93\u5165\u53c2\u6570 Schema&#xff0c;\u5b9a\u4e49\u5de5\u5177\u63a5\u53d7\u7684\u53c2\u6570\u7ed3\u6784<\/span><br \/>\n                <span class=\"token string\">&#034;type&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;object&#034;<\/span><span class=\"token punctuation\">,<\/span>         <span class=\"token comment\"># \u53c2\u6570\u5fc5\u987b\u662f JSON \u5bf9\u8c61<\/span><br \/>\n                <span class=\"token string\">&#034;properties&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span>         <span class=\"token comment\"># \u8be5\u5de5\u5177\u65e0\u53c2\u6570&#xff0c;\u6240\u4ee5\u5c5e\u6027\u4e3a\u7a7a<\/span><br \/>\n            <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><span class=\"token comment\"># &#064;app.call_tool() \u88c5\u9970\u5668\u6ce8\u518c&#034;\u5de5\u5177\u8c03\u7528&#034;\u5904\u7406\u5668<\/span><br \/>\n<span class=\"token comment\"># \u5f53\u5ba2\u6237\u7aef\u8bf7\u6c42\u8c03\u7528\u67d0\u4e2a\u5de5\u5177\u65f6&#xff0c;MCP \u6846\u67b6\u4f1a\u8c03\u7528\u6b64\u51fd\u6570<\/span><br \/>\n<span class=\"token decorator annotation punctuation\">&#064;app<span class=\"token punctuation\">.<\/span>call_tool<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">call_tool<\/span><span class=\"token punctuation\">(<\/span>name<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">,<\/span> arguments<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">dict<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token comment\"># name \u53c2\u6570&#xff1a;\u5ba2\u6237\u7aef\u8bf7\u6c42\u8c03\u7528\u7684\u5de5\u5177\u540d\u79f0<\/span><br \/>\n    <span class=\"token comment\"># arguments \u53c2\u6570&#xff1a;\u5ba2\u6237\u7aef\u4f20\u5165\u7684\u5de5\u5177\u53c2\u6570&#xff08;\u5b57\u5178\u5f62\u5f0f&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> name <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token string\">&#034;get_time&#034;<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token comment\"># \u5ef6\u8fdf\u5bfc\u5165 datetime&#xff0c;\u907f\u514d\u6a21\u5757\u52a0\u8f7d\u65f6\u7684\u989d\u5916\u5f00\u9500<\/span><br \/>\n        <span class=\"token keyword\">from<\/span> datetime <span class=\"token keyword\">import<\/span> datetime<br \/>\n        <span class=\"token comment\"># \u8fd4\u56de MCP \u6807\u51c6\u683c\u5f0f\u7684\u7ed3\u679c&#xff0c;content \u662f\u5185\u5bb9\u5217\u8868<\/span><br \/>\n        <span class=\"token comment\"># \u6bcf\u4e2a\u5185\u5bb9\u9879\u9700\u6307\u5b9a type&#xff08;text \u8868\u793a\u6587\u672c&#xff09;\u548c text&#xff08;\u5b9e\u9645\u5185\u5bb9&#xff09;<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;content&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;type&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;text&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;text&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">(<\/span>datetime<span class=\"token punctuation\">.<\/span>now<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\"># \u5b9a\u4e49\u670d\u52a1\u7aef\u4e3b\u5165\u53e3\u51fd\u6570<\/span><br \/>\n<span class=\"token keyword\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token comment\"># \u4f7f\u7528 async with \u6253\u5f00 stdio \u4f20\u8f93\u901a\u9053<\/span><br \/>\n    <span class=\"token comment\"># read \u662f\u8bfb\u53d6\u5ba2\u6237\u7aef\u6d88\u606f\u7684\u6d41&#xff0c;write \u662f\u5411\u5ba2\u6237\u7aef\u53d1\u9001\u6d88\u606f\u7684\u6d41<\/span><br \/>\n    <span class=\"token keyword\">async<\/span> <span class=\"token keyword\">with<\/span> stdio_server<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> <span class=\"token punctuation\">(<\/span>read<span class=\"token punctuation\">,<\/span> write<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token comment\"># \u542f\u52a8 MCP Server \u4e3b\u5faa\u73af&#xff0c;\u76d1\u542c\u5e76\u5904\u7406\u6765\u81ea\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42<\/span><br \/>\n        <span class=\"token keyword\">await<\/span> app<span class=\"token punctuation\">.<\/span>run<span class=\"token punctuation\">(<\/span>read<span class=\"token punctuation\">,<\/span> write<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u5f53\u811a\u672c\u88ab\u76f4\u63a5\u6267\u884c\u65f6&#xff08;\u800c\u975e\u88ab\u5bfc\u5165&#xff09;&#xff0c;\u8fd0\u884c\u4e3b\u51fd\u6570<\/span><br \/>\n<span class=\"token keyword\">if<\/span> __name__ <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token string\">&#034;__main__&#034;<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">import<\/span> asyncio<br \/>\n    <span class=\"token comment\"># \u4f7f\u7528 asyncio.run \u542f\u52a8\u5f02\u6b65\u4e8b\u4ef6\u5faa\u73af&#xff0c;\u8fd0\u884c main() \u534f\u7a0b<\/span><br \/>\n    asyncio<span class=\"token punctuation\">.<\/span>run<span class=\"token punctuation\">(<\/span>main<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h4>4.2 \u8fd0\u884c\u4e0e\u9a8c\u8bc1<\/h4>\n<p>python server\/main.py<\/p>\n<h4>4.3 \u5de5\u5177\u6ce8\u518c\u8fdb\u9636<\/h4>\n<ul>\n<li>\u4f7f\u7528 &#064;app.tool() \u88c5\u9970\u5668\u7b80\u5316\u6ce8\u518c<\/li>\n<li>\u5b9a\u4e49\u5e26\u53c2\u6570\u7684\u590d\u6742\u5de5\u5177<\/li>\n<li>\u8fd4\u56de\u7ed3\u6784\u5316\u6570\u636e<\/li>\n<\/ul>\n<h3>5. \u6784\u5efa Agent \u5ba2\u6237\u7aef<\/h3>\n<h4>5.1 \u5ba2\u6237\u7aef\u8fde\u63a5<\/h4>\n<p><span class=\"token keyword\">from<\/span> mcp<span class=\"token punctuation\">.<\/span>client<span class=\"token punctuation\">.<\/span>stdio <span class=\"token keyword\">import<\/span> stdio_client<br \/>\n<span class=\"token keyword\">from<\/span> mcp <span class=\"token keyword\">import<\/span> ClientSession<\/p>\n<p><span class=\"token keyword\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">connect_to_server<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    server_params <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;command&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;python&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;args&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;server\/main.py&#034;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">async<\/span> <span class=\"token keyword\">with<\/span> stdio_client<span class=\"token punctuation\">(<\/span>server_params<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> <span class=\"token punctuation\">(<\/span>read<span class=\"token punctuation\">,<\/span> write<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">async<\/span> <span class=\"token keyword\">with<\/span> ClientSession<span class=\"token punctuation\">(<\/span>read<span class=\"token punctuation\">,<\/span> write<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> session<span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">await<\/span> session<span class=\"token punctuation\">.<\/span>initialize<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n            <span class=\"token keyword\">return<\/span> session<\/p>\n<h4>5.2 \u5de5\u5177\u53d1\u73b0\u4e0e\u8c03\u7528<\/h4>\n<ul>\n<li>\u901a\u8fc7 session.list_tools() \u83b7\u53d6\u5de5\u5177\u5217\u8868<\/li>\n<li>\u901a\u8fc7 session.call_tool() \u8c03\u7528\u5de5\u5177<\/li>\n<li>\u5904\u7406\u5de5\u5177\u8fd4\u56de\u7ed3\u679c<\/li>\n<\/ul>\n<h4>5.3 \u4e0e LLM \u96c6\u6210<\/h4>\n<ul>\n<li>\u5c06\u5de5\u5177\u5217\u8868\u8f6c\u6362\u4e3a LLM \u53ef\u8bc6\u522b\u7684 function calling \u683c\u5f0f<\/li>\n<li>\u6a21\u578b\u51b3\u7b56 \u2192 \u5de5\u5177\u8c03\u7528 \u2192 \u7ed3\u679c\u56de\u586b\u7684\u5b8c\u6574\u5faa\u73af<\/li>\n<\/ul>\n<h3>6. \u5b9e\u6218&#xff1a;\u642d\u5efa\u5b8c\u6574\u5de5\u5177\u94fe<\/h3>\n<h4>6.1 \u573a\u666f\u8bbe\u8ba1<\/h4>\n<p>\u6784\u5efa\u4e00\u4e2a\u300c\u667a\u80fd\u8fd0\u7ef4\u52a9\u624b\u300d&#xff0c;\u96c6\u6210\u4ee5\u4e0b\u80fd\u529b&#xff1a;<\/p>\n<ul>\n<li>\u67e5\u8be2\u670d\u52a1\u5668\u72b6\u6001<\/li>\n<li>\u8bfb\u53d6\u65e5\u5fd7\u6587\u4ef6<\/li>\n<li>\u6267\u884c\u7b80\u5355\u8fd0\u7ef4\u547d\u4ee4<\/li>\n<\/ul>\n<h4>6.2 \u670d\u52a1\u7aef\u5b9e\u73b0<\/h4>\n<p><span class=\"token comment\"># &#064;app.tool() \u88c5\u9970\u5668\u662f MCP \u6846\u67b6\u63d0\u4f9b\u7684\u4fbf\u6377\u6ce8\u518c\u65b9\u5f0f<\/span><br \/>\n<span class=\"token comment\"># \u5b83\u4f1a\u81ea\u52a8\u5c06\u51fd\u6570\u8f6c\u6362\u4e3a MCP \u5de5\u5177&#xff0c;\u5e76\u6839\u636e\u51fd\u6570\u7b7e\u540d\u751f\u6210 inputSchema<\/span><br \/>\n<span class=\"token decorator annotation punctuation\">&#064;app<span class=\"token punctuation\">.<\/span>tool<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">check_server_status<\/span><span class=\"token punctuation\">(<\/span>host<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u68c0\u67e5\u670d\u52a1\u5668\u72b6\u6001&#034;&#034;&#034;<\/span><br \/>\n    <span class=\"token comment\"># \u6a21\u62df\u68c0\u67e5\u903b\u8f91&#xff1a;\u5b9e\u9645\u9879\u76ee\u4e2d\u53ef\u66ff\u6362\u4e3a\u771f\u5b9e\u7684 SSH \u8fde\u63a5\u3001ping \u6216 API \u8c03\u7528<\/span><br \/>\n    <span class=\"token comment\"># \u8fd4\u56de\u5b57\u7b26\u4e32\u4f1a\u88ab MCP \u81ea\u52a8\u5305\u88c5\u4e3a\u6807\u51c6\u54cd\u5e94\u683c\u5f0f<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u670d\u52a1\u5668 <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>host<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> \u8fd0\u884c\u6b63\u5e38&#xff0c;CPU \u4f7f\u7528\u7387 23%&#034;<\/span><\/span><\/p>\n<p><span class=\"token comment\"># \u6ce8\u518c\u7b2c\u4e8c\u4e2a\u5de5\u5177&#xff1a;\u8bfb\u53d6\u65e5\u5fd7\u6587\u4ef6<\/span><br \/>\n<span class=\"token comment\"># \u51fd\u6570\u53c2\u6570 file_path \u548c lines \u4f1a\u81ea\u52a8\u6620\u5c04\u4e3a\u5de5\u5177\u7684\u8f93\u5165 Schema<\/span><br \/>\n<span class=\"token decorator annotation punctuation\">&#064;app<span class=\"token punctuation\">.<\/span>tool<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">read_log<\/span><span class=\"token punctuation\">(<\/span>file_path<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">,<\/span> lines<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">int<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">50<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u8bfb\u53d6\u65e5\u5fd7\u6587\u4ef6\u672b\u5c3e N \u884c&#034;&#034;&#034;<\/span><br \/>\n    <span class=\"token comment\"># \u4f7f\u7528 with \u8bed\u53e5\u5b89\u5168\u6253\u5f00\u6587\u4ef6&#xff0c;\u786e\u4fdd\u6587\u4ef6\u4f7f\u7528\u540e\u81ea\u52a8\u5173\u95ed<\/span><br \/>\n    <span class=\"token keyword\">with<\/span> <span class=\"token builtin\">open<\/span><span class=\"token punctuation\">(<\/span>file_path<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;r&#034;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> f<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token comment\"># readlines() \u8bfb\u53d6\u6240\u6709\u884c&#xff0c;[-lines:] \u5207\u7247\u53d6\u6700\u540e N \u884c<\/span><br \/>\n        content <span class=\"token operator\">&#061;<\/span> f<span class=\"token punctuation\">.<\/span>readlines<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">[<\/span><span class=\"token operator\">&#8211;<\/span>lines<span class=\"token punctuation\">:<\/span><span class=\"token punctuation\">]<\/span><br \/>\n    <span class=\"token comment\"># \u5c06\u884c\u5217\u8868\u62fc\u63a5\u4e3a\u5355\u4e2a\u5b57\u7b26\u4e32\u8fd4\u56de<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token string\">&#034;&#034;<\/span><span class=\"token punctuation\">.<\/span>join<span class=\"token punctuation\">(<\/span>content<span class=\"token punctuation\">)<\/span><\/p>\n<h4>6.3 \u5ba2\u6237\u7aef Agent \u5b9e\u73b0<\/h4>\n<p><span class=\"token keyword\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">run_agent<\/span><span class=\"token punctuation\">(<\/span>session<span class=\"token punctuation\">:<\/span> ClientSession<span class=\"token punctuation\">,<\/span> query<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    tools <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">await<\/span> session<span class=\"token punctuation\">.<\/span>list_tools<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u5c06 MCP \u5de5\u5177\u8f6c\u6362\u4e3a LLM function calling \u683c\u5f0f<\/span><br \/>\n    functions <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n        <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token string\">&#034;name&#034;<\/span><span class=\"token punctuation\">:<\/span> t<span class=\"token punctuation\">.<\/span>name<span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;description&#034;<\/span><span class=\"token punctuation\">:<\/span> t<span class=\"token punctuation\">.<\/span>description<span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;parameters&#034;<\/span><span class=\"token punctuation\">:<\/span> t<span class=\"token punctuation\">.<\/span>inputSchema<span class=\"token punctuation\">,<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token keyword\">for<\/span> t <span class=\"token keyword\">in<\/span> tools<span class=\"token punctuation\">.<\/span>tools<br \/>\n    <span class=\"token punctuation\">]<\/span><\/p>\n<p>    <span class=\"token comment\"># \u8c03\u7528 LLM \u8fdb\u884c\u51b3\u7b56&#xff08;\u6b64\u5904\u4ee5\u4f2a\u4ee3\u7801\u793a\u610f&#xff09;<\/span><br \/>\n    response <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">await<\/span> llm<span class=\"token punctuation\">.<\/span>chat<span class=\"token punctuation\">(<\/span>query<span class=\"token punctuation\">,<\/span> functions<span class=\"token operator\">&#061;<\/span>functions<span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u6267\u884c\u5de5\u5177\u8c03\u7528<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> response<span class=\"token punctuation\">.<\/span>tool_calls<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">for<\/span> call <span class=\"token keyword\">in<\/span> response<span class=\"token punctuation\">.<\/span>tool_calls<span class=\"token punctuation\">:<\/span><br \/>\n            result <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">await<\/span> session<span class=\"token punctuation\">.<\/span>call_tool<span class=\"token punctuation\">(<\/span>call<span class=\"token punctuation\">.<\/span>name<span class=\"token punctuation\">,<\/span> call<span class=\"token punctuation\">.<\/span>arguments<span class=\"token punctuation\">)<\/span><br \/>\n            <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u5de5\u5177 <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>call<span class=\"token punctuation\">.<\/span>name<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> \u8fd4\u56de: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>result<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h4>6.4 \u5b8c\u6574\u6d41\u7a0b\u6f14\u793a<\/h4>\n<p>  #mermaid-svg-KPH2JaN1a5EblGYQ{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-KPH2JaN1a5EblGYQ .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-KPH2JaN1a5EblGYQ .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-KPH2JaN1a5EblGYQ .error-icon{fill:#552222;}#mermaid-svg-KPH2JaN1a5EblGYQ .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-KPH2JaN1a5EblGYQ .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-KPH2JaN1a5EblGYQ .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-KPH2JaN1a5EblGYQ .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-KPH2JaN1a5EblGYQ .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-KPH2JaN1a5EblGYQ .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-KPH2JaN1a5EblGYQ .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-KPH2JaN1a5EblGYQ .marker{fill:#333333;stroke:#333333;}#mermaid-svg-KPH2JaN1a5EblGYQ .marker.cross{stroke:#333333;}#mermaid-svg-KPH2JaN1a5EblGYQ svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-KPH2JaN1a5EblGYQ p{margin:0;}#mermaid-svg-KPH2JaN1a5EblGYQ .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-KPH2JaN1a5EblGYQ .cluster-label text{fill:#333;}#mermaid-svg-KPH2JaN1a5EblGYQ .cluster-label span{color:#333;}#mermaid-svg-KPH2JaN1a5EblGYQ .cluster-label span p{background-color:transparent;}#mermaid-svg-KPH2JaN1a5EblGYQ .label text,#mermaid-svg-KPH2JaN1a5EblGYQ span{fill:#333;color:#333;}#mermaid-svg-KPH2JaN1a5EblGYQ .node rect,#mermaid-svg-KPH2JaN1a5EblGYQ .node circle,#mermaid-svg-KPH2JaN1a5EblGYQ .node ellipse,#mermaid-svg-KPH2JaN1a5EblGYQ .node polygon,#mermaid-svg-KPH2JaN1a5EblGYQ .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-KPH2JaN1a5EblGYQ .rough-node .label text,#mermaid-svg-KPH2JaN1a5EblGYQ .node .label text,#mermaid-svg-KPH2JaN1a5EblGYQ .image-shape .label,#mermaid-svg-KPH2JaN1a5EblGYQ .icon-shape .label{text-anchor:middle;}#mermaid-svg-KPH2JaN1a5EblGYQ .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-KPH2JaN1a5EblGYQ .rough-node .label,#mermaid-svg-KPH2JaN1a5EblGYQ .node .label,#mermaid-svg-KPH2JaN1a5EblGYQ .image-shape .label,#mermaid-svg-KPH2JaN1a5EblGYQ .icon-shape .label{text-align:center;}#mermaid-svg-KPH2JaN1a5EblGYQ .node.clickable{cursor:pointer;}#mermaid-svg-KPH2JaN1a5EblGYQ .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-KPH2JaN1a5EblGYQ .arrowheadPath{fill:#333333;}#mermaid-svg-KPH2JaN1a5EblGYQ .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-KPH2JaN1a5EblGYQ .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-KPH2JaN1a5EblGYQ .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-KPH2JaN1a5EblGYQ .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-KPH2JaN1a5EblGYQ .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-KPH2JaN1a5EblGYQ .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-KPH2JaN1a5EblGYQ .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-KPH2JaN1a5EblGYQ .cluster text{fill:#333;}#mermaid-svg-KPH2JaN1a5EblGYQ .cluster span{color:#333;}#mermaid-svg-KPH2JaN1a5EblGYQ div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-KPH2JaN1a5EblGYQ .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-KPH2JaN1a5EblGYQ rect.text{fill:none;stroke-width:0;}#mermaid-svg-KPH2JaN1a5EblGYQ .icon-shape,#mermaid-svg-KPH2JaN1a5EblGYQ .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-KPH2JaN1a5EblGYQ .icon-shape p,#mermaid-svg-KPH2JaN1a5EblGYQ .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-KPH2JaN1a5EblGYQ .icon-shape .label rect,#mermaid-svg-KPH2JaN1a5EblGYQ .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-KPH2JaN1a5EblGYQ .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-KPH2JaN1a5EblGYQ .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-KPH2JaN1a5EblGYQ :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/p>\n<p>\u662f<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/p>\n<p>\u5426<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u7528\u6237\u8f93\u5165\u95ee\u9898<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>LLM \u51b3\u7b56<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u9700\u8981\u8c03\u7528\u5de5\u5177?<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>MCP Client \u8c03\u7528 Server<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u5de5\u5177\u6267\u884c\u5e76\u8fd4\u56de\u7ed3\u679c<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u7ed3\u679c\u56de\u586b\u7ed9 LLM<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u751f\u6210\u6700\u7ec8\u56de\u7b54<\/p>\n<p><\/span><\/p>\n<h3>7. \u8fdb\u9636&#xff1a;Streamable HTTP \u4f20\u8f93<\/h3>\n<h4>7.1 \u4e3a\u4ec0\u4e48\u9700\u8981 HTTP \u4f20\u8f93<\/h4>\n<ul>\n<li>\u652f\u6301\u8fdc\u7a0b\u90e8\u7f72\u4e0e\u8de8\u7f51\u7edc\u8c03\u7528<\/li>\n<li>\u4fbf\u4e8e\u4e0e\u73b0\u6709 Web \u670d\u52a1\u96c6\u6210<\/li>\n<li>\u652f\u6301\u591a\u5ba2\u6237\u7aef\u5e76\u53d1\u8bbf\u95ee<\/li>\n<\/ul>\n<h4>7.2 \u670d\u52a1\u7aef\u6539\u9020<\/h4>\n<p><span class=\"token keyword\">from<\/span> mcp<span class=\"token punctuation\">.<\/span>server<span class=\"token punctuation\">.<\/span>fastmcp <span class=\"token keyword\">import<\/span> FastMCP<\/p>\n<p>mcp <span class=\"token operator\">&#061;<\/span> FastMCP<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;remote-server&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token decorator annotation punctuation\">&#064;mcp<span class=\"token punctuation\">.<\/span>tool<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">def<\/span> <span class=\"token function\">get_weather<\/span><span class=\"token punctuation\">(<\/span>city<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u67e5\u8be2\u57ce\u5e02\u5929\u6c14&#034;&#034;&#034;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>city<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> \u4eca\u5929\u6674&#xff0c;25\u00b0C&#034;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">if<\/span> __name__ <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token string\">&#034;__main__&#034;<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    mcp<span class=\"token punctuation\">.<\/span>run<span class=\"token punctuation\">(<\/span>transport<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;streamable-http&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h4>7.3 \u5ba2\u6237\u7aef\u8fde\u63a5<\/h4>\n<p><span class=\"token keyword\">from<\/span> mcp<span class=\"token punctuation\">.<\/span>client<span class=\"token punctuation\">.<\/span>streamable_http <span class=\"token keyword\">import<\/span> streamable_http_client<\/p>\n<p><span class=\"token keyword\">async<\/span> <span class=\"token keyword\">with<\/span> streamable_http_client<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;http:\/\/localhost:8000\/mcp&#034;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> <span class=\"token punctuation\">(<\/span>read<span class=\"token punctuation\">,<\/span> write<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">async<\/span> <span class=\"token keyword\">with<\/span> ClientSession<span class=\"token punctuation\">(<\/span>read<span class=\"token punctuation\">,<\/span> write<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> session<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">await<\/span> session<span class=\"token punctuation\">.<\/span>initialize<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        tools <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">await<\/span> session<span class=\"token punctuation\">.<\/span>list_tools<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h3>8. \u5b89\u5168\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h3>\n<h4>8.1 \u5b89\u5168\u6ce8\u610f\u4e8b\u9879<\/h4>\n<ul>\n<li>\u5de5\u5177\u6743\u9650\u6700\u5c0f\u5316\u539f\u5219<\/li>\n<li>\u8f93\u5165\u6821\u9a8c\u4e0e\u53c2\u6570\u767d\u540d\u5355<\/li>\n<li>\u654f\u611f\u64cd\u4f5c\u9700\u4e8c\u6b21\u786e\u8ba4<\/li>\n<li>\u65e5\u5fd7\u8131\u654f\u5904\u7406<\/li>\n<\/ul>\n<h4>8.2 \u5f00\u53d1\u6700\u4f73\u5b9e\u8df5<\/h4>\n<ul>\n<li>\u5de5\u5177\u547d\u540d\u89c4\u8303\u7edf\u4e00<\/li>\n<li>\u4e3a\u6bcf\u4e2a\u5de5\u5177\u7f16\u5199\u6e05\u6670\u63cf\u8ff0<\/li>\n<li>\u5408\u7406\u8bbe\u8ba1\u8f93\u5165 Schema<\/li>\n<li>\u505a\u597d\u9519\u8bef\u5904\u7406\u4e0e\u8d85\u65f6\u63a7\u5236<\/li>\n<\/ul>\n<h4>8.3 \u6027\u80fd\u4f18\u5316<\/h4>\n<ul>\n<li>\u8fde\u63a5\u590d\u7528\u4e0e\u957f\u8fde\u63a5<\/li>\n<li>\u5de5\u5177\u7ed3\u679c\u7f13\u5b58<\/li>\n<li>\u5f02\u6b65\u5e76\u53d1\u8c03\u7528<\/li>\n<\/ul>\n<h3>9. \u603b\u7ed3\u4e0e\u5c55\u671b<\/h3>\n<h4>9.1 \u672c\u6587\u56de\u987e<\/h4>\n<ul>\n<li>\u7406\u89e3\u4e86 MCP \u534f\u8bae\u7684\u6838\u5fc3\u6982\u5ff5\u4e0e\u901a\u4fe1\u673a\u5236<\/li>\n<li>\u4ece\u96f6\u5b9e\u73b0\u4e86 MCP Server \u4e0e Client<\/li>\n<li>\u642d\u5efa\u4e86\u5b8c\u6574\u7684 AI Agent \u5de5\u5177\u94fe<\/li>\n<li>\u638c\u63e1\u4e86 HTTP \u4f20\u8f93\u4e0e\u5b89\u5168\u5b9e\u8df5<\/li>\n<\/ul>\n<h4>9.2 \u672a\u6765\u65b9\u5411<\/h4>\n<ul>\n<li>\u63a2\u7d22 MCP \u5728\u66f4\u591a\u573a\u666f\u7684\u5e94\u7528<\/li>\n<li>\u5173\u6ce8\u534f\u8bae\u7248\u672c\u6f14\u8fdb\u4e0e\u65b0\u7279\u6027<\/li>\n<li>\u6784\u5efa\u66f4\u590d\u6742\u7684\u591a Server \u534f\u4f5c\u67b6\u6784<\/li>\n<\/ul>\n<h3>10. \u53c2\u8003\u8d44\u6599<\/h3>\n<ul>\n<li>MCP \u5b98\u65b9\u6587\u6863&#xff1a;MCP \u534f\u8bae\u7684\u5b98\u65b9\u7ad9\u70b9&#xff0c;\u5305\u542b\u534f\u8bae\u89c4\u8303\u3001\u67b6\u6784\u8bf4\u660e\u4e0e\u5404\u8bed\u8a00 SDK \u7684\u6743\u5a01\u6307\u5357\u3002<\/li>\n<li>MCP Python SDK \u6587\u6863&#xff1a;MCP \u5b98\u65b9 Python SDK \u6e90\u7801\u4e0e\u4f7f\u7528\u8bf4\u660e&#xff0c;\u8986\u76d6 Server\u3001Client \u53ca\u591a\u79cd\u4f20\u8f93\u65b9\u5f0f\u7684\u5b9e\u73b0\u7ec6\u8282\u3002<\/li>\n<li>JSON-RPC 2.0 \u89c4\u8303&#xff1a;MCP \u5e95\u5c42\u6d88\u606f\u683c\u5f0f\u6240\u9075\u5faa\u7684 JSON-RPC 2.0 \u5b98\u65b9\u89c4\u8303&#xff0c;\u5e2e\u52a9\u7406\u89e3\u8bf7\u6c42\u3001\u54cd\u5e94\u4e0e\u9519\u8bef\u5bf9\u8c61\u7684\u7ed3\u6784\u3002<\/li>\n<li>Anthropic MCP \u4ecb\u7ecd&#xff1a;MCP \u534f\u8bae\u53d1\u5e03\u65f6\u7684\u5b98\u65b9\u6280\u672f\u535a\u5ba2&#xff0c;\u9610\u8ff0\u5176\u8bbe\u8ba1\u52a8\u673a\u4e0e\u751f\u6001\u613f\u666f\u3002<\/li>\n<li>Model Context Protocol \u5165\u95e8\u6307\u5357&#xff1a;\u9762\u5411\u521d\u5b66\u8005\u7684\u5feb\u901f\u4e0a\u624b\u6559\u7a0b&#xff0c;\u4ece\u6982\u5ff5\u5230\u7b2c\u4e00\u4e2a Server \u7684\u5b8c\u6574\u5f15\u5bfc\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. \u5f15\u8a00 TL;DR&#xff1a;\u9762\u5411 Python \u5f00\u53d1\u8005&#xff0c;\u4ece\u96f6\u638c\u63e1 MCP \u534f\u8bae&#xff0c;\u624b\u628a\u624b\u642d\u5efa MCP Server \u4e0e Agent \u5ba2\u6237\u7aef&#xff0c;\u5b8c\u6210\u300c\u667a\u80fd\u8fd0\u7ef4\u52a9\u624b\u300d\u5b9e\u6218&#xff0c;\u5feb\u901f\u843d\u5730\u53ef\u590d\u7528\u7684 AI Agent \u5de5\u5177\u94fe\u3002 \u5173\u952e\u8bcd&#xff1a;MCP\u3000AI Agent\u3000Python\u3000Streamable HTTP\u3000\u5de5\u5177\u94fe \u968f\u7740\u5927\u8bed\u8a00\u6a21\u578b\u80fd\u529b\u7684\u5feb\u901f\u63d0\u5347&#xff0c;AI Agent \u7684\u5e94\u7528\u573a\u666f\u8d8a\u6765\u8d8a\u5e7f\u6cdb\u3002\u7136\u800c&amp;#xff0c<\/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":[81,50,190],"topic":[],"class_list":["post-99826","post","type-post","status-publish","format-standard","hentry","category-server","tag-python","tag-50","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MCP \u534f\u8bae\u5f00\u53d1\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa AI Agent \u5de5\u5177\u94fe - \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\/99826.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MCP \u534f\u8bae\u5f00\u53d1\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa AI Agent \u5de5\u5177\u94fe - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"1. \u5f15\u8a00 TL;DR&#xff1a;\u9762\u5411 Python \u5f00\u53d1\u8005&#xff0c;\u4ece\u96f6\u638c\u63e1 MCP \u534f\u8bae&#xff0c;\u624b\u628a\u624b\u642d\u5efa MCP Server \u4e0e Agent \u5ba2\u6237\u7aef&#xff0c;\u5b8c\u6210\u300c\u667a\u80fd\u8fd0\u7ef4\u52a9\u624b\u300d\u5b9e\u6218&#xff0c;\u5feb\u901f\u843d\u5730\u53ef\u590d\u7528\u7684 AI Agent \u5de5\u5177\u94fe\u3002 \u5173\u952e\u8bcd&#xff1a;MCP\u3000AI Agent\u3000Python\u3000Streamable HTTP\u3000\u5de5\u5177\u94fe \u968f\u7740\u5927\u8bed\u8a00\u6a21\u578b\u80fd\u529b\u7684\u5feb\u901f\u63d0\u5347&#xff0c;AI Agent \u7684\u5e94\u7528\u573a\u666f\u8d8a\u6765\u8d8a\u5e7f\u6cdb\u3002\u7136\u800c&amp;#xff0c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/99826.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-03T03:41:14+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=\"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\/99826.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/99826.html\",\"name\":\"MCP \u534f\u8bae\u5f00\u53d1\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa AI Agent \u5de5\u5177\u94fe - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-03T03:41:14+00:00\",\"dateModified\":\"2026-09-03T03:41:14+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/99826.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/99826.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/99826.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MCP \u534f\u8bae\u5f00\u53d1\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa AI Agent \u5de5\u5177\u94fe\"}]},{\"@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":"MCP \u534f\u8bae\u5f00\u53d1\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa AI Agent \u5de5\u5177\u94fe - \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\/99826.html","og_locale":"zh_CN","og_type":"article","og_title":"MCP \u534f\u8bae\u5f00\u53d1\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa AI Agent \u5de5\u5177\u94fe - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"1. \u5f15\u8a00 TL;DR&#xff1a;\u9762\u5411 Python \u5f00\u53d1\u8005&#xff0c;\u4ece\u96f6\u638c\u63e1 MCP \u534f\u8bae&#xff0c;\u624b\u628a\u624b\u642d\u5efa MCP Server \u4e0e Agent \u5ba2\u6237\u7aef&#xff0c;\u5b8c\u6210\u300c\u667a\u80fd\u8fd0\u7ef4\u52a9\u624b\u300d\u5b9e\u6218&#xff0c;\u5feb\u901f\u843d\u5730\u53ef\u590d\u7528\u7684 AI Agent \u5de5\u5177\u94fe\u3002 \u5173\u952e\u8bcd&#xff1a;MCP\u3000AI Agent\u3000Python\u3000Streamable HTTP\u3000\u5de5\u5177\u94fe \u968f\u7740\u5927\u8bed\u8a00\u6a21\u578b\u80fd\u529b\u7684\u5feb\u901f\u63d0\u5347&#xff0c;AI Agent \u7684\u5e94\u7528\u573a\u666f\u8d8a\u6765\u8d8a\u5e7f\u6cdb\u3002\u7136\u800c&amp;#xff0c","og_url":"https:\/\/www.wsisp.com\/helps\/99826.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-03T03:41:14+00:00","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\/99826.html","url":"https:\/\/www.wsisp.com\/helps\/99826.html","name":"MCP \u534f\u8bae\u5f00\u53d1\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa AI Agent \u5de5\u5177\u94fe - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-03T03:41:14+00:00","dateModified":"2026-09-03T03:41:14+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/99826.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/99826.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/99826.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"MCP \u534f\u8bae\u5f00\u53d1\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa AI Agent \u5de5\u5177\u94fe"}]},{"@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\/99826","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=99826"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/99826\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=99826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=99826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=99826"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=99826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}