{"id":10439,"date":"2025-04-18T17:59:26","date_gmt":"2025-04-18T09:59:26","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/10439.html"},"modified":"2025-04-18T17:59:26","modified_gmt":"2025-04-18T09:59:26","slug":"mcp-%e5%ae%9e%e6%88%98%e7%b3%bb%e5%88%97%ef%bc%88day-2%ef%bc%89-%e5%8a%a8%e6%89%8b%e6%90%93%e4%b8%aa%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f-mcp-%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/10439.html","title":{"rendered":"MCP \u5b9e\u6218\u7cfb\u5217\uff08Day 2\uff09- \u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \u670d\u52a1\u5668"},"content":{"rendered":"<p>\u4e0a\u671f\u56de\u987e&#xff1a;MCP \u5b9e\u6218\u7cfb\u5217&#xff08;Day 1&#xff09;- \u4ec0\u4e48\u662f MCP&#xff1f;<\/p>\n<p>\u5728\u4e0a\u671f\u6587\u7ae0\u4e2d&#xff0c;\u6211\u4eec\u8be6\u7ec6\u4ecb\u7ecd\u4e86 Model Context Protocol&#xff08;MCP&#xff09;\u7684\u57fa\u672c\u6982\u5ff5\u548c\u5e94\u7528\u573a\u666f\u3002\u672c\u8282\u5c06\u5e26\u9886\u5927\u5bb6\u5f00\u53d1\u4e00\u4e2a\u7b80\u6613\u7684 Filesystem MCP Server&#xff0c;\u901a\u8fc7\u4ee3\u7801\u793a\u4f8b\u9010\u6b65\u8bb2\u89e3\u5b9e\u73b0\u7ec6\u8282\u3002<\/p>\n<p>\u672c\u671f\u76ee\u6807&#xff1a;\u638c\u63e1 MCP Server \u5f00\u53d1\u7684\u57fa\u7840\u6846\u67b6&#xff0c;\u5b9e\u73b0\u4e00\u4e2a\u652f\u6301\u57fa\u672c\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c\u7684\u670d\u52a1\u5668\u3002<\/p>\n<p>\u5f00\u6e90\u5730\u5740&#xff1a;https:\/\/github.com\/jinzcdev\/mcp-demos<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418095915-6802227383b4c.jpg\" alt=\"\u8bf7\u6dfb\u52a0\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>\u5f00\u53d1\u73af\u5883\u51c6\u5907<\/h3>\n<p>\u5b98\u65b9\u63d0\u4f9b\u4e86 Python\u3001Node\u3001Java\u3001Kotlin\u3001C# \u4e94\u79cd\u8bed\u8a00\u7684 MCP \u670d\u52a1\u5668 SDK\u3002\u672c\u6587\u4ee5 Python \u4e3a\u4f8b\u8fdb\u884c\u5f00\u53d1&#xff0c;\u5176\u4ed6\u8bed\u8a00\u7684\u5b9e\u73b0\u65b9\u5f0f\u7c7b\u4f3c\u3002\u8bfb\u8005\u53ef\u6839\u636e\u5b9e\u9645\u9879\u76ee\u9700\u6c42\u9009\u62e9\u719f\u6089\u7684\u5f00\u53d1\u8bed\u8a00\u3002<\/p>\n<h4>MacOS\/Linux \u7cfb\u7edf<\/h4>\n<li>\u5b89\u88c5 uv \u5de5\u5177<\/li>\n<p><span class=\"token function\">curl<\/span> -LsSf https:\/\/astral.sh\/uv\/install.sh <span class=\"token operator\">|<\/span> <span class=\"token function\">sh<\/span><\/p>\n<li>\u521b\u5efa\u9879\u76ee\u76ee\u5f55\u5e76\u5b89\u88c5\u4f9d\u8d56<\/li>\n<p><span class=\"token comment\"># \u521b\u5efa\u9879\u76ee\u76ee\u5f55\u5e76\u8fdb\u5165<\/span><br \/>\nuv init simple-filesystem-server-python<br \/>\n<span class=\"token builtin class-name\">cd<\/span> simple-filesystem-server-python<\/p>\n<p><span class=\"token comment\"># \u521b\u5efa\u865a\u62df\u73af\u5883\u5e76\u6fc0\u6d3b<\/span><br \/>\nuv venv<br \/>\n<span class=\"token builtin class-name\">source<\/span> .venv\/bin\/activate<\/p>\n<p><span class=\"token comment\"># \u5b89\u88c5 MCP \u76f8\u5173\u4f9d\u8d56<\/span><br \/>\nuv <span class=\"token function\">add<\/span> <span class=\"token string\">&#034;mcp[cli]&#034;<\/span><\/p>\n<p><span class=\"token comment\"># \u521b\u5efa MCP Server \u6587\u4ef6<\/span><br \/>\n<span class=\"token function\">touch<\/span> simple_filesystem.py<\/p>\n<p>\u8bf4\u660e&#xff1a;uv \u662f\u4e00\u4e2a\u9ad8\u6548\u7684 Python \u5305\u7ba1\u7406\u5de5\u5177&#xff0c;\u529f\u80fd\u7c7b\u4f3c pip\u3002\u5982\u679c\u66f4\u719f\u6089 pip&#xff0c;\u4e5f\u53ef\u4ee5\u4f7f\u7528 pip install &#034;mcp[cli]&#034; \u5b89\u88c5\u4f9d\u8d56\u6216\u521b\u5efa\u865a\u62df\u73af\u5883\u3002mcp[cli] \u4e2d\u7684 cli \u8868\u793a\u989d\u5916\u5b89\u88c5 typer \u548c python-dotenv \u4e24\u4e2a\u5e93&#xff0c;\u524d\u8005\u7528\u4e8e\u521b\u5efa\u547d\u4ee4\u884c\u754c\u9762&#xff0c;\u540e\u8005\u7528\u4e8e\u52a0\u8f7d\u73af\u5883\u53d8\u91cf&#xff08;\u53ef\u901a\u8fc7\u67e5\u770b mcp \u4f9d\u8d56\u5e93\u6e90\u4ee3\u7801\u4e2d\u7684 project.optional-dependencies \u914d\u7f6e\u9879\u627e\u5230\u8fd9\u4e24\u4e2a\u989d\u5916\u4f9d\u8d56&#xff09;\u3002\u6700\u540e\u521b\u5efa\u7684 simple_filesystem.py \u6587\u4ef6\u662f\u5b9a\u4e49 MCP \u670d\u52a1\u7684\u6838\u5fc3\u6e90\u6587\u4ef6&#xff0c;\u6211\u4eec\u5c06\u5728\u5176\u4e2d\u521b\u5efa\u76f8\u5173\u5de5\u5177\u3002<\/p>\n<h3>\u7f16\u5199 MCP Server \u4ee3\u7801<\/h3>\n<p>\u6211\u4eec\u5c06\u5b9e\u73b0\u4e00\u4e2a\u7b80\u6613\u7684 Filesystem MCP Server&#xff0c;\u652f\u6301\u5728\u6307\u5b9a\u76ee\u5f55\u4e2d\u8fdb\u884c\u6587\u4ef6\u67e5\u627e\u3001\u8bfb\u5199\u7b49\u64cd\u4f5c\u3002<\/p>\n<p>\u503c\u5f97\u4e00\u63d0\u7684\u662f&#xff0c;Claude \u5b98\u65b9\u5df2\u7ecf\u63d0\u4f9b\u4e86\u4e00\u4e2a\u529f\u80fd\u5b8c\u5907\u7684 Node.js \u7248\u672c Filesystem MCP Server&#xff0c;\u5305\u542b\u4e86\u4e30\u5bcc\u7684\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c\u5de5\u5177\u3002\u672c\u6587\u9009\u62e9\u4f7f\u7528 Python \u91cd\u65b0\u5b9e\u73b0&#xff0c;\u76ee\u7684\u662f\u5e2e\u52a9\u8bfb\u8005\u66f4\u6e05\u6670\u5730\u7406\u89e3 MCP Server \u7684 \u5f00\u53d1\u6d41\u7a0b \u548c \u5de5\u5177\u8bbe\u8ba1\u601d\u8def&#xff0c;\u800c\u975e\u91cd\u590d\u9020\u8f6e\u5b50\u3002<\/p>\n<p>\u63a5\u4e0b\u6765&#xff0c;\u8ba9\u6211\u4eec\u9010\u6b65\u5b9e\u73b0\u8fd9\u4e2a\u670d\u52a1\u5668\u3002<\/p>\n<h4>1. \u5bfc\u5165\u5fc5\u8981\u6a21\u5757\u5e76\u521d\u59cb\u5316\u670d\u52a1\u5668<\/h4>\n<p>\u5b8c\u6210\u524d\u9762\u7684\u51c6\u5907\u6b65\u9aa4\u540e&#xff0c;\u6211\u4eec\u9996\u5148\u5728 simple_filesystem.py \u4e2d\u5bfc\u5165\u6240\u9700\u6a21\u5757&#xff0c;\u5e76\u901a\u8fc7\u547d\u4ee4\u884c\u53c2\u6570\u6307\u5b9a\u5141\u8bb8\u8bbf\u95ee\u7684\u76ee\u5f55&#xff1a;<\/p>\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<br \/>\n<span class=\"token keyword\">import<\/span> os<br \/>\n<span class=\"token keyword\">import<\/span> os<span class=\"token punctuation\">.<\/span>path <span class=\"token keyword\">as<\/span> osp<br \/>\n<span class=\"token keyword\">import<\/span> argparse<\/p>\n<p>parser <span class=\"token operator\">&#061;<\/span> argparse<span class=\"token punctuation\">.<\/span>ArgumentParser<span class=\"token punctuation\">(<\/span>description<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;Simple Filesystem MCP Server&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\nparser<span class=\"token punctuation\">.<\/span>add_argument<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;allowed_dirs&#034;<\/span><span class=\"token punctuation\">,<\/span> nargs<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;&#043;&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token builtin\">help<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;List of allowed directories for file operations&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\nargs <span class=\"token operator\">&#061;<\/span> parser<span class=\"token punctuation\">.<\/span>parse_args<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>allowed_directories <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span>osp<span class=\"token punctuation\">.<\/span>abspath<span class=\"token punctuation\">(<\/span>dir_path<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">for<\/span> dir_path <span class=\"token keyword\">in<\/span> args<span class=\"token punctuation\">.<\/span>allowed_dirs<span class=\"token punctuation\">]<\/span><\/p>\n<p>mcp <span class=\"token operator\">&#061;<\/span> FastMCP<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;SimpleFileSystemMCPServer&#034;<\/span><span class=\"token punctuation\">,<\/span> log_level<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;ERROR&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u8bf4\u660e&#xff1a;\u4f7f\u7528 argparse \u89e3\u6790\u547d\u4ee4\u884c\u53c2\u6570&#xff0c;\u5728 MCP \u670d\u52a1\u542f\u52a8\u65f6\u6307\u5b9a\u53ef\u8bbf\u95ee\u7684\u76ee\u5f55&#xff08;\u9632\u6b62 LLM \u8bbf\u95ee\u7cfb\u7edf\u4e2d\u7684\u4efb\u610f\u76ee\u5f55&#xff09;\u3002\u8fd9\u91cc FastMCP \u521d\u59cb\u5316\u4e86\u4e00\u4e2a\u540d\u4e3a Simple Filesystem MCP Server \u7684\u670d\u52a1\u5668\u5b9e\u4f8b&#xff0c;\u65e5\u5fd7\u7ea7\u522b\u8bbe\u4e3a ERROR&#xff08;\u6d4b\u8bd5\u65f6\u53d1\u73b0 Cline \u5ba2\u6237\u7aef\u56e0\u4e3a\u670d\u52a1\u8fd0\u884c\u65f6\u8f93\u51fa\u7684 INFO \u65e5\u5fd7\u5bfc\u81f4\u65e0\u6cd5\u5217\u4e3e\u670d\u52a1\u5de5\u5177&#xff0c;\u4f46\u4e0d\u5f71\u54cd\u5de5\u5177\u8c03\u7528&#xff09;\u3002<\/p>\n<h4>2. \u5b9e\u73b0\u5de5\u5177\u903b\u8f91<\/h4>\n<p>\u4f7f\u7528 &#064;mcp.tool \u88c5\u9970\u5668\u5b9a\u4e49\u4ee5\u4e0b\u529f\u80fd\u5de5\u5177&#xff0c;\u8fd9\u91cc\u7684 &#064;mcp.tool \u53ef\u4ee5\u7406\u89e3\u4e3a\u5728 MCP Server \u4e2d\u6ce8\u518c\u4e00\u4e2a\u5de5\u5177&#xff0c;\u4e0d\u5b9a\u4e49 name \u7684\u60c5\u51b5\u4e0b&#xff0c;\u5de5\u5177\u540d\u9ed8\u8ba4\u4e3a\u51fd\u6570\u540d\u79f0&#xff1a;<\/p>\n<h5>(1) list_directory &#8211; \u67e5\u627e\u6587\u4ef6\u548c\u76ee\u5f55<\/h5>\n<p><span class=\"token decorator annotation punctuation\">&#064;mcp<span class=\"token punctuation\">.<\/span>tool<\/span><span class=\"token punctuation\">(<\/span><br \/>\n    description<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;\u83b7\u53d6\u6307\u5b9a\u8def\u5f84\u4e0b\u7684\u6240\u6709\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u8be6\u7ec6\u5217\u8868\u3002\u8fd4\u56de\u7ed3\u679c\u4f1a\u901a\u8fc7 [FILE] \u548c [DIR] \u524d\u7f00\u660e\u786e\u533a\u5206\u6587\u4ef6\u7c7b\u578b\u3002\u8be5\u5de5\u5177\u5bf9\u4e8e\u4e86\u89e3\u76ee\u5f55\u7ed3\u6784\u53ca\u67e5\u627e\u7279\u5b9a\u6587\u4ef6\u975e\u5e38\u5b9e\u7528\u3002\u4ec5\u9650\u5728\u5141\u8bb8\u8bbf\u95ee\u7684\u76ee\u5f55\u4e2d\u64cd\u4f5c\u3002&#034;<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">list_directory<\/span><span class=\"token punctuation\">(<\/span>dir_path<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 keyword\">if<\/span> <span class=\"token keyword\">not<\/span> osp<span class=\"token punctuation\">.<\/span>exists<span class=\"token punctuation\">(<\/span>dir_path<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">or<\/span> <span class=\"token keyword\">not<\/span> osp<span class=\"token punctuation\">.<\/span>isdir<span class=\"token punctuation\">(<\/span>dir_path<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">raise<\/span> ValueError<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>dir_path<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> is not a valid directory&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    entries <span class=\"token operator\">&#061;<\/span> os<span class=\"token punctuation\">.<\/span>listdir<span class=\"token punctuation\">(<\/span>dir_path<span class=\"token punctuation\">)<\/span><br \/>\n    formatted <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> entry <span class=\"token keyword\">in<\/span> entries<span class=\"token punctuation\">:<\/span><br \/>\n        entry_path <span class=\"token operator\">&#061;<\/span> osp<span class=\"token punctuation\">.<\/span>join<span class=\"token punctuation\">(<\/span>dir_path<span class=\"token punctuation\">,<\/span> entry<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> osp<span class=\"token punctuation\">.<\/span>isdir<span class=\"token punctuation\">(<\/span>entry_path<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            formatted<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;[DIR] <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>entry<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">else<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            formatted<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;[FILE] <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>entry<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> <span class=\"token string\">&#034;\\\\n&#034;<\/span><span class=\"token punctuation\">.<\/span>join<span class=\"token punctuation\">(<\/span>formatted<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u8be5\u5de5\u5177\u8fd4\u56de\u6307\u5b9a\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u548c\u5b50\u76ee\u5f55\u5217\u8868&#xff0c;\u4f7f\u7528 [DIR] \u548c [FILE] \u524d\u7f00\u533a\u5206\u3002\u5f53\u76ee\u5f55\u4e0d\u5b58\u5728\u65f6\u629b\u51fa\u5f02\u5e38&#xff0c;\u5e2e\u52a9\u6a21\u578b\u7406\u89e3\u5f53\u524d\u6587\u4ef6\u7cfb\u7edf\u72b6\u6001\u3002<\/p>\n<p>\u6700\u521d\u5b9a\u4e49\u5de5\u5177\u65f6&#xff0c;\u6211\u91c7\u7528\u4e86 os.walk \u9012\u5f52\u8c03\u7528\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u76ee\u5f55\u904d\u5386&#xff0c;\u4f46\u76ee\u5f55\u4e2d\u53ef\u80fd\u5305\u542b\u5927\u91cf\u4f9d\u8d56\u6587\u4ef6&#xff08;\u5982 node_modules&#xff09;&#xff0c;\u6d6a\u8d39 Token \u6570&#xff0c;\u6240\u4ee5\u6211\u4eec\u53ea\u9700\u8981\u8fd4\u56de\u7b2c\u4e00\u5c42\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u5217\u8868\u5373\u53ef&#xff0c;\u5fc5\u8981\u65f6\u8ba9\u6a21\u578b\u7ee7\u7eed\u5411\u4e0b\u641c\u7d22\u5373\u53ef\u3002<\/p>\n<h5>(2) read_file &#8211; \u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9<\/h5>\n<p><span class=\"token decorator annotation punctuation\">&#064;mcp<span class=\"token punctuation\">.<\/span>tool<\/span><span class=\"token punctuation\">(<\/span><br \/>\n    description<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;\u8bfb\u53d6\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u5b8c\u6574\u6587\u4ef6\u5185\u5bb9\u3002\u652f\u6301\u5904\u7406\u591a\u79cd\u6587\u672c\u7f16\u7801\u683c\u5f0f&#xff0c;\u82e5\u8bfb\u53d6\u5931\u8d25\u5c06\u8fd4\u56de\u8be6\u7ec6\u9519\u8bef\u4fe1\u606f\u3002\u9002\u7528\u4e8e\u9700\u8981\u68c0\u67e5\u5355\u4e2a\u6587\u4ef6\u5185\u5bb9\u7684\u573a\u666f\u3002\u4ec5\u53ef\u5728\u5141\u8bb8\u8bbf\u95ee\u7684\u76ee\u5f55\u4e2d\u64cd\u4f5c\u3002&#034;<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">read_file<\/span><span class=\"token punctuation\">(<\/span>file_path<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 keyword\">if<\/span> <span class=\"token keyword\">not<\/span> osp<span class=\"token punctuation\">.<\/span>exists<span class=\"token punctuation\">(<\/span>file_path<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">or<\/span> <span class=\"token keyword\">not<\/span> osp<span class=\"token punctuation\">.<\/span>isfile<span class=\"token punctuation\">(<\/span>file_path<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">raise<\/span> ValueError<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>file_path<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> is not a valid file&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <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> <span class=\"token builtin\">file<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        content <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">file<\/span><span class=\"token punctuation\">.<\/span>read<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> content<\/p>\n<p>\u8be5\u5de5\u5177\u8bfb\u53d6\u5355\u4e2a\u6587\u4ef6\u5185\u5bb9&#xff0c;\u5f53\u6587\u4ef6\u4e0d\u5b58\u5728\u6216\u65e0\u6548\u65f6\u629b\u51fa\u5f02\u5e38\u3002<\/p>\n<p>\u6ce8\u610f&#xff1a;\u5982\u679c\u6587\u4ef6\u5185\u5bb9\u8fc7\u5927\u4e5f\u53ef\u80fd\u5bfc\u81f4 Token \u6570\u6ea2\u51fa&#xff0c;\u5b9e\u9645\u5f00\u53d1\u4e2d\u53ef\u8bbe\u7f6e\u5b57\u7b26\u6570\u9650\u5236&#xff0c;\u8d85\u8fc7\u5219\u622a\u65ad\u6216\u505a\u5176\u4ed6\u5904\u7406\u3002<\/p>\n<h5>(3) write_file &#8211; \u5199\u5165\u6587\u4ef6<\/h5>\n<p><span class=\"token decorator annotation punctuation\">&#064;mcp<span class=\"token punctuation\">.<\/span>tool<\/span><span class=\"token punctuation\">(<\/span><br \/>\n    description<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;\u521b\u5efa\u65b0\u6587\u4ef6\u6216\u5b8c\u5168\u8986\u76d6\u73b0\u6709\u6587\u4ef6\u5185\u5bb9\u3002\u4f7f\u7528\u65f6\u9700\u8c28\u614e&#xff0c;\u6b64\u64cd\u4f5c\u5c06\u76f4\u63a5\u8986\u76d6\u76ee\u6807\u6587\u4ef6\u4e14\u65e0\u8b66\u544a\u63d0\u793a\u3002\u652f\u6301\u6b63\u786e\u5904\u7406\u6587\u672c\u7f16\u7801&#xff0c;\u4ec5\u9650\u5728\u5141\u8bb8\u7684\u76ee\u5f55\u5185\u6267\u884c\u3002&#034;<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">write_file<\/span><span class=\"token punctuation\">(<\/span>file_path<span class=\"token punctuation\">,<\/span> content<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 keyword\">if<\/span> <span class=\"token keyword\">not<\/span> osp<span class=\"token punctuation\">.<\/span>exists<span class=\"token punctuation\">(<\/span>osp<span class=\"token punctuation\">.<\/span>dirname<span class=\"token punctuation\">(<\/span>file_path<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">raise<\/span> ValueError<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;Directory for <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>file_path<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> does not exist&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <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;w&#034;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> <span class=\"token builtin\">file<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token builtin\">file<\/span><span class=\"token punctuation\">.<\/span>write<span class=\"token punctuation\">(<\/span>content<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;Successfully wrote to <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>file_path<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><\/p>\n<p>\u8be5\u5de5\u5177\u5b9e\u73b0\u6587\u4ef6\u5199\u5165\u529f\u80fd&#xff0c;\u5728\u76ee\u6807\u76ee\u5f55\u4e0d\u5b58\u5728\u65f6\u629b\u51fa\u5f02\u5e38&#xff0c;\u6210\u529f\u5219\u8fd4\u56de\u786e\u8ba4\u4fe1\u606f\u3002<\/p>\n<p>\u6ce8\u610f&#xff1a;\u5199\u6587\u4ef6\u662f\u5371\u9669\u64cd\u4f5c&#xff0c;\u5efa\u8bae\u5728 MCP \u5de5\u5177\u8c03\u7528\u65f6\u786e\u8ba4\u662f\u5426\u6267\u884c\u8be5\u64cd\u4f5c&#xff0c;\u907f\u514d\u8bef\u64cd\u4f5c\u5bfc\u81f4\u6570\u636e\u4e22\u5931\u3002<\/p>\n<h5>(4) read_multiple_files &#8211; \u6279\u91cf\u8bfb\u53d6\u6587\u4ef6<\/h5>\n<p><span class=\"token decorator annotation punctuation\">&#064;mcp<span class=\"token punctuation\">.<\/span>tool<\/span><span class=\"token punctuation\">(<\/span><br \/>\n    description<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;\u540c\u65f6\u8bfb\u53d6\u591a\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u3002\u5f53\u9700\u8981\u5206\u6790\u6216\u6bd4\u8f83\u591a\u4e2a\u6587\u4ef6\u65f6&#xff0c;\u8fd9\u79cd\u65b9\u5f0f\u6bd4\u9010\u4e2a\u8bfb\u53d6\u66f4\u9ad8\u6548\u3002\u6bcf\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u5c06\u4e0e\u5176\u8def\u5f84\u4e00\u5e76\u8fd4\u56de&#xff0c;\u4fbf\u4e8e\u8ffd\u6eaf\u3002\u5373\u4f7f\u4e2a\u522b\u6587\u4ef6\u8bfb\u53d6\u5931\u8d25&#xff0c;\u4e5f\u4e0d\u4f1a\u4e2d\u65ad\u6574\u4f53\u64cd\u4f5c\u3002\u4ec5\u9650\u5728\u5141\u8bb8\u7684\u76ee\u5f55\u5185\u6267\u884c\u3002&#034;<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">read_multiple_files<\/span><span class=\"token punctuation\">(<\/span>file_paths<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    results <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> file_path <span class=\"token keyword\">in<\/span> file_paths<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">try<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">if<\/span> <span class=\"token keyword\">not<\/span> osp<span class=\"token punctuation\">.<\/span>exists<span class=\"token punctuation\">(<\/span>file_path<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">or<\/span> <span class=\"token keyword\">not<\/span> osp<span class=\"token punctuation\">.<\/span>isfile<span class=\"token punctuation\">(<\/span>file_path<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n                results<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>file_path<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">: Error &#8211; Not a valid file&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n                <span class=\"token keyword\">continue<\/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> <span class=\"token builtin\">file<\/span><span class=\"token punctuation\">:<\/span><br \/>\n                content <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">file<\/span><span class=\"token punctuation\">.<\/span>read<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n            results<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>file_path<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">:\\\\n<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>content<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">except<\/span> Exception <span class=\"token keyword\">as<\/span> e<span class=\"token punctuation\">:<\/span><br \/>\n            results<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>file_path<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">: Error &#8211; <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span><span class=\"token builtin\">str<\/span><span class=\"token punctuation\">(<\/span>e<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> <span class=\"token string\">&#034;\\\\n&#8212;\\\\n&#034;<\/span><span class=\"token punctuation\">.<\/span>join<span class=\"token punctuation\">(<\/span>results<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u8be5\u5de5\u5177\u652f\u6301\u6279\u91cf\u6587\u4ef6\u8bfb\u53d6\u64cd\u4f5c&#xff0c;\u4f7f\u7528\u5206\u9694\u7b26\u533a\u5206\u4e0d\u540c\u6587\u4ef6\u5185\u5bb9&#xff08;\u4fdd\u6301\u6570\u636e\u7ed3\u6784\u5316\u4fbf\u4e8e\u6a21\u578b\u7406\u89e3&#xff09;\u3002\u4e3a\u4fdd\u8bc1\u5065\u58ee\u6027&#xff0c;\u5355\u6587\u4ef6\u8bfb\u53d6\u5931\u8d25\u4e0d\u4f1a\u4e2d\u65ad\u6574\u4e2a\u64cd\u4f5c&#xff0c;\u5e76\u5c06\u9519\u8bef\u4fe1\u606f\u8fd4\u56de\u7ed9\u6a21\u578b\u5904\u7406\u3002<\/p>\n<p>\u8bf4\u660e&#xff1a;\u4e3a\u4e86\u4fbf\u4e8e\u8bfb\u8005\u7406\u89e3&#xff0c;\u6211\u5728\u4e0a\u8ff0 4 \u4e2a\u5de5\u5177\u7684 description \u90e8\u5206\u4f7f\u7528\u4e86\u4e2d\u6587\u63cf\u8ff0&#xff0c;\u5728\u5b9e\u9645\u6d4b\u8bd5\u4e2d&#xff0c;\u53d1\u73b0\u4e2d\u82f1\u6587\u63cf\u8ff0\u5747\u4e0d\u5f71\u54cd\u6a21\u578b\u7406\u89e3\u5de5\u5177\u542b\u4e49\u3002<\/p>\n<h4>3. \u542f\u52a8\u670d\u52a1\u5668<\/h4>\n<p>\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u542f\u52a8\u4ee3\u7801&#xff1a;<\/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;stdio&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u6700\u540e&#xff0c;\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b&#xff0c;\u8fd0\u884c\u547d\u4ee4\u542f\u52a8 MCP \u670d\u52a1\u5668&#xff1a;<\/p>\n<p>uv run simple_filesystem.py \/path\/to\/dir1 \/path\/to\/dir2<\/p>\n<p>\u670d\u52a1\u542f\u52a8\u540e\u4e0d\u4f1a\u6709\u8f93\u51fa&#xff0c;\u8fd9\u5c5e\u4e8e\u6b63\u5e38\u73b0\u8c61\u3002\u4e0b\u9762\u6211\u4eec\u5c06\u4f7f\u7528 MCP \u5ba2\u6237\u7aef\u6d4b\u8bd5\u670d\u52a1\u5668\u3002<\/p>\n<h3>\u6d4b\u8bd5 Filesystem MCP Server<\/h3>\n<p>\u5e38\u7528\u7684 MCP \u5ba2\u6237\u7aef\u5305\u62ec Claude for Desktop\u3001Cursor\u3001Cline\u3001GitHub Copilot&#xff08;\u73b0\u5df2\u652f\u6301 MCP&#xff09;\u3001Cheery Studio \u7b49\u3002\u7531\u4e8e Claude \u5ba2\u6237\u7aef\u53ef\u80fd\u5b58\u5728\u56fd\u5185\u7f51\u7edc\u8bbf\u95ee\u95ee\u9898&#xff0c;\u800c Cline \u4e0e GitHub Copilot \u90fd\u5185\u7f6e\u4e86\u6587\u4ef6\u8bfb\u53d6\u5de5\u5177&#xff0c;\u4e0d\u4fbf\u6d4b\u8bd5&#xff0c;\u56e0\u6b64\u6211\u4eec\u9009\u62e9 Cherry Studio \u8fdb\u884c\u6d4b\u8bd5\u3002<\/p>\n<h4>\u5b89\u88c5\u5e76\u914d\u7f6e\u5ba2\u6237\u7aef<\/h4>\n<p>\u4ece\u5b98\u7f51 https:\/\/cherry-ai.com\/ \u4e0b\u8f7d\u6700\u65b0\u7248 Cherry Studio\u3002<\/p>\n<h4>\u914d\u7f6e\u670d\u52a1\u5668<\/h4>\n<p>1\u3001\u6253\u5f00 Cherry Studio \u7684 \u8bbe\u7f6e&#xff0c;\u70b9\u51fb MCP \u670d\u52a1\u5668 2\u3001\u624b\u52a8 \u6dfb\u52a0\u670d\u52a1\u5668 \u6216\u70b9\u51fb \u7f16\u8f91 MCP \u914d\u7f6e&#xff0c;\u5c06\u4ee5\u4e0b\u914d\u7f6e\u6dfb\u52a0\u5230\u914d\u7f6e\u6587\u4ef6\u4e2d&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418095915-68022273d1428.jpg\" alt=\"\u8bf7\u6dfb\u52a0\u56fe\u7247\u63cf\u8ff0\" \/> <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418095918-68022276548da.jpg\" alt=\"\u8bf7\u6dfb\u52a0\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p><span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string\">&#034;mcpServers&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token string\">&#034;simplefilesystem&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token string\">&#034;isActive&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token boolean\">true<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;name&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;Filesystem MCP Server&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;type&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;stdio&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;description&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;\u7528\u4e8e\u83b7\u53d6\u672c\u5730\u76ee\u5f55\u5217\u8868\u3001\u8bfb\u5199\u672c\u5730\u6587\u4ef6\u7684 MCP Server&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;registryUrl&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;https:\/\/pypi.tuna.tsinghua.edu.cn\/simple&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;command&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;uv&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;args&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n                <span class=\"token string\">&#034;&#8211;directory&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                <span class=\"token string\">&#034;\/ABSOLUTE\/PATH\/TO\/simple-filesystem-server-python&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                <span class=\"token string\">&#034;run&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                <span class=\"token string\">&#034;simple_filesystem.py&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                <span class=\"token string\">&#034;\/path\/to\/dir1&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                <span class=\"token string\">&#034;\/path\/to\/dir2&#034;<\/span><br \/>\n            <span class=\"token punctuation\">]<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u6ce8\u610f&#xff1a;\u4e0a\u8ff0\u914d\u7f6e\u4e2d\u7684\u547d\u4ee4\u884c\u53c2\u6570 args&#xff0c;\u9700\u4fee\u6539\u4e3a\u771f\u5b9e\u7684\u9879\u76ee\u5730\u5740\u4e0e\u5141\u8bb8\u670d\u52a1\u8bbf\u95ee\u7684\u76ee\u5f55\u3002<\/p>\n<p>3\u3001\u5728 \u8bbe\u7f6e-\u6a21\u578b\u670d\u52a1 \u4e2d\u9009\u62e9\u6a21\u578b\u5e76\u8f93\u5165 API Key&#xff08;\u9700\u5f00\u542f\u51fd\u6570\u8c03\u7528\u529f\u80fd&#xff09;&#xff0c;\u8fd9\u91cc\u9009\u62e9\u4e86 DeepSeek V3&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418095920-68022278caaed.jpg\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>4\u3001\u8fd4\u56de\u804a\u5929\u9875\u9762&#xff0c;\u5728\u8f93\u5165\u6846\u4e0b\u542f\u7528 MCP \u670d\u52a1<\/p>\n<h4>\u529f\u80fd\u9a8c\u8bc1<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418095923-6802227b4be72.jpg\" alt=\"\u8bf7\u6dfb\u52a0\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u901a\u8fc7\u591a\u6b21\u5de5\u5177\u8c03\u7528&#xff0c;\u6a21\u578b\u6210\u529f\u8bfb\u53d6\u4e86\u672c\u5730\u6587\u4ef6\u5e76\u6267\u884c\u4e86\u5185\u5bb9\u603b\u7ed3\u3002<\/p>\n<hr \/>\n<p>\u5b8c\u6574\u4ee3\u7801\u5df2\u7ecf\u4e0a\u4f20\u5230\u6211\u7684 GitHub \u4ed3\u5e93&#xff0c;\u5e76\u5c01\u88c5\u4e86\u66f4\u591a\u6587\u4ef6\u64cd\u4f5c\u7684\u5de5\u5177&#xff0c;\u53ef\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u83b7\u53d6\u6e90\u4ee3\u7801&#xff1a;<\/p>\n<p><span class=\"token function\">git<\/span> clone https:\/\/github.com\/jinzcdev\/mcp-demos.git<\/p>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528 Python \u5f00\u53d1\u4e00\u4e2a\u7b80\u6613\u7684 Filesystem MCP Server&#xff0c;\u5b9e\u73b0\u4e86\u56db\u4e2a\u6838\u5fc3\u529f\u80fd\u5de5\u5177&#xff1a;<\/p>\n<li>list_directory &#8211; \u76ee\u5f55\u5185\u5bb9\u5217\u8868<\/li>\n<li>read_file &#8211; \u5355\u6587\u4ef6\u8bfb\u53d6<\/li>\n<li>write_file &#8211; \u6587\u4ef6\u5199\u5165<\/li>\n<li>read_multiple_files &#8211; \u6279\u91cf\u6587\u4ef6\u8bfb\u53d6<\/li>\n<p>\u901a\u8fc7 Cherry Studio \u5ba2\u6237\u7aef\u7684\u6d4b\u8bd5\u9a8c\u8bc1\u4e86 Filesystem MCP Server \u7684\u529f\u80fd\u3002\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u6211\u603b\u7ed3\u4e86\u4ee5\u4e0b\u521b\u5efa MCP Server Tools \u7684\u6838\u5fc3\u7ecf\u9a8c&#xff1a;<\/p>\n<li>\u8be6\u5c3d\u7684\u5de5\u5177\u63cf\u8ff0&#xff1a;\u6e05\u6670\u8bf4\u660e\u5de5\u5177\u529f\u80fd\u548c\u4f7f\u7528\u573a\u666f&#xff0c;\u63d0\u5347\u6a21\u578b\u8c03\u7528\u51c6\u786e\u7387<\/li>\n<li>\u660e\u786e\u7684\u9519\u8bef\u53cd\u9988&#xff1a;\u5de5\u5177\u8c03\u7528\u5931\u8d25\u65f6\u8fd4\u56de\u5177\u4f53\u9519\u8bef\u4fe1\u606f&#xff0c;\u8f85\u52a9\u6a21\u578b\u8c03\u6574\u7b56\u7565<\/li>\n<li>\u4fdd\u8bc1\u5de5\u5177\u5065\u58ee\u6027&#xff1a;\u5c40\u90e8\u9519\u8bef\u4e0d\u8981\u4e2d\u65ad\u6574\u4f53\u64cd\u4f5c&#xff0c;\u8fd4\u56de\u90e8\u5206\u6210\u529f\u7ed3\u679c<\/li>\n<hr \/>\n<p>\u672c\u6587\u662f \u300a\u4ece\u539f\u7406\u5230\u5b9e\u6218&#xff1a;\u638c\u63e1 MCP\u300b \u7cfb\u5217\u7684\u7b2c\u4e8c\u7bc7\u6587\u7ae0&#xff0c;\u95f4\u9694\u65f6\u95f4\u8f83\u957f\u4e86\u3002\u5982\u679c\u6587\u7ae0\u5bf9\u4f60\u6709\u5e2e\u52a9\u6b22\u8fce\u6536\u85cf\u3001\u8f6c\u53d1&#xff0c;\u60a8\u7684\u5173\u6ce8\u662f\u6211\u66f4\u65b0\u7684\u6700\u5927\u52a8\u529b\u3002\u5982\u6709\u7591\u95ee\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u7559\u8a00\u3002<\/p>\n<p>\u5f80\u671f\u63a8\u8350&#xff1a;<\/p>\n<li>MCP \u5b9e\u6218\u7cfb\u5217&#xff08;Day 1&#xff09;&#xff1a;\u4ec0\u4e48\u662f MCP&#xff1f;<\/li>\n<li>VS Code \u9884\u89c8\u7248 Copilot \u7ec8\u4e8e\u652f\u6301 MCP \u4e86&#xff1a;\u8bd5\u8bd5\u4f7f\u7528 MCP \u5feb\u901f\u67e5\u8be2 GitHub Issues \u5427<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb818\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf23\u6b21\u3002\u300a\u4ece\u539f\u7406\u5230\u5b9e\u6218\uff1a\u638c\u63e1 MCP\u300b\u7cfb\u5217\u7684\u7b2c\u4e8c\u7bc7\u6587\u7ae0\uff0c\u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \u670d\u52a1\u5668\u5427\u3002_filessystem mcp server<\/p>\n","protected":false},"author":2,"featured_media":10434,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[444,53,443,50,43],"topic":[],"class_list":["post-10439","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-ai-","tag-ai","tag-mcp-","tag-50","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MCP \u5b9e\u6218\u7cfb\u5217\uff08Day 2\uff09- \u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \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\/10439.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MCP \u5b9e\u6218\u7cfb\u5217\uff08Day 2\uff09- \u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb818\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf23\u6b21\u3002\u300a\u4ece\u539f\u7406\u5230\u5b9e\u6218\uff1a\u638c\u63e1 MCP\u300b\u7cfb\u5217\u7684\u7b2c\u4e8c\u7bc7\u6587\u7ae0\uff0c\u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \u670d\u52a1\u5668\u5427\u3002_filessystem mcp server\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/10439.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T09:59:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418095915-6802227383b4c.jpg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/10439.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/10439.html\",\"name\":\"MCP \u5b9e\u6218\u7cfb\u5217\uff08Day 2\uff09- \u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T09:59:26+00:00\",\"dateModified\":\"2025-04-18T09:59:26+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/10439.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/10439.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/10439.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MCP \u5b9e\u6218\u7cfb\u5217\uff08Day 2\uff09- \u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \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":"MCP \u5b9e\u6218\u7cfb\u5217\uff08Day 2\uff09- \u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \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\/10439.html","og_locale":"zh_CN","og_type":"article","og_title":"MCP \u5b9e\u6218\u7cfb\u5217\uff08Day 2\uff09- \u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb818\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf23\u6b21\u3002\u300a\u4ece\u539f\u7406\u5230\u5b9e\u6218\uff1a\u638c\u63e1 MCP\u300b\u7cfb\u5217\u7684\u7b2c\u4e8c\u7bc7\u6587\u7ae0\uff0c\u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \u670d\u52a1\u5668\u5427\u3002_filessystem mcp server","og_url":"https:\/\/www.wsisp.com\/helps\/10439.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T09:59:26+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418095915-6802227383b4c.jpg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/10439.html","url":"https:\/\/www.wsisp.com\/helps\/10439.html","name":"MCP \u5b9e\u6218\u7cfb\u5217\uff08Day 2\uff09- \u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T09:59:26+00:00","dateModified":"2025-04-18T09:59:26+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/10439.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/10439.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/10439.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"MCP \u5b9e\u6218\u7cfb\u5217\uff08Day 2\uff09- \u52a8\u624b\u6413\u4e2a\u6587\u4ef6\u7cfb\u7edf MCP \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\/10439","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=10439"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/10439\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/10434"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=10439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=10439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=10439"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=10439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}