{"id":47300,"date":"2025-07-30T07:17:16","date_gmt":"2025-07-29T23:17:16","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/47300.html"},"modified":"2025-07-30T07:17:16","modified_gmt":"2025-07-29T23:17:16","slug":"%e6%90%ad%e5%bb%ba%e8%87%aa%e5%b7%b1%e7%9a%84-mcp-%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%8c%e8%ae%a9-chatgpt-%e8%bf%9e%e6%8e%a5%e4%bd%a0%e7%9a%84%e7%a7%81%e6%9c%89%e6%95%b0%e6%8d%ae%e5%92%8c-api-%e6%9c%8d","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/47300.html","title":{"rendered":"\u642d\u5efa\u81ea\u5df1\u7684 MCP \u670d\u52a1\u5668\uff0c\u8ba9 ChatGPT \u8fde\u63a5\u4f60\u7684\u79c1\u6709\u6570\u636e\u548c API \u670d\u52a1\uff01"},"content":{"rendered":"<p>&#x1f527; \u672c\u6587\u5c06\u624b\u628a\u624b\u6559\u4f60\u642d\u5efa\u4e00\u4e2a MCP&#xff08;Model Context Protocol&#xff09; \u670d\u52a1\u5668&#xff0c;\u5b9e\u73b0 ChatGPT \u4e0e\u4f60\u79c1\u6709\u6570\u636e\u6e90\u7684\u8fde\u63a5&#xff0c;\u52a9\u529b\u6df1\u5ea6\u7814\u7a76\u3001\u95ee\u7b54\u3001API \u8c03\u7528\u7b49\u9ad8\u7ea7\u80fd\u529b\u3002 \u2705 \u652f\u6301\u8fdc\u7a0b\u8c03\u7528&#xff0c;\u652f\u6301\u5411\u91cf\u6570\u636e\u5e93\u68c0\u7d22&#xff0c;\u652f\u6301\u5b8c\u6574\u5185\u5bb9\u63d0\u53d6&#xff01;<\/p>\n<hr \/>\n<h3>MCP \u662f\u4ec0\u4e48&#xff1f;<\/h3>\n<p>MCP&#xff08;\u6a21\u578b\u4e0a\u4e0b\u6587\u534f\u8bae&#xff09;\u662f\u4e00\u79cd\u5f00\u653e\u534f\u8bae&#xff0c;\u7528\u4e8e\u5c06 AI \u6a21\u578b\u4e0e\u5916\u90e8\u6570\u636e\u6e90\u6216\u5de5\u5177\u96c6\u6210&#xff0c;\u5df2\u7ecf\u6210\u4e3a\u4e1a\u5185\u65b0\u6807\u51c6\u3002\u901a\u8fc7\u642d\u5efa MCP \u670d\u52a1\u5668&#xff0c;ChatGPT \u4e0d\u4ec5\u53ef\u4ee5\u4e0e\u4f60\u7684\u6570\u636e\u8fdb\u884c\u8bed\u4e49\u68c0\u7d22&#xff0c;\u8fd8\u80fd\u5b8c\u6574\u63d0\u53d6\u5185\u5bb9&#xff0c;\u5f62\u6210\u7814\u7a76\u62a5\u544a\u3001\u6d1e\u5bdf\u5206\u6790\u7b49\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u901a\u8fc7 ChatGPT \u7684 Connector \u8fde\u63a5\u5668 \u6216 Deep Research \u6df1\u5ea6\u7814\u7a76 \u529f\u80fd\u8fde\u63a5 MCP \u670d\u52a1\u5668\u3002<\/p>\n<hr \/>\n<h3>\u5feb\u901f\u642d\u5efa\u4e00\u4e2a MCP \u670d\u52a1\u5668&#xff08;Python\/FastMCP&#xff09;<\/h3>\n<p>\u6211\u4eec\u5c06\u4f7f\u7528 Python \u4e0e FastMCP \u6846\u67b6 \u6765\u642d\u5efa MCP \u670d\u52a1\u5668&#xff0c;\u4e3b\u8981\u5305\u62ec\u4e24\u4e2a\u529f\u80fd&#xff1a;<\/p>\n<ul>\n<li>search&#xff1a;\u6839\u636e\u5173\u952e\u8bcd\u8fdb\u884c\u5411\u91cf\u68c0\u7d22&#xff0c;\u8fd4\u56de\u6458\u8981\u7247\u6bb5&#xff1b;<\/li>\n<li>fetch&#xff1a;\u6839\u636e\u6587\u4ef6 ID \u83b7\u53d6\u5b8c\u6574\u5185\u5bb9\u3002<\/li>\n<\/ul>\n<p>\u6b64\u5916&#xff0c;\u4f60\u7684\u6570\u636e\u6e90\u6765\u81ea\u4e8e OpenAI \u7684 \u5411\u91cf\u6570\u636e\u5e93 Vector Store\u3002\u53ef\u4ee5\u901a\u8fc7\u4e0a\u4f20 PDF \u6587\u4ef6\u5feb\u901f\u6784\u5efa&#xff0c;\u4f8b\u5982\u4f7f\u7528 \u8fd9\u672c\u5173\u4e8e\u732b\u7684\u4e66 PDF\u3002<\/p>\n<p>&#x1f680; \u5411\u91cf\u5e93\u4e0a\u4f20\u5730\u5740&#xff1a;OpenAI \u5411\u91cf\u5b58\u50a8\u7ba1\u7406\u5e73\u53f0<\/p>\n<hr \/>\n<h3>MCP Server \u6838\u5fc3\u4ee3\u7801\u793a\u4f8b<\/h3>\n<p>\u4ee5\u4e0b\u4e3a\u5b8c\u6574\u4ee3\u7801&#xff08;\u9002\u7528\u4e8e Replit \u7b49\u5728\u7ebf\u90e8\u7f72\u5e73\u53f0&#xff09;&#xff1a;<\/p>\n<p>\u2705 \u6ce8\u610f\u4e8b\u9879&#xff1a;<\/p>\n<ul>\n<li>OPENAI_API_KEY \u9700\u66ff\u6362\u4e3a\u4f60\u7684 OpenAI \u5bc6\u94a5&#xff1b;<\/li>\n<li>VECTOR_STORE_ID \u4e3a\u4f60\u4e0a\u4f20\u6587\u4ef6\u540e\u751f\u6210\u7684\u5411\u91cf\u5b58\u50a8 ID&#xff1b;<\/li>\n<li>\u6240\u6709\u8bf7\u6c42\u7edf\u4e00\u8d70 API \u4e2d\u8f6c\u7ad9 https:\/\/api.aaaaapi.com&#xff08;\u5df2\u66ff\u6362\u539f baseurl&#xff0c;\u4fdd\u969c\u8bf7\u6c42\u7a33\u5b9a\u6027&#xff09;\u3002<\/li>\n<\/ul>\n<p>&#x1f4cc;\u4e3b\u8981\u4f9d\u8d56&#xff1a;<\/p>\n<p>pip <span class=\"token function\">install<\/span> fastmcp openai<\/p>\n<p>&#x1f4e6;server.py \u6587\u4ef6\u6838\u5fc3\u903b\u8f91&#xff1a;<\/p>\n<p><span class=\"token keyword\">import<\/span> logging<br \/>\n<span class=\"token keyword\">import<\/span> os<br \/>\n<span class=\"token keyword\">from<\/span> typing <span class=\"token keyword\">import<\/span> Dict<span class=\"token punctuation\">,<\/span> List<span class=\"token punctuation\">,<\/span> Any<br \/>\n<span class=\"token keyword\">from<\/span> fastmcp <span class=\"token keyword\">import<\/span> FastMCP<br \/>\n<span class=\"token keyword\">from<\/span> openai <span class=\"token keyword\">import<\/span> OpenAI<\/p>\n<p><span class=\"token comment\"># OpenAI \u914d\u7f6e&#xff08;\u901a\u8fc7\u4e2d\u8f6c API \u8fdb\u884c\u8bf7\u6c42&#xff09;<\/span><br \/>\nOPENAI_API_KEY <span class=\"token operator\">&#061;<\/span> os<span class=\"token punctuation\">.<\/span>environ<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;OPENAI_API_KEY&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\nVECTOR_STORE_ID <span class=\"token operator\">&#061;<\/span> os<span class=\"token punctuation\">.<\/span>environ<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;VECTOR_STORE_ID&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u66ff\u6362 OpenAI \u63a5\u53e3 baseurl&#xff08;\u7a33\u5b9a\u63a8\u8350&#xff1a;https:\/\/api.aaaaapi.com&#xff09;<\/span><br \/>\nopenai_client <span class=\"token operator\">&#061;<\/span> OpenAI<span class=\"token punctuation\">(<\/span><br \/>\n    api_key<span class=\"token operator\">&#061;<\/span>OPENAI_API_KEY<span class=\"token punctuation\">,<\/span><br \/>\n    base_url<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;https:\/\/api.aaaaapi.com\/v1&#034;<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">create_server<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    mcp <span class=\"token operator\">&#061;<\/span> FastMCP<span class=\"token punctuation\">(<\/span>name<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;\u6211\u7684MCP\u670d\u52a1\u5668&#034;<\/span><span class=\"token punctuation\">,<\/span> instructions<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;\u652f\u6301\u641c\u7d22\u548c\u6587\u6863\u63d0\u53d6\u7684\u670d\u52a1&#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\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">search<\/span><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 operator\">&#8211;<\/span><span class=\"token operator\">&gt;<\/span> Dict<span class=\"token punctuation\">[<\/span><span class=\"token builtin\">str<\/span><span class=\"token punctuation\">,<\/span> List<span class=\"token punctuation\">[<\/span>Dict<span class=\"token punctuation\">[<\/span><span class=\"token builtin\">str<\/span><span class=\"token punctuation\">,<\/span> Any<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token keyword\">not<\/span> query<span class=\"token punctuation\">.<\/span>strip<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;results&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><br \/>\n        response <span class=\"token operator\">&#061;<\/span> openai_client<span class=\"token punctuation\">.<\/span>vector_stores<span class=\"token punctuation\">.<\/span>search<span class=\"token punctuation\">(<\/span><br \/>\n            vector_store_id<span class=\"token operator\">&#061;<\/span>VECTOR_STORE_ID<span class=\"token punctuation\">,<\/span><br \/>\n            query<span class=\"token operator\">&#061;<\/span>query<br \/>\n        <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> i<span class=\"token punctuation\">,<\/span> item <span class=\"token keyword\">in<\/span> <span class=\"token builtin\">enumerate<\/span><span class=\"token punctuation\">(<\/span>response<span class=\"token punctuation\">.<\/span>data<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            item_id <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">getattr<\/span><span class=\"token punctuation\">(<\/span>item<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;file_id&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;vs_<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>i<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n            title <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">getattr<\/span><span class=\"token punctuation\">(<\/span>item<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;filename&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u6587\u6863 <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>i<span class=\"token operator\">&#043;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n            snippet <span class=\"token operator\">&#061;<\/span> item<span class=\"token punctuation\">.<\/span>content<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span>text<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">:<\/span><span class=\"token number\">200<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">if<\/span> item<span class=\"token punctuation\">.<\/span>content <span class=\"token keyword\">else<\/span> <span class=\"token string\">&#034;\u65e0\u5185\u5bb9&#034;<\/span><br \/>\n            results<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/span><br \/>\n                <span class=\"token string\">&#034;id&#034;<\/span><span class=\"token punctuation\">:<\/span> item_id<span class=\"token punctuation\">,<\/span><br \/>\n                <span class=\"token string\">&#034;title&#034;<\/span><span class=\"token punctuation\">:<\/span> title<span class=\"token punctuation\">,<\/span><br \/>\n                <span class=\"token string\">&#034;text&#034;<\/span><span class=\"token punctuation\">:<\/span> snippet <span class=\"token operator\">&#043;<\/span> <span class=\"token string\">&#034;&#8230;&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                <span class=\"token string\">&#034;url&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;https:\/\/platform.openai.com\/storage\/files\/<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>item_id<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><br \/>\n            <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;results&#034;<\/span><span class=\"token punctuation\">:<\/span> results<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\">async<\/span> <span class=\"token keyword\">def<\/span> <span class=\"token function\">fetch<\/span><span class=\"token punctuation\">(<\/span><span class=\"token builtin\">id<\/span><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> Dict<span class=\"token punctuation\">[<\/span><span class=\"token builtin\">str<\/span><span class=\"token punctuation\">,<\/span> Any<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        content <span class=\"token operator\">&#061;<\/span> openai_client<span class=\"token punctuation\">.<\/span>vector_stores<span class=\"token punctuation\">.<\/span>files<span class=\"token punctuation\">.<\/span>content<span class=\"token punctuation\">(<\/span><br \/>\n            vector_store_id<span class=\"token operator\">&#061;<\/span>VECTOR_STORE_ID<span class=\"token punctuation\">,<\/span> file_id<span class=\"token operator\">&#061;<\/span><span class=\"token builtin\">id<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        info <span class=\"token operator\">&#061;<\/span> openai_client<span class=\"token punctuation\">.<\/span>vector_stores<span class=\"token punctuation\">.<\/span>files<span class=\"token punctuation\">.<\/span>retrieve<span class=\"token punctuation\">(<\/span><br \/>\n            vector_store_id<span class=\"token operator\">&#061;<\/span>VECTOR_STORE_ID<span class=\"token punctuation\">,<\/span> file_id<span class=\"token operator\">&#061;<\/span><span class=\"token builtin\">id<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        text <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;\\\\n&#034;<\/span><span class=\"token punctuation\">.<\/span>join<span class=\"token punctuation\">(<\/span>c<span class=\"token punctuation\">.<\/span>text <span class=\"token keyword\">for<\/span> c <span class=\"token keyword\">in<\/span> content<span class=\"token punctuation\">.<\/span>data<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token string\">&#034;id&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">id<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;title&#034;<\/span><span class=\"token punctuation\">:<\/span> info<span class=\"token punctuation\">.<\/span>filename<span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;text&#034;<\/span><span class=\"token punctuation\">:<\/span> text<span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;url&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;https:\/\/platform.openai.com\/storage\/files\/<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span><span class=\"token builtin\">id<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;metadata&#034;<\/span><span class=\"token punctuation\">:<\/span> info<span class=\"token punctuation\">.<\/span>attributes <span class=\"token keyword\">if<\/span> <span class=\"token builtin\">hasattr<\/span><span class=\"token punctuation\">(<\/span>info<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;attributes&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> mcp<\/p>\n<p><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    server <span class=\"token operator\">&#061;<\/span> create_server<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    server<span class=\"token punctuation\">.<\/span>run<span class=\"token punctuation\">(<\/span>transport<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;sse&#034;<\/span><span class=\"token punctuation\">,<\/span> host<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;0.0.0.0&#034;<\/span><span class=\"token punctuation\">,<\/span> port<span class=\"token operator\">&#061;<\/span><span class=\"token number\">8000<\/span><span class=\"token punctuation\">)<\/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    main<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<hr \/>\n<h3>Replit \u5feb\u901f\u90e8\u7f72\u6307\u5357<\/h3>\n<li>\n<p>\u6253\u5f00\u8fd9\u4e2a Replit \u6a21\u677f&#xff1a; &#x1f449; Remix \u793a\u4f8b MCP Server<\/p>\n<\/li>\n<li>\n<p>\u914d\u7f6e\u73af\u5883\u53d8\u91cf&#xff08;\u70b9\u51fb\u5de6\u8fb9\u9501\u56fe\u6807&#x1f512;&#xff09;&#xff1a;<\/p>\n<\/li>\n<table>\n<tr>KeyValue<\/tr>\n<tbody>\n<tr>\n<td>OPENAI_API_KEY<\/td>\n<td>\u4f60\u7684 OpenAI \u5bc6\u94a5<\/td>\n<\/tr>\n<tr>\n<td>VECTOR_STORE_ID<\/td>\n<td>\u5411\u91cf\u5b58\u50a8 ID&#xff08;\u4e0a\u4f20\u6587\u4ef6\u540e\u83b7\u53d6&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<li>\u83b7\u53d6 MCP \u670d\u52a1\u5668\u5730\u5740&#xff0c;\u672b\u5c3e\u52a0\u4e0a \/sse\/&#xff1a;<\/li>\n<p>https:\/\/link.ywhttp.com\/bWBNsz<\/p>\n<hr \/>\n<h3>\u5982\u4f55\u5728 ChatGPT \u4e2d\u8fde\u63a5 MCP&#xff1f;<\/h3>\n<li>\u8fdb\u5165 ChatGPT \u8bbe\u7f6e&#xff1b;<\/li>\n<li>\u70b9\u51fb\u201c\u8fde\u63a5\u5668&#xff08;Connectors&#xff09;\u201d&#xff1b;<\/li>\n<li>\u6dfb\u52a0 MCP \u5730\u5740&#xff08;\u5982\u4e0a\u6240\u793a&#xff09;&#xff1b;<\/li>\n<li>\u52fe\u9009\u5141\u8bb8\u4f7f\u7528 search \u548c fetch&#xff1b;<\/li>\n<li>\u6d4b\u8bd5\u641c\u7d22\u6216\u95ee\u7b54\u4efb\u52a1\u662f\u5426\u8c03\u7528\u6210\u529f \u2705\u3002<\/li>\n<p>\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b CURL \u8bf7\u6c42\u6d4b\u8bd5\u63a5\u53e3\u662f\u5426\u5de5\u4f5c\u6b63\u5e38&#xff1a;<\/p>\n<p><span class=\"token function\">curl<\/span> https:\/\/link.ywhttp.com\/bWBNsz <span class=\"token punctuation\">\\\\<\/span><br \/>\n  -H <span class=\"token string\">&#034;Content-Type: application\/json&#034;<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n  -H <span class=\"token string\">&#034;Authorization: Bearer <span class=\"token variable\">$OPENAI_API_KEY<\/span>&#034;<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n  -d <span class=\"token string\">&#039;{<br \/>\n    &#034;model&#034;: &#034;o4-mini-deep-research&#034;,<br \/>\n    &#034;input&#034;: [&#8230;],<br \/>\n    &#034;tools&#034;: [<br \/>\n      {<br \/>\n        &#034;type&#034;: &#034;mcp&#034;,<br \/>\n        &#034;server_label&#034;: &#034;mypdf&#034;,<br \/>\n        &#034;server_url&#034;: &#034;https:\/\/xxx.repl.co\/sse\/&#034;,<br \/>\n        &#034;allowed_tools&#034;: [&#034;search&#034;, &#034;fetch&#034;],<br \/>\n        &#034;require_approval&#034;: &#034;never&#034;<br \/>\n      }<br \/>\n    ]<br \/>\n}&#039;<\/span><\/p>\n<hr \/>\n<h3>\u5b89\u5168\u63d0\u793a&#xff1a;\u8bf7\u9632\u8303\u6570\u636e\u6cc4\u9732&#xff01;<\/h3>\n<p>\u867d\u7136 MCP \u53ea\u652f\u6301 search \u4e0e fetch \u5de5\u5177&#xff0c;\u4f46\u4ecd\u53ef\u80fd\u5b58\u5728&#xff1a;<\/p>\n<ul>\n<li>&#x1f4ce; \u63d0\u793a\u6ce8\u5165\u653b\u51fb&#xff1a;\u6076\u610f\u7f51\u9875\u6216\u5185\u5bb9\u9690\u85cf\u6307\u4ee4&#xff0c;\u8bf1\u5bfc\u6a21\u578b\u6cc4\u9732\u5185\u90e8\u6570\u636e&#xff1b;<\/li>\n<li>&#x1f510; \u6570\u636e\u56de\u6d41\u98ce\u9669&#xff1a;MCP \u67e5\u8be2\u5185\u5bb9\u4e2d\u53ef\u80fd\u5305\u542b\u7528\u6237\u9690\u79c1&#xff0c;\u8bf7\u505a\u597d\u65e5\u5fd7\u5ba1\u8ba1&#xff1b;<\/li>\n<li>&#x1f4a5; \u7b2c\u4e09\u65b9\u670d\u52a1\u5668\u98ce\u9669&#xff1a;\u8bf7\u52ff\u8fde\u63a5\u6765\u5386\u4e0d\u660e\u7684 MCP \u5730\u5740&#xff01;<\/li>\n<\/ul>\n<p>\u5efa\u8bae\u90e8\u7f72\u524d\u5f00\u542f HTTPS&#xff0c;\u6dfb\u52a0 OAuth \u6388\u6743\u673a\u5236&#xff0c;\u63d0\u5347\u5b89\u5168\u6027\u3002<\/p>\n<hr \/>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u6784\u5efa MCP Server \u80fd\u591f\u4e3a\u4f60\u79c1\u6709\u6570\u636e\u6ce8\u5165\u5f3a\u5927\u7684\u667a\u80fd\u5bf9\u8bdd\u80fd\u529b&#xff0c;\u52a9\u529b\u4f01\u4e1a\u7ea7\u5e94\u7528\u96c6\u6210\u3001AI \u62a5\u544a\u751f\u6210\u3001\u77e5\u8bc6\u5e93\u95ee\u7b54\u7b49\u3002<\/p>\n<p>\u73b0\u5728\u5c31\u642d\u5efa\u4e00\u4e2a MCP \u670d\u52a1&#xff0c;\u8ba9 ChatGPT \u6df1\u5ea6\u7406\u89e3\u4f60\u7684\u6570\u636e\u5427&#xff01;<\/p>\n<hr \/>\n<p>&#x1f4cc; \u4ea4\u6d41\u8ba8\u8bba\u6216\u9047\u5230\u95ee\u9898&#xff1f;\u6b22\u8fce\u7559\u8a00&#xff01;<\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb879\u6b21\uff0c\u70b9\u8d5e11\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u6784\u5efa MCP Server \u80fd\u591f\u4e3a\u4f60\u79c1\u6709\u6570\u636e\u6ce8\u5165\u5f3a\u5927\u7684\u667a\u80fd\u5bf9\u8bdd\u80fd\u529b\uff0c\u52a9\u529b\u4f01\u4e1a\u7ea7\u5e94\u7528\u96c6\u6210\u3001AI \u62a5\u544a\u751f\u6210\u3001\u77e5\u8bc6\u5e93\u95ee\u7b54\u7b49\u3002\u73b0\u5728\u5c31\u642d\u5efa\u4e00\u4e2a MCP \u670d\u52a1\uff0c\u8ba9 ChatGPT \u6df1\u5ea6\u7406\u89e3\u4f60\u7684\u6570\u636e\u5427\uff01\ud83d\udccc\u4ea4\u6d41\u8ba8\u8bba\u6216\u9047\u5230\u95ee\u9898\uff1f\u6b22\u8fce\u7559\u8a00\uff01<\/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":[175,50,43],"topic":[],"class_list":["post-47300","post","type-post","status-publish","format-standard","hentry","category-server","tag-chatgpt","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>\u642d\u5efa\u81ea\u5df1\u7684 MCP \u670d\u52a1\u5668\uff0c\u8ba9 ChatGPT \u8fde\u63a5\u4f60\u7684\u79c1\u6709\u6570\u636e\u548c API \u670d\u52a1\uff01 - \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\/47300.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u642d\u5efa\u81ea\u5df1\u7684 MCP \u670d\u52a1\u5668\uff0c\u8ba9 ChatGPT \u8fde\u63a5\u4f60\u7684\u79c1\u6709\u6570\u636e\u548c API \u670d\u52a1\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb879\u6b21\uff0c\u70b9\u8d5e11\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u6784\u5efa MCP Server \u80fd\u591f\u4e3a\u4f60\u79c1\u6709\u6570\u636e\u6ce8\u5165\u5f3a\u5927\u7684\u667a\u80fd\u5bf9\u8bdd\u80fd\u529b\uff0c\u52a9\u529b\u4f01\u4e1a\u7ea7\u5e94\u7528\u96c6\u6210\u3001AI \u62a5\u544a\u751f\u6210\u3001\u77e5\u8bc6\u5e93\u95ee\u7b54\u7b49\u3002\u73b0\u5728\u5c31\u642d\u5efa\u4e00\u4e2a MCP \u670d\u52a1\uff0c\u8ba9 ChatGPT \u6df1\u5ea6\u7406\u89e3\u4f60\u7684\u6570\u636e\u5427\uff01\ud83d\udccc\u4ea4\u6d41\u8ba8\u8bba\u6216\u9047\u5230\u95ee\u9898\uff1f\u6b22\u8fce\u7559\u8a00\uff01\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/47300.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-29T23:17:16+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=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/47300.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/47300.html\",\"name\":\"\u642d\u5efa\u81ea\u5df1\u7684 MCP \u670d\u52a1\u5668\uff0c\u8ba9 ChatGPT \u8fde\u63a5\u4f60\u7684\u79c1\u6709\u6570\u636e\u548c API \u670d\u52a1\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-29T23:17:16+00:00\",\"dateModified\":\"2025-07-29T23:17:16+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/47300.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/47300.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/47300.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u642d\u5efa\u81ea\u5df1\u7684 MCP \u670d\u52a1\u5668\uff0c\u8ba9 ChatGPT \u8fde\u63a5\u4f60\u7684\u79c1\u6709\u6570\u636e\u548c API \u670d\u52a1\uff01\"}]},{\"@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":"\u642d\u5efa\u81ea\u5df1\u7684 MCP \u670d\u52a1\u5668\uff0c\u8ba9 ChatGPT \u8fde\u63a5\u4f60\u7684\u79c1\u6709\u6570\u636e\u548c API \u670d\u52a1\uff01 - \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\/47300.html","og_locale":"zh_CN","og_type":"article","og_title":"\u642d\u5efa\u81ea\u5df1\u7684 MCP \u670d\u52a1\u5668\uff0c\u8ba9 ChatGPT \u8fde\u63a5\u4f60\u7684\u79c1\u6709\u6570\u636e\u548c API \u670d\u52a1\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb879\u6b21\uff0c\u70b9\u8d5e11\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u6784\u5efa MCP Server \u80fd\u591f\u4e3a\u4f60\u79c1\u6709\u6570\u636e\u6ce8\u5165\u5f3a\u5927\u7684\u667a\u80fd\u5bf9\u8bdd\u80fd\u529b\uff0c\u52a9\u529b\u4f01\u4e1a\u7ea7\u5e94\u7528\u96c6\u6210\u3001AI \u62a5\u544a\u751f\u6210\u3001\u77e5\u8bc6\u5e93\u95ee\u7b54\u7b49\u3002\u73b0\u5728\u5c31\u642d\u5efa\u4e00\u4e2a MCP \u670d\u52a1\uff0c\u8ba9 ChatGPT \u6df1\u5ea6\u7406\u89e3\u4f60\u7684\u6570\u636e\u5427\uff01\ud83d\udccc\u4ea4\u6d41\u8ba8\u8bba\u6216\u9047\u5230\u95ee\u9898\uff1f\u6b22\u8fce\u7559\u8a00\uff01","og_url":"https:\/\/www.wsisp.com\/helps\/47300.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-29T23:17:16+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/47300.html","url":"https:\/\/www.wsisp.com\/helps\/47300.html","name":"\u642d\u5efa\u81ea\u5df1\u7684 MCP \u670d\u52a1\u5668\uff0c\u8ba9 ChatGPT \u8fde\u63a5\u4f60\u7684\u79c1\u6709\u6570\u636e\u548c API \u670d\u52a1\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-29T23:17:16+00:00","dateModified":"2025-07-29T23:17:16+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/47300.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/47300.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/47300.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u642d\u5efa\u81ea\u5df1\u7684 MCP \u670d\u52a1\u5668\uff0c\u8ba9 ChatGPT \u8fde\u63a5\u4f60\u7684\u79c1\u6709\u6570\u636e\u548c API \u670d\u52a1\uff01"}]},{"@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\/47300","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=47300"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/47300\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=47300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=47300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=47300"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=47300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}