{"id":46088,"date":"2025-07-30T02:17:57","date_gmt":"2025-07-29T18:17:57","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/46088.html"},"modified":"2025-07-30T02:17:57","modified_gmt":"2025-07-29T18:17:57","slug":"%e5%9f%ba%e4%ba%8e%e9%98%bf%e9%87%8c%e4%ba%91dify%e7%9a%84%e9%ab%98%e5%be%b7%e5%9c%b0%e5%9b%bemcp%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/46088.html","title":{"rendered":"\u57fa\u4e8e\u963f\u91cc\u4e91Dify\u7684\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668"},"content":{"rendered":"<p>\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"500\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729181756-688910546571c.png\" width=\"889\" \/><\/p>\n<\/p>\n<h2>\u4e8e\u963f\u91cc\u4e91Dify\u7684\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668\u5b8c\u6574\u914d\u7f6e\u6559\u7a0b<\/h2>\n<h3>\u51c6\u5907\u5de5\u4f5c<\/h3>\n<h4>\u7b2c\u4e00\u6b65&#xff1a;\u83b7\u53d6\u9ad8\u5fb7\u5730\u56feAPI Key<\/h4>\n<li>\n<p>\u8bbf\u95ee\u9ad8\u5fb7\u5f00\u653e\u5e73\u53f0 \u6253\u5f00\u6d4f\u89c8\u5668&#xff0c;\u8f93\u5165\u7f51\u5740 \u9ad8\u5fb7\u5f00\u653e\u5e73\u53f0 | \u9ad8\u5fb7\u5730\u56feAPI \u8fdb\u5165\u9ad8\u5fb7\u5730\u56fe\u5f00\u653e\u5e73\u53f0\u3002<\/p>\n<\/li>\n<li>\n<p>\u6ce8\u518c\u5e76\u767b\u5f55\u8d26\u53f7<\/p>\n<ul>\n<li>\u5982\u679c\u662f\u65b0\u7528\u6237&#xff0c;\u70b9\u51fb&#034;\u6ce8\u518c&#034;\u6309\u94ae\u5b8c\u6210\u8d26\u53f7\u6ce8\u518c<\/li>\n<li>\u5df2\u6709\u8d26\u53f7\u76f4\u63a5\u767b\u5f55<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8fdb\u5165\u63a7\u5236\u53f0 \u767b\u5f55\u6210\u529f\u540e&#xff0c;\u70b9\u51fb\u53f3\u4e0a\u89d2&#034;\u63a7\u5236\u53f0&#034;\u8fdb\u5165\u7ba1\u7406\u754c\u9762\u3002<\/p>\n<\/li>\n<li>\n<p>\u521b\u5efa\u65b0\u5e94\u7528<\/p>\n<ul>\n<li>\u5728\u5de6\u4fa7\u5bfc\u822a\u680f\u9009\u62e9&#034;\u5e94\u7528\u7ba1\u7406&#034; \u2192 &#034;\u6211\u7684\u5e94\u7528&#034;<\/li>\n<li>\u70b9\u51fb&#034;\u521b\u5efa\u65b0\u5e94\u7528&#034;\u6309\u94ae<\/li>\n<li>\u586b\u5199\u5e94\u7528\u4fe1\u606f&#xff1a;\n<ul>\n<li>\u5e94\u7528\u540d\u79f0&#xff1a;Dify\u5730\u56fe\u670d\u52a1<\/li>\n<li>\u5e94\u7528\u7c7b\u578b&#xff1a;\u9009\u62e9&#034;Web\u670d\u52a1&#034;<\/li>\n<li>\u670d\u52a1\u5e73\u53f0&#xff1a;\u6839\u636e\u5b9e\u9645\u9700\u8981\u9009\u62e9<\/li>\n<\/ul>\n<\/li>\n<li>\u70b9\u51fb&#034;\u786e\u5b9a&#034;\u5b8c\u6210\u521b\u5efa<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u83b7\u53d6API Key<\/p>\n<ul>\n<li>\u5728\u65b0\u521b\u5efa\u7684\u5e94\u7528\u8be6\u60c5\u9875\u4e2d\u627e\u5230&#034;Key&#034;\u5b57\u6bb5<\/li>\n<li>\u70b9\u51fb&#034;\u590d\u5236&#034;\u6309\u94ae\u4fdd\u5b58\u8be5Key\u503c<\/li>\n<li>\u5efa\u8bae\u5c06\u8be5Key\u4fdd\u5b58\u5728\u5b89\u5168\u7684\u4f4d\u7f6e&#xff08;\u5982\u5bc6\u7801\u7ba1\u7406\u5668&#xff09;<\/li>\n<\/ul>\n<\/li>\n<h4>\u7b2c\u4e8c\u6b65&#xff1a;\u51c6\u5907\u963f\u91cc\u4e91\u8f7b\u91cf\u5e94\u7528\u670d\u52a1\u5668<\/h4>\n<li>\n<p>\u767b\u5f55\u963f\u91cc\u4e91\u63a7\u5236\u53f0<\/p>\n<ul>\n<li>\u8bbf\u95ee \u963f\u91cc\u4e91-\u8ba1\u7b97&#xff0c;\u4e3a\u4e86\u65e0\u6cd5\u8ba1\u7b97\u7684\u4ef7\u503c<\/li>\n<li>\u4f7f\u7528\u963f\u91cc\u4e91\u8d26\u53f7\u767b\u5f55<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8d2d\u4e70\u8f7b\u91cf\u5e94\u7528\u670d\u52a1\u5668<\/p>\n<ul>\n<li>\u5728\u63a7\u5236\u53f0\u641c\u7d22&#034;\u8f7b\u91cf\u5e94\u7528\u670d\u52a1\u5668&#034;<\/li>\n<li>\u70b9\u51fb&#034;\u7acb\u5373\u8d2d\u4e70&#034;<\/li>\n<li>\u63a8\u8350\u914d\u7f6e&#xff1a;\n<ul>\n<li>\u5730\u57df&#xff1a;\u9009\u62e9\u79bb\u7528\u6237\u6700\u8fd1\u7684\u533a\u57df<\/li>\n<li>\u5b9e\u4f8b\u89c4\u683c&#xff1a;2\u6838CPU\u30014GB\u5185\u5b58<\/li>\n<li>\u7cfb\u7edf\u955c\u50cf&#xff1a;Ubuntu 20.04 LTS<\/li>\n<li>\u5b58\u50a8&#xff1a;\u81f3\u5c1160GB SSD<\/li>\n<li>\u5e26\u5bbd&#xff1a;\u5efa\u8bae5Mbps\u53ca\u4ee5\u4e0a<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u914d\u7f6e\u5b89\u5168\u7ec4\u89c4\u5219<\/p>\n<ul>\n<li>\u5728\u5b9e\u4f8b\u8be6\u60c5\u9875\u627e\u5230&#034;\u5b89\u5168\u7ec4&#034;\u914d\u7f6e<\/li>\n<li>\u6dfb\u52a0\u4ee5\u4e0b\u7aef\u53e3\u89c4\u5219&#xff1a;\n<ul>\n<li>80\u7aef\u53e3&#xff08;HTTP&#xff09;<\/li>\n<li>443\u7aef\u53e3&#xff08;HTTPS&#xff09;<\/li>\n<li>3000\u7aef\u53e3&#xff08;Dify\u9ed8\u8ba4\u7aef\u53e3&#xff09;<\/li>\n<li>8000\u7aef\u53e3&#xff08;\u5907\u7528API\u7aef\u53e3&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\u8bbe\u7f6e\u6e90IP\u4e3a0.0.0.0\/0&#xff08;\u5141\u8bb8\u6240\u6709IP\u8bbf\u95ee&#xff09;\u6216\u6307\u5b9a\u7279\u5b9aIP\u6bb5<\/li>\n<\/ul>\n<\/li>\n<h3>\u90e8\u7f72Dify\u5e73\u53f0<\/h3>\n<h4>\u6b65\u9aa4\u4e00&#xff1a;\u90e8\u7f72Dify<\/h4>\n<h5>1.1 \u8fde\u63a5\u670d\u52a1\u5668<\/h5>\n<p># \u4f7f\u7528\u7ec8\u7aefSSH\u8fde\u63a5\u5230\u4f60\u7684\u963f\u91cc\u4e91\u670d\u52a1\u5668<br \/>\n# \u66ff\u6362\u4ee5\u4e0b\u547d\u4ee4\u4e2d\u7684IP\u5730\u5740\u548c\u5bc6\u7801<br \/>\nssh root&#064;\u4f60\u7684\u670d\u52a1\u5668IP<br \/>\n# \u8f93\u5165\u670d\u52a1\u5668\u5bc6\u7801\u540e\u6309\u56de\u8f66<\/p>\n<h5>1.2 \u5b89\u88c5Docker\u548cDocker Compose<\/h5>\n<p># \u66f4\u65b0\u7cfb\u7edf\u8f6f\u4ef6\u5305<br \/>\napt update &amp;&amp; apt upgrade -y<\/p>\n<p># \u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56<br \/>\napt install -y apt-transport-https ca-certificates curl software-properties-common<\/p>\n<p># \u6dfb\u52a0Docker\u5b98\u65b9GPG\u5bc6\u94a5<br \/>\ncurl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo apt-key add &#8211;<\/p>\n<p># \u6dfb\u52a0Docker\u7a33\u5b9a\u7248\u4ed3\u5e93<br \/>\nadd-apt-repository &#034;deb [arch&#061;amd64] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable&#034;<\/p>\n<p># \u518d\u6b21\u66f4\u65b0\u8f6f\u4ef6\u5305\u7d22\u5f15<br \/>\napt update<\/p>\n<p># \u5b89\u88c5Docker CE<br \/>\napt install -y docker-ce docker-ce-cli containerd.io<\/p>\n<p># \u9a8c\u8bc1Docker\u5b89\u88c5<br \/>\ndocker &#8211;version<\/p>\n<p># \u5b89\u88c5Docker Compose<br \/>\ncurl -L &#034;https:\/\/github.com\/docker\/compose\/releases\/latest\/download\/docker-compose-$(uname -s)-$(uname -m)&#034; -o \/usr\/local\/bin\/docker-compose<\/p>\n<p># \u8d4b\u4e88\u6267\u884c\u6743\u9650<br \/>\nchmod &#043;x \/usr\/local\/bin\/docker-compose<\/p>\n<p># \u9a8c\u8bc1Docker Compose\u5b89\u88c5<br \/>\ndocker-compose &#8211;version<\/p>\n<p># \u542f\u52a8Docker\u670d\u52a1\u5e76\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f<br \/>\nsystemctl start docker<br \/>\nsystemctl enable docker<\/p>\n<h5>1.3 \u90e8\u7f72Dify<\/h5>\n<p># \u514b\u9686Dify\u5b98\u65b9GitHub\u4ed3\u5e93<br \/>\ngit clone https:\/\/github.com\/langgenius\/dify.git<\/p>\n<p># \u8fdb\u5165docker\u76ee\u5f55<br \/>\ncd dify\/docker<\/p>\n<p># \u590d\u5236\u73af\u5883\u53d8\u91cf\u793a\u4f8b\u6587\u4ef6<br \/>\ncp .env.example .env<\/p>\n<p># \u4f7f\u7528vim\u7f16\u8f91\u73af\u5883\u53d8\u91cf\u6587\u4ef6<br \/>\nvim .env<\/p>\n<h5>1.4 \u914d\u7f6e.env\u6587\u4ef6<\/h5>\n<p># \u57fa\u7840\u914d\u7f6e<br \/>\nCONSOLE_WEB_URL&#061;http:\/\/\u4f60\u7684\u670d\u52a1\u5668IP<br \/>\nCONSOLE_API_URL&#061;http:\/\/\u4f60\u7684\u670d\u52a1\u5668IP\/console\/api<br \/>\nSERVICE_API_URL&#061;http:\/\/\u4f60\u7684\u670d\u52a1\u5668IP\/v1<br \/>\nAPP_WEB_URL&#061;http:\/\/\u4f60\u7684\u670d\u52a1\u5668IP\/app<\/p>\n<p># \u6570\u636e\u5e93\u914d\u7f6e<br \/>\nPOSTGRES_HOST&#061;db<br \/>\nPOSTGRES_PORT&#061;5432<br \/>\nPOSTGRES_DB&#061;dify<br \/>\nPOSTGRES_USER&#061;postgres<br \/>\nPOSTGRES_PASSWORD&#061;difyai123456  # \u5efa\u8bae\u66f4\u6539\u4e3a\u66f4\u590d\u6742\u7684\u5bc6\u7801<\/p>\n<p># Redis\u914d\u7f6e<br \/>\nREDIS_HOST&#061;redis<br \/>\nREDIS_PORT&#061;6379<br \/>\nREDIS_PASSWORD&#061;  # \u5982\u9700\u5b89\u5168\u8bbf\u95ee\u53ef\u8bbe\u7f6e\u5bc6\u7801<\/p>\n<p># \u91cd\u8981&#xff1a;\u5141\u8bb8\u5b89\u88c5\u672a\u9a8c\u8bc1\u63d2\u4ef6<br \/>\nFORCE_VERIFYING_SIGNATURE&#061;false  # \u5fc5\u987b\u8bbe\u7f6e\u4e3afalse\u624d\u80fd\u4f7f\u7528\u9ad8\u5fb7\u5730\u56fe\u63d2\u4ef6<\/p>\n<p># \u5176\u4ed6\u914d\u7f6e<br \/>\nSECRET_KEY&#061;sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U  # \u5efa\u8bae\u66f4\u6539\u4e3a\u968f\u673a\u5b57\u7b26\u4e32<br \/>\nENCRYPT_PUBLIC_KEY&#061;\u4f60\u7684\u52a0\u5bc6\u516c\u94a5  # \u53ef\u4fdd\u7559\u9ed8\u8ba4\u6216\u751f\u6210\u65b0\u7684<\/p>\n<p># \u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668\u914d\u7f6e<br \/>\nMCP_SERVERS_CONFIG&#061;&#039;{<br \/>\n  &#034;mcpServers&#034;: {<br \/>\n    &#034;amap-amap-sse&#034;: {<br \/>\n      &#034;url&#034;: &#034;https:\/\/mcp.amap.com\/sse?key&#061;\u60a8\u7684\u9ad8\u5fb7API Key&#034;<br \/>\n    }<br \/>\n  }<br \/>\n}&#039;<\/p>\n<p>\u00a0<\/p>\n<\/p>\n<p># 1.5 \u542f\u52a8Dify\u670d\u52a1<\/p>\n<p>## \u542f\u52a8\u6240\u6709\u670d\u52a1<br \/>\n\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8\u6240\u6709Dify\u5bb9\u5668\u670d\u52a1&#xff1a;<br \/>\n&#096;&#096;&#096;bash<br \/>\ndocker-compose up -d<\/p>\n<p>\u8be5\u547d\u4ee4\u5c06\u4ee5\u5b88\u62a4\u8fdb\u7a0b\u6a21\u5f0f(-d)\u542f\u52a8docker-compose.yml\u4e2d\u5b9a\u4e49\u7684\u6240\u6709\u670d\u52a1\u3002<\/p>\n<h3>\u67e5\u770b\u670d\u52a1\u72b6\u6001<\/h3>\n<p>\u542f\u52a8\u5b8c\u6210\u540e&#xff0c;\u68c0\u67e5\u670d\u52a1\u8fd0\u884c\u72b6\u6001&#xff1a;<\/p>\n<p>docker-compose ps<\/p>\n<p>\u6b63\u5e38\u72b6\u6001\u4e0b\u5e94\u663e\u793a&#xff1a;<\/p>\n<p>       Name                     Command               State           Ports<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\ndify-api        \/entrypoint.sh \/bin\/bash -c  &#8230;   Up (healthy)   5000\/tcp<br \/>\ndify-backend    \/entrypoint.sh \/bin\/bash -c  &#8230;   Up (healthy)<br \/>\ndify-frontend   \/docker-entrypoint.sh ngin &#8230;   Up (healthy)   80\/tcp, 443\/tcp<br \/>\ndify-mysql      docker-entrypoint.sh mysqld        Up (healthy)   3306\/tcp, 33060\/tcp<br \/>\ndify-redis      docker-entrypoint.sh redis &#8230;    Up (healthy)   6379\/tcp           <\/p>\n<h2>2. \u767b\u5f55Dify\u548c\u63a5\u5165\u5927\u6a21\u578b<\/h2>\n<h3>2.1 \u8bbf\u95eeDify\u63a7\u5236\u53f0<\/h3>\n<li>\u5728\u6d4f\u89c8\u5668\u8bbf\u95ee&#xff1a;http:\/\/&lt;\u4f60\u7684\u670d\u52a1\u5668IP&gt;<\/li>\n<li>\u9996\u6b21\u8bbf\u95ee\u9700\u8981&#xff1a;\n<ul>\n<li>\u521b\u5efa\u7ba1\u7406\u5458\u8d26\u53f7&#xff08;\u5efa\u8bae\u4f7f\u7528\u5f3a\u5bc6\u7801&#xff09;<\/li>\n<li>\u5b8c\u6210\u7cfb\u7edf\u521d\u59cb\u5316\u914d\u7f6e&#xff08;\u9009\u62e9\u8bed\u8a00\u3001\u65f6\u533a\u7b49&#xff09;<\/li>\n<li>\u8bbe\u7f6e\u7ec4\u7ec7\u4fe1\u606f<\/li>\n<\/ul>\n<\/li>\n<h3>2.2 \u914d\u7f6e\u5927\u6a21\u578b<\/h3>\n<li>\u8fdb\u5165\u3010\u8bbe\u7f6e\u3011\u2192\u3010\u6a21\u578b\u4f9b\u5e94\u5546\u3011<\/li>\n<li>\u6dfb\u52a0\u6a21\u578b\u63d0\u4f9b\u5546&#xff1a;\n<ul>\n<li>\u9009\u62e9OpenAI\u6216\u5176\u4ed6\u652f\u6301\u7684\u6a21\u578b\u63d0\u4f9b\u5546<\/li>\n<li>\u8f93\u5165\u6709\u6548\u7684API Key<\/li>\n<li>\u70b9\u51fb&#034;\u6d4b\u8bd5\u8fde\u63a5&#034;\u9a8c\u8bc1\u914d\u7f6e<\/li>\n<\/ul>\n<\/li>\n<li>\u91cd\u8981\u63d0\u793a&#xff1a;\n<ul>\n<li>\u786e\u4fddAPI Key\u6709\u8db3\u591f\u989d\u5ea6<\/li>\n<li>\u5efa\u8bae\u521b\u5efa\u4e13\u7528API Key\u7528\u4e8eDify<\/li>\n<li>\u53ef\u4ee5\u914d\u7f6e\u591a\u4e2a\u6a21\u578b\u4f9b\u5e94\u5546\u4f5c\u4e3a\u5907\u7528<\/li>\n<\/ul>\n<\/li>\n<h2>3. \u5b89\u88c5MCP\u63d2\u4ef6<\/h2>\n<h3>3.1 \u5b89\u88c5Agent\u7b56\u7565\u63d2\u4ef6<\/h3>\n<p># \u8fdb\u5165Dify API\u5bb9\u5668<br \/>\ndocker exec -it dify-api bash<\/p>\n<p># \u4e0b\u8f7d\u63d2\u4ef6\u5b89\u88c5\u811a\u672c<br \/>\ncurl -o install_plugin.py https:\/\/raw.githubusercontent.com\/junjiem\/dify-plugin-agent-mcp_sse\/main\/scripts\/install_plugin.py<\/p>\n<p># \u5b89\u88c5\u63d2\u4ef6&#xff08;\u7248\u672c0.0.6&#xff09;<br \/>\npython install_plugin.py https:\/\/github.com\/junjiem\/dify-plugin-agent-mcp_sse\/releases\/download\/v0.0.6\/junjiem-agent_mcp_sse-0.0.6.difypkg<\/p>\n<p># \u9000\u51fa\u5bb9\u5668\u5e76\u91cd\u542f\u670d\u52a1<br \/>\nexit<br \/>\ndocker-compose restart api<\/p>\n<h3>3.2 \u5b89\u88c5MCP SSE\u5de5\u5177\u63d2\u4ef6<\/h3>\n<p># \u518d\u6b21\u8fdb\u5165\u5bb9\u5668<br \/>\ndocker exec -it dify-api bash<\/p>\n<p># \u5b89\u88c5SSE\u5de5\u5177\u63d2\u4ef6<br \/>\npython install_plugin.py https:\/\/github.com\/junjiem\/dify-plugin-tools-mcp_sse\/releases\/download\/v0.0.6\/junjiem-mcp_sse-0.0.6.difypkg<\/p>\n<p># \u9000\u51fa\u5e76\u91cd\u542f<br \/>\nexit<br \/>\ndocker-compose restart api<\/p>\n<p>\u63d2\u4ef6\u5b89\u88c5\u5b8c\u6210\u540e&#xff1a;<\/p>\n<li>\u5728Dify\u9876\u90e8\u83dc\u5355\u70b9\u51fb\u3010\u5de5\u5177\u3011<\/li>\n<li>\u641c\u7d22\u6846\u4e2d\u8f93\u5165&#034;mcp&#034;<\/li>\n<li>\u70b9\u51fb\u5b89\u88c5&#xff0c;\u9009\u62e9\u4f20\u8f93\u65b9\u5f0f&#xff1a;\n<ul>\n<li>HTTP with SSE<\/li>\n<li>Streamable HTTP<\/li>\n<\/ul>\n<\/li>\n<li>\u5355\u6b21\u6388\u6743\u914d\u7f6e&#xff1a;\n<ul>\n<li>\u7c98\u8d34MCP Server\u914d\u7f6e\u5730\u5740<\/li>\n<li>\u793a\u4f8b\u5730\u5740&#xff1a;http:\/\/&lt;server_ip&gt;:3000<\/li>\n<\/ul>\n<\/li>\n<h2>4. \u9a8c\u8bc1\u63d2\u4ef6\u5b89\u88c5<\/h2>\n<li>\u767b\u5f55Dify\u63a7\u5236\u53f0<\/li>\n<li>\u8fdb\u5165\u3010\u8bbe\u7f6e\u3011\u2192\u3010\u63d2\u4ef6\u7ba1\u7406\u3011<\/li>\n<li>\u786e\u8ba4\u4ee5\u4e0b\u63d2\u4ef6\u72b6\u6001\u4e3a&#034;\u5df2\u542f\u7528&#034;&#xff1a;\n<ul>\n<li>Agent\u7b56\u7565(\u652f\u6301 MCP \u5de5\u5177)<\/li>\n<li>MCP SSE<\/li>\n<\/ul>\n<\/li>\n<h2>5. \u521b\u5efa\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668<\/h2>\n<h3>5.1 \u521b\u5efa\u9879\u76ee<\/h3>\n<p># \u521b\u5efa\u9879\u76ee\u76ee\u5f55<br \/>\nmkdir -p \/opt\/amap-mcp-server &amp;&amp; cd $_<\/p>\n<p># \u521d\u59cb\u5316Node.js\u9879\u76ee<br \/>\nnpm init -y<\/p>\n<p># \u5b89\u88c5\u4f9d\u8d56<br \/>\nnpm install &#064;modelcontextprotocol\/sdk axios dotenv<\/p>\n<h3>5.2 \u914d\u7f6eserver.js<\/h3>\n<p>\u521b\u5efaserver.js\u6587\u4ef6&#xff0c;\u5305\u542b\u4ee5\u4e0b\u529f\u80fd&#xff1a;<\/p>\n<li>\u5730\u7406\u7f16\u7801&#xff08;\u5730\u5740\u2192\u5750\u6807&#xff09;<\/li>\n<li>\u9006\u5730\u7406\u7f16\u7801&#xff08;\u5750\u6807\u2192\u5730\u5740&#xff09;<\/li>\n<li>\u5468\u8fb9POI\u641c\u7d22<\/li>\n<p>#!\/usr\/bin\/env node<br \/>\nimport { Server } from &#039;&#064;modelcontextprotocol\/sdk\/server\/index.js&#039;;<br \/>\nimport { StdioServerTransport } from &#039;&#064;modelcontextprotocol\/sdk\/server\/stdio.js&#039;;<br \/>\nimport { CallToolRequestSchema, ListToolsRequestSchema } from &#039;&#064;modelcontextprotocol\/sdk\/types.js&#039;;<br \/>\nimport axios from &#039;axios&#039;;<br \/>\nimport &#039;dotenv\/config&#039;;<\/p>\n<p>const AMAP_API_KEY &#061; process.env.AMAP_API_KEY;<br \/>\nconst AMAP_BASE_URL &#061; &#039;https:\/\/restapi.amap.com\/v3&#039;;<\/p>\n<p>\/\/ \u670d\u52a1\u5668\u5b9e\u73b0\u4ee3\u7801&#8230;<br \/>\n\/\/ \u5305\u542b\u4e09\u4e2a\u4e3b\u8981\u5de5\u5177\u65b9\u6cd5&#xff1a;<br \/>\n\/\/ &#8211; geocode(address, city)<br \/>\n\/\/ &#8211; regeocode(location)<br \/>\n\/\/ &#8211; aroundSearch(location, keywords, radius)<\/p>\n<h3>\u73af\u5883\u914d\u7f6e<\/h3>\n<li>\u521b\u5efa.env\u6587\u4ef6&#xff1a;<\/li>\n<p>AMAP_API_KEY&#061;\u4f60\u7684\u9ad8\u5fb7\u5730\u56feAPI_KEY<\/p>\n<h3>\u542f\u52a8\u670d\u52a1\u5668<\/h3>\n<p>node server.js<\/p>\n<p>\u63d0\u793a&#xff1a;\u5efa\u8bae\u4f7f\u7528pm2\u7b49\u8fdb\u7a0b\u7ba1\u7406\u5de5\u5177\u4fdd\u6301\u670d\u52a1\u6301\u7eed\u8fd0\u884c&#xff1a;<\/p>\n<p>npm install -g pm2<br \/>\npm2 start server.js &#8211;name amap-mcp<\/p>\n<h4>5.3 \u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/h4>\n<p>\u521b\u5efa .env \u6587\u4ef6\u7528\u4e8e\u5b58\u50a8\u654f\u611f\u4fe1\u606f\u548c\u914d\u7f6e\u53c2\u6570&#xff1a;<\/p>\n<p># \u9ad8\u5fb7\u5730\u56fe\u5f00\u53d1\u8005API Key<br \/>\nAMAP_API_KEY&#061;\u4f60\u7684\u9ad8\u5fb7\u5730\u56feAPI_Key<\/p>\n<p># \u8c03\u8bd5\u6a21\u5f0f\u8bbe\u7f6e<br \/>\nDEBUG&#061;true<\/p>\n<p># \u670d\u52a1\u5668\u7aef\u53e3\u914d\u7f6e<br \/>\nPORT&#061;3000<\/p>\n<p># MCP\u7b7e\u540d\u9a8c\u8bc1\u8bbe\u7f6e&#xff08;\u5f00\u53d1\u73af\u5883\u53ef\u5173\u95ed&#xff09;<br \/>\nFORCE_VERIFYING_SIGNATURE&#061;false<\/p>\n<p>\u6ce8\u610f\u4e8b\u9879&#xff1a;<\/p>\n<li>API Key\u5e94\u59a5\u5584\u4fdd\u7ba1&#xff0c;\u4e0d\u8981\u4e0a\u4f20\u5230\u516c\u5171\u4ee3\u7801\u4ed3\u5e93<\/li>\n<li>\u751f\u4ea7\u73af\u5883\u5efa\u8bae\u5c06DEBUG\u8bbe\u7f6e\u4e3afalse<\/li>\n<li>\u7aef\u53e3\u53f7\u53ef\u6839\u636e\u5b9e\u9645\u90e8\u7f72\u73af\u5883\u8c03\u6574<\/li>\n<h4>5.4 \u914d\u7f6epackage.json<\/h4>\n<p>\u5b8c\u6574\u9879\u76ee\u914d\u7f6e\u6587\u4ef6\u793a\u4f8b&#xff1a;<\/p>\n<p>{<br \/>\n  &#034;name&#034;: &#034;amap-mcp-server&#034;,<br \/>\n  &#034;version&#034;: &#034;1.0.0&#034;,<br \/>\n  &#034;description&#034;: &#034;\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u96c6\u6210&#034;,<br \/>\n  &#034;type&#034;: &#034;module&#034;,<br \/>\n  &#034;main&#034;: &#034;server.js&#034;,<br \/>\n  &#034;scripts&#034;: {<br \/>\n    &#034;start&#034;: &#034;node server.js&#034;,<br \/>\n    &#034;dev&#034;: &#034;nodemon server.js&#034;,<br \/>\n    &#034;test&#034;: &#034;jest&#034;<br \/>\n  },<br \/>\n  &#034;dependencies&#034;: {<br \/>\n    &#034;&#064;modelcontextprotocol\/sdk&#034;: &#034;^0.5.0&#034;,<br \/>\n    &#034;axios&#034;: &#034;^1.6.0&#034;,<br \/>\n    &#034;dotenv&#034;: &#034;^16.3.0&#034;,<br \/>\n    &#034;express&#034;: &#034;^4.18.2&#034;,<br \/>\n    &#034;cors&#034;: &#034;^2.8.5&#034;<br \/>\n  },<br \/>\n  &#034;devDependencies&#034;: {<br \/>\n    &#034;nodemon&#034;: &#034;^3.0.2&#034;,<br \/>\n    &#034;jest&#034;: &#034;^29.7.0&#034;<br \/>\n  },<br \/>\n  &#034;engines&#034;: {<br \/>\n    &#034;node&#034;: &#034;&gt;&#061;16.0.0&#034;<br \/>\n  }<br \/>\n}<\/p>\n<p>\u914d\u7f6e\u8bf4\u660e&#xff1a;<\/p>\n<li>type: &#034;module&#034; \u652f\u6301ES\u6a21\u5757<\/li>\n<li>\u6dfb\u52a0\u4e86\u5f00\u53d1\u4f9d\u8d56\u548c\u6d4b\u8bd5\u811a\u672c<\/li>\n<li>\u6307\u5b9a\u4e86Node.js\u7248\u672c\u8981\u6c42<\/li>\n<h4>5.5 \u542f\u52a8MCP\u670d\u52a1\u5668<\/h4>\n<p>\u8be6\u7ec6\u542f\u52a8\u6d41\u7a0b&#xff1a;<\/p>\n<p># 1. \u5b89\u88c5\u9879\u76ee\u4f9d\u8d56<br \/>\nnpm install<\/p>\n<p># 2. \u5f00\u53d1\u6a21\u5f0f\u542f\u52a8&#xff08;\u4f7f\u7528nodemon\u81ea\u52a8\u91cd\u542f&#xff09;<br \/>\nnpm run dev<\/p>\n<p># 3. \u751f\u4ea7\u73af\u5883\u542f\u52a8<br \/>\nnpm start<\/p>\n<p># 4. \u6d4b\u8bd5\u8fd0\u884c<br \/>\nnpm test<\/p>\n<p>\u542f\u52a8\u540e\u68c0\u67e5&#xff1a;<\/p>\n<li>\u8bbf\u95eehttp:\/\/localhost:3000\/status\u9a8c\u8bc1\u670d\u52a1\u72b6\u6001<\/li>\n<li>\u67e5\u770b\u63a7\u5236\u53f0\u8f93\u51fa\u786e\u8ba4\u65e0\u9519\u8bef<\/li>\n<li>\u68c0\u67e5\u7aef\u53e3\u5360\u7528\u60c5\u51b5<\/li>\n<h4>6.1 \u521b\u5efa\u667a\u80fd\u52a9\u624b\u5e94\u7528<\/h4>\n<p>\u8be6\u7ec6\u521b\u5efa\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u767b\u5f55Dify\u63a7\u5236\u53f0&#xff08;https:\/\/cloud.dify.ai&#xff09;<\/li>\n<li>\u8fdb\u5165&#034;\u5e94\u7528\u7ba1\u7406&#034; \u2192 &#034;\u65b0\u5efa\u5e94\u7528&#034;<\/li>\n<li>\u9009\u62e9&#034;\u667a\u80fd\u52a9\u624b&#034;\u6a21\u677f<\/li>\n<li>\u586b\u5199\u5e94\u7528\u4fe1\u606f&#xff1a;\n<ul>\n<li>\u5e94\u7528\u540d\u79f0&#xff1a;\u5730\u56fe\u52a9\u624b<\/li>\n<li>\u5e94\u7528\u5206\u7c7b&#xff1a;\u5de5\u5177\u7c7b<\/li>\n<li>\u5e94\u7528\u63cf\u8ff0&#xff1a;\u57fa\u4e8e\u9ad8\u5fb7\u5730\u56fe\u7684\u667a\u80fd\u4f4d\u7f6e\u670d\u52a1\u52a9\u624b<\/li>\n<\/ul>\n<\/li>\n<li>\u70b9\u51fb&#034;\u786e\u8ba4\u521b\u5efa&#034;<\/li>\n<h4>6.2 \u914d\u7f6e\u7cfb\u7edf\u63d0\u793a\u8bcd<\/h4>\n<p>\u65c5\u6e38\u52a9\u624b\u6a21\u677f\u7684\u8be6\u7ec6\u914d\u7f6e&#xff1a;<\/p>\n<p>\u4f60\u662f\u4e00\u4f4d\u667a\u80fd\u65c5\u6e38\u52a9\u624b&#xff0c;\u540d\u5b57\u53eb\u5730\u56fe\u5c0f\u52a9\u624b&#xff0c;\u4e13\u95e8\u4e3a\u7528\u6237\u63d0\u4f9b\u5730\u7406\u4f4d\u7f6e\u548c\u65c5\u6e38\u4fe1\u606f\u67e5\u8be2\u670d\u52a1\u3002<\/p>\n<p>\u670d\u52a1\u89c4\u5219&#xff1a;<br \/>\n1\u3001\u4f18\u5148\u4f7f\u7528MCP\u5730\u56fe\u5de5\u5177\u83b7\u53d6\u51c6\u786e\u7684\u5730\u7406\u4fe1\u606f&#xff1b;<br \/>\n2\u3001\u5f53\u7528\u6237\u8be2\u95ee&#034;\u4f4d\u7f6e\u4fe1\u606f&#034;\u65f6&#xff0c;\u8bf7\u8fd9\u6837\u56de\u7b54&#xff1a;&#034;\u8be5\u5730\u70b9\u4f4d\u4e8e[\u7701\u5e02\u533a]&#xff0c;\u5177\u4f53\u5730\u5740\u4e3a[\u8be6\u7ec6\u5730\u5740]&#xff0c;\u7ecf\u7eac\u5ea6\u5750\u6807\u4e3a[\u7ecf\u5ea6,\u7eac\u5ea6]&#034;&#xff1b;<br \/>\n3\u3001\u5f53\u7528\u6237\u8be2\u95ee&#034;\u5468\u8fb9\u666f\u70b9&#034;\u65f6&#xff0c;\u8bf7\u8fd9\u6837\u56de\u7b54&#xff1a;&#034;\u8be5\u4f4d\u7f6e\u5468\u8fb9\u4e3b\u8981\u666f\u70b9\u6709&#xff1a;[\u666f\u70b91]&#xff08;\u8ddd\u79bb\u7ea6X\u516c\u91cc&#xff09;\u3001[\u666f\u70b92]&#xff08;\u8ddd\u79bb\u7ea6X\u516c\u91cc&#xff09;\u3001[\u666f\u70b93]&#xff08;\u8ddd\u79bb\u7ea6X\u516c\u91cc&#xff09;&#034;&#xff1b;<br \/>\n4\u3001\u5f53\u7528\u6237\u8be2\u95ee&#034;\u4ea4\u901a\u6307\u5357&#034;\u65f6&#xff0c;\u8bf7\u8fd9\u6837\u56de\u7b54&#xff1a;&#034;\u53ef\u4e58\u5750\u5730\u94c1[X\u53f7\u7ebf]\u5230[\u7ad9\u540d]&#xff0c;\u6216\u4e58\u5750\u516c\u4ea4[\u7ebf\u8def\u53f7]\u5230[\u7ad9\u540d]&#xff1b;\u81ea\u9a7e\u8f66\u53ef\u901a\u8fc7[\u4e3b\u8981\u9053\u8def]\u5230\u8fbe&#xff0c;\u5468\u8fb9\u6709\u505c\u8f66\u573a&#034;&#xff1b;<br \/>\n5\u3001\u5f53\u7528\u6237\u8be2\u95ee&#034;\u5468\u8fb9\u8bbe\u65bd&#034;\u65f6&#xff0c;\u8bf7\u8fd9\u6837\u56de\u7b54&#xff1a;&#034;\u5468\u8fb9\u8bbe\u65bd\u5305\u62ec&#xff1a;\u9910\u996e&#xff08;[\u9910\u5385\u540d\u79f0]\u7b49&#xff09;\u3001\u4f4f\u5bbf&#xff08;[\u9152\u5e97\u540d\u79f0]\u7b49&#xff09;\u3001\u8d2d\u7269&#xff08;[\u5546\u573a\u540d\u79f0]\u7b49&#xff09;\u3001\u533b\u7597&#xff08;[\u533b\u9662\u540d\u79f0]\u7b49&#xff09;&#034;&#xff1b;<br \/>\n6\u3001\u5f53\u7528\u6237\u8be2\u95ee&#034;\u6700\u4f73\u8def\u7ebf&#034;\u65f6&#xff0c;\u8bf7\u8fd9\u6837\u56de\u7b54&#xff1a;&#034;\u4ece[\u8d77\u70b9]\u5230[\u7ec8\u70b9]&#xff0c;\u5efa\u8bae\u8def\u7ebf&#xff1a;[\u5177\u4f53\u8def\u7ebf\u63cf\u8ff0]&#xff0c;\u9884\u8ba1\u7528\u65f6[\u65f6\u95f4]&#xff0c;\u8ddd\u79bb\u7ea6[\u516c\u91cc\u6570]&#034;&#xff1b;<br \/>\n7\u3001\u5982\u679c\u65e0\u6cd5\u67e5\u8be2\u5230\u76f8\u5173\u4fe1\u606f&#xff0c;\u8bf7\u56de\u590d&#xff1a;&#034;\u62b1\u6b49&#xff0c;\u6682\u65f6\u65e0\u6cd5\u83b7\u53d6\u8be5\u4f4d\u7f6e\u7684\u8be6\u7ec6\u4fe1\u606f&#xff0c;\u5efa\u8bae\u60a8\u6838\u5b9e\u5730\u5740\u6216\u7a0d\u540e\u91cd\u8bd5&#034;\u3002<\/p>\n<h4>6.3 \u6dfb\u52a0MCP\u5de5\u5177<\/h4>\n<p>\u8be6\u7ec6\u914d\u7f6e\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u5728Dify\u5e94\u7528\u7f16\u8f91\u754c\u9762&#xff0c;\u5bfc\u822a\u81f3&#034;\u5de5\u5177\u914d\u7f6e&#034;<\/li>\n<li>\u70b9\u51fb&#034;\u6dfb\u52a0\u5de5\u5177&#034;\u6309\u94ae<\/li>\n<li>\u9009\u62e9&#034;MCP SSE&#034;\u7c7b\u578b<\/li>\n<li>\u914d\u7f6e\u8fde\u63a5\u65b9\u5f0f&#xff1a;\n<ul>\n<li>HTTP\u6a21\u5f0f&#xff1a;http:\/\/your-server-ip:3000\/mcp<\/li>\n<li>Stdio\u6a21\u5f0f&#xff1a;node \/path\/to\/server.js<\/li>\n<\/ul>\n<\/li>\n<li>\u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4&#xff08;\u5efa\u8bae30000ms&#xff09;<\/li>\n<li>\u6d4b\u8bd5\u8fde\u63a5\u6210\u529f\u540e\u4fdd\u5b58\u914d\u7f6e<\/li>\n<h4>6.4 \u914d\u7f6eAgent\u7b56\u7565<\/h4>\n<p>\u7b56\u7565\u914d\u7f6e\u8981\u70b9&#xff1a;<\/p>\n<li>\u9009\u62e9&#034;Agent\u7b56\u7565(\u652f\u6301 MCP \u5de5\u5177)&#034;<\/li>\n<li>\u8bbe\u7f6e\u5de5\u5177\u8c03\u7528\u6743\u9650&#xff1a;\n<ul>\n<li>\u5141\u8bb8\u81ea\u52a8\u8c03\u7528MCP\u5de5\u5177<\/li>\n<li>\u8bbe\u7f6e\u6700\u5927\u91cd\u8bd5\u6b21\u6570&#xff08;\u5efa\u8bae3\u6b21&#xff09;<\/li>\n<li>\u914d\u7f6e\u5de5\u5177\u8c03\u7528\u8d85\u65f6&#xff08;\u5efa\u8bae5000ms&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\u8bbe\u7f6e\u54cd\u5e94\u4f18\u5148\u7ea7&#xff1a;\n<ul>\n<li>\u4f18\u5148\u4f7f\u7528MCP\u83b7\u53d6\u7684\u6570\u636e<\/li>\n<li>\u6b21\u9009\u5185\u7f6e\u77e5\u8bc6\u5e93<\/li>\n<\/ul>\n<\/li>\n<li>\u4fdd\u5b58\u7b56\u7565\u914d\u7f6e<\/li>\n<h4>7.1 \u4f7f\u7528PM2\u7ba1\u7406MCP\u670d\u52a1\u5668<\/h4>\n<p>\u751f\u4ea7\u73af\u5883\u90e8\u7f72\u6307\u5357&#xff1a;<\/p>\n<p># \u5168\u5c40\u5b89\u88c5PM2\u8fdb\u7a0b\u7ba1\u7406\u5668<br \/>\nnpm install -g pm2<\/p>\n<p># \u521b\u5efaPM2\u914d\u7f6e\u6587\u4ef6<br \/>\ncat &gt; ecosystem.config.js &lt;&lt; EOF<br \/>\nmodule.exports &#061; {<br \/>\n  apps: [{<br \/>\n    name: &#039;amap-mcp-server&#039;,<br \/>\n    script: &#039;server.js&#039;,<br \/>\n    cwd: &#039;\/opt\/amap-mcp-server&#039;,<br \/>\n    instances: 2,  \/\/ \u6839\u636eCPU\u6838\u5fc3\u6570\u8bbe\u7f6e<br \/>\n    exec_mode: &#039;cluster&#039;,<br \/>\n    autorestart: true,<br \/>\n    watch: false,<br \/>\n    max_memory_restart: &#039;1G&#039;,<br \/>\n    env: {<br \/>\n      NODE_ENV: &#039;production&#039;,<br \/>\n      AMAP_API_KEY: &#039;your_production_key&#039;<br \/>\n    },<br \/>\n    log_date_format: &#039;YYYY-MM-DD HH:mm:ss&#039;,<br \/>\n    error_file: &#039;\/var\/log\/mcp-server\/err.log&#039;,<br \/>\n    out_file: &#039;\/var\/log\/mcp-server\/out.log&#039;,<br \/>\n    merge_logs: true<br \/>\n  }]<br \/>\n}<br \/>\nEOF<\/p>\n<p># \u521b\u5efa\u65e5\u5fd7\u76ee\u5f55<br \/>\nmkdir -p \/var\/log\/mcp-server<\/p>\n<p># \u542f\u52a8\u670d\u52a1<br \/>\npm2 start ecosystem.config.js<\/p>\n<p># \u8bbe\u7f6e\u5f00\u673a\u81ea\u542f<br \/>\npm2 save<br \/>\npm2 startup<\/p>\n<h4>7.2 \u914d\u7f6eNginx\u53cd\u5411\u4ee3\u7406<\/h4>\n<p>\u5b89\u5168\u90e8\u7f72\u65b9\u6848&#xff1a;<\/p>\n<p># \u5b89\u88c5Nginx<br \/>\nsudo apt update &amp;&amp; sudo apt install -y nginx<\/p>\n<p># \u521b\u5efaSSL\u8bc1\u4e66&#xff08;\u53ef\u9009&#xff09;<br \/>\nsudo apt install -y certbot python3-certbot-nginx<br \/>\nsudo certbot &#8211;nginx -d yourdomain.com<\/p>\n<p># \u914d\u7f6eNginx<br \/>\nsudo tee \/etc\/nginx\/sites-available\/mcp-server &lt;&lt; EOF<br \/>\nserver {<br \/>\n    listen 80;<br \/>\n    server_name yourdomain.com;<br \/>\n    return 301 https:\/\/\\\\$host\\\\$request_uri;<br \/>\n}<\/p>\n<p>server {<br \/>\n    listen 443 ssl;<br \/>\n    server_name yourdomain.com;<\/p>\n<p>    ssl_certificate \/etc\/letsencrypt\/live\/yourdomain.com\/fullchain.pem;<br \/>\n    ssl_certificate_key \/etc\/letsencrypt\/live\/yourdomain.com\/privkey.pem;<\/p>\n<p>    location \/ {<br \/>\n        proxy_pass http:\/\/localhost:3000;<br \/>\n        proxy_http_version 1.1;<br \/>\n        proxy_set_header Upgrade \\\\$http_upgrade;<br \/>\n        proxy_set_header Connection &#039;upgrade&#039;;<br \/>\n        proxy_set_header Host \\\\$host;<br \/>\n        proxy_set_header X-Real-IP \\\\$remote_addr;<br \/>\n        proxy_set_header X-Forwarded-For \\\\$proxy_add_x_forwarded_for;<br \/>\n        proxy_cache_bypass \\\\$http_upgrade;<br \/>\n        proxy_read_timeout 300;<br \/>\n    }<\/p>\n<p>    access_log \/var\/log\/nginx\/mcp-access.log;<br \/>\n    error_log \/var\/log\/nginx\/mcp-error.log;<br \/>\n}<br \/>\nEOF<\/p>\n<p># \u542f\u7528\u914d\u7f6e<br \/>\nsudo ln -s \/etc\/nginx\/sites-available\/mcp-server \/etc\/nginx\/sites-enabled\/<br \/>\nsudo nginx -t<br \/>\nsudo systemctl restart nginx<\/p>\n<h4>8.1 \u57fa\u7840\u529f\u80fd\u6d4b\u8bd5<\/h4>\n<p>\u6d4b\u8bd5\u7528\u4f8b\u8868&#xff1a;<\/p>\n<table>\n<tr>\u6d4b\u8bd5\u7c7b\u578b\u6d4b\u8bd5\u6307\u4ee4\u9884\u671f\u7ed3\u679c<\/tr>\n<tbody>\n<tr>\n<td>\u5750\u6807\u67e5\u8be2<\/td>\n<td>&#034;\u67e5\u8be2\u4e0a\u6d77\u4e1c\u65b9\u660e\u73e0\u7684\u5750\u6807&#034;<\/td>\n<td>\u8fd4\u56de\u7cbe\u786e\u7ecf\u7eac\u5ea6<\/td>\n<\/tr>\n<tr>\n<td>\u9006\u5730\u7406\u7f16\u7801<\/td>\n<td>&#034;121.499740,31.239670\u5728\u54ea\u91cc&#034;<\/td>\n<td>\u8fd4\u56de&#034;\u4e0a\u6d77\u5e02\u6d66\u4e1c\u65b0\u533a&#034;<\/td>\n<\/tr>\n<tr>\n<td>\u5468\u8fb9\u641c\u7d22<\/td>\n<td>&#034;\u641c\u7d22\u5317\u4eac\u897f\u7ad9\u9644\u8fd1\u7684\u9910\u5385&#034;<\/td>\n<td>\u8fd4\u56de5\u4e2a\u9910\u5385\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>\u8def\u5f84\u89c4\u5212<\/td>\n<td>&#034;\u4ece\u5317\u4eac\u7ad9\u5230\u9996\u90fd\u673a\u573a\u600e\u4e48\u8d70&#034;<\/td>\n<td>\u8fd4\u56de\u591a\u6761\u4ea4\u901a\u65b9\u6848<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>8.2 \u4e1a\u52a1\u89c4\u5219\u6d4b\u8bd5<\/h4>\n<p>\u683c\u5f0f\u9a8c\u8bc1\u8981\u70b9&#xff1a;<\/p>\n<li>\u68c0\u67e5\u5730\u5740\u4fe1\u606f\u662f\u5426\u5305\u542b\u5b8c\u6574\u884c\u653f\u533a\u5212<\/li>\n<li>\u9a8c\u8bc1\u8ddd\u79bb\u5355\u4f4d\u662f\u5426\u7edf\u4e00\u4f7f\u7528&#034;\u516c\u91cc&#034;<\/li>\n<li>\u786e\u4fdd\u8def\u7ebf\u63cf\u8ff0\u5305\u542b\u9884\u8ba1\u7528\u65f6<\/li>\n<li>\u6d4b\u8bd5\u9519\u8bef\u5904\u7406\u662f\u5426\u7b26\u5408\u89c4\u8303<\/li>\n<h4>\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h4>\n<p>\u8be6\u7ec6\u6392\u9519\u6307\u5357&#xff1a;<\/p>\n<li>\n<p>\u63d2\u4ef6\u5b89\u88c5\u95ee\u9898<\/p>\n<ul>\n<li>\u68c0\u67e5Node.js\u7248\u672c&#xff08;\u8981\u6c42\u226516&#xff09;<\/li>\n<li>\u786e\u8ba4\u4f9d\u8d56\u5b89\u88c5\u5b8c\u6574<\/li>\n<li>\u67e5\u770bnpm\u9519\u8bef\u65e5\u5fd7<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>MCP\u8fde\u63a5\u95ee\u9898<\/p>\n<p> # \u68c0\u67e5\u670d\u52a1\u72b6\u6001<br \/>\ncurl -v http:\/\/localhost:3000\/status<\/p>\n<p># \u7aef\u53e3\u68c0\u6d4b<br \/>\nnetstat -tulnp | grep 3000<\/p>\n<p># \u67e5\u770b\u65e5\u5fd7<br \/>\njournalctl -u mcp-server -f<\/p>\n<\/li>\n<li>\n<p>API\u8c03\u7528\u9650\u5236<\/p>\n<ul>\n<li>\u5b9e\u65bd\u8bf7\u6c42\u7f13\u5b58<\/li>\n<li>\u4f7f\u7528\u6279\u5904\u7406\u63a5\u53e3<\/li>\n<li>\u76d1\u63a7API\u4f7f\u7528\u91cf<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5b89\u5168\u5efa\u8bae<\/p>\n<ul>\n<li>\u5b9a\u671f\u8f6e\u6362API Key<\/li>\n<li>\u914d\u7f6eIP\u767d\u540d\u5355<\/li>\n<li>\u542f\u7528HTTPS\u52a0\u5bc6<\/li>\n<li>\u8bbe\u7f6e\u8bbf\u95ee\u9891\u7387\u9650\u5236<\/li>\n<\/ul>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf16\u6b21\u3002\u8be5\u547d\u4ee4\u5c06\u4ee5\u5b88\u62a4\u8fdb\u7a0b\u6a21\u5f0f(-d)\u542f\u52a8docker-compose.yml\u4e2d\u5b9a\u4e49\u7684\u6240\u6709\u670d\u52a1\u3002\u767b\u5f55\u6210\u529f\u540e\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2&quot;\u63a7\u5236\u53f0&quot;\u8fdb\u5165\u7ba1\u7406\u754c\u9762\u3002\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u8f93\u5165\u7f51\u5740\u3002\u8fdb\u5165\u9ad8\u5fb7\u5730\u56fe\u5f00\u653e\u5e73\u53f0\u3002_\u9ad8\u5fb7\u5730\u56femcp<\/p>\n","protected":false},"author":2,"featured_media":46087,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[97,43,96],"topic":[],"class_list":["post-46088","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-97","tag-43","tag-96"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u57fa\u4e8e\u963f\u91cc\u4e91Dify\u7684\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668 - \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\/46088.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u57fa\u4e8e\u963f\u91cc\u4e91Dify\u7684\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf16\u6b21\u3002\u8be5\u547d\u4ee4\u5c06\u4ee5\u5b88\u62a4\u8fdb\u7a0b\u6a21\u5f0f(-d)\u542f\u52a8docker-compose.yml\u4e2d\u5b9a\u4e49\u7684\u6240\u6709\u670d\u52a1\u3002\u767b\u5f55\u6210\u529f\u540e\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2&quot;\u63a7\u5236\u53f0&quot;\u8fdb\u5165\u7ba1\u7406\u754c\u9762\u3002\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u8f93\u5165\u7f51\u5740\u3002\u8fdb\u5165\u9ad8\u5fb7\u5730\u56fe\u5f00\u653e\u5e73\u53f0\u3002_\u9ad8\u5fb7\u5730\u56femcp\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/46088.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-29T18:17:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729181756-688910546571c.png\" \/>\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\/46088.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/46088.html\",\"name\":\"\u57fa\u4e8e\u963f\u91cc\u4e91Dify\u7684\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-29T18:17:57+00:00\",\"dateModified\":\"2025-07-29T18:17:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/46088.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/46088.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/46088.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u57fa\u4e8e\u963f\u91cc\u4e91Dify\u7684\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668\"}]},{\"@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":"\u57fa\u4e8e\u963f\u91cc\u4e91Dify\u7684\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668 - \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\/46088.html","og_locale":"zh_CN","og_type":"article","og_title":"\u57fa\u4e8e\u963f\u91cc\u4e91Dify\u7684\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf16\u6b21\u3002\u8be5\u547d\u4ee4\u5c06\u4ee5\u5b88\u62a4\u8fdb\u7a0b\u6a21\u5f0f(-d)\u542f\u52a8docker-compose.yml\u4e2d\u5b9a\u4e49\u7684\u6240\u6709\u670d\u52a1\u3002\u767b\u5f55\u6210\u529f\u540e\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2&quot;\u63a7\u5236\u53f0&quot;\u8fdb\u5165\u7ba1\u7406\u754c\u9762\u3002\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u8f93\u5165\u7f51\u5740\u3002\u8fdb\u5165\u9ad8\u5fb7\u5730\u56fe\u5f00\u653e\u5e73\u53f0\u3002_\u9ad8\u5fb7\u5730\u56femcp","og_url":"https:\/\/www.wsisp.com\/helps\/46088.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-29T18:17:57+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729181756-688910546571c.png"}],"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\/46088.html","url":"https:\/\/www.wsisp.com\/helps\/46088.html","name":"\u57fa\u4e8e\u963f\u91cc\u4e91Dify\u7684\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-29T18:17:57+00:00","dateModified":"2025-07-29T18:17:57+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/46088.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/46088.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/46088.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u57fa\u4e8e\u963f\u91cc\u4e91Dify\u7684\u9ad8\u5fb7\u5730\u56feMCP\u670d\u52a1\u5668"}]},{"@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\/46088","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=46088"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/46088\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/46087"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=46088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=46088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=46088"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=46088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}