MCP Sandbox
概述
內容詳情
替代品
什麼是 MCP 工具服務器?
MCP 工具服務器是一個集成了多種人工智能工具的服務平臺,基於 Model Context Protocol 標準構建。它允許用戶通過統一的接口訪問各種功能,包括代碼執行、化學化合物查詢、網絡搜索、數據分析等。服務器支持本地工具部署和遠程工具連接,為開發者提供靈活的工具集成方案。如何使用 MCP 工具服務器?
用戶可以通過兩種主要方式使用該服務:1) 通過內置的 Agent 框架調用工具,2) 通過 HTTP API 直接執行代碼。服務器支持會話管理,每個會話都有獨立的執行環境,可以保持狀態和變量。適用場景
適用於需要集成多種AI工具的應用場景,如科研數據分析、化學信息查詢、網絡信息檢索、自動化任務處理等。特別適合需要組合使用多個工具完成複雜任務的場景。主要功能
本地工具集成
支持在本地部署和運行自定義工具,通過簡單的裝飾器語法定義工具函數
遠程工具連接
可以通過 SSE (Server-Sent Events) 連接遠程 MCP 服務,擴展工具能力
會話管理
支持多會話隔離,每個會話有獨立的代碼執行環境和變量空間
流式響應
工具執行結果以流式方式返回,支持即時顯示執行進度和中間結果
化學信息查詢
集成 PubChem 數據庫,支持通過化合物名稱搜索化學信息
網絡搜索
提供網絡搜索功能,能夠獲取最新的網絡信息和相關數據
優勢
統一的工具調用接口,簡化多工具集成
支持本地和遠程工具混合使用
流式響應提供更好的用戶體驗
會話隔離確保任務執行的獨立性
基於標準 MCP 協議,具有良好的擴展性
侷限性
需要一定的技術知識進行工具部署和配置
遠程工具依賴網絡連接穩定性
會話管理需要手動維護會話生命週期
部分高級功能需要了解具體的工具使用方法
如何使用
環境準備
確保服務器運行在 Docker 環境中,配置好所需的 CPU 和內存資源
工具配置
在 config/server_list.json 中配置需要使用的工具,包括本地工具路徑和遠程 SSE 鏈接
啟動服務
在容器中運行部署腳本啟動所有配置的工具服務
調用工具
通過 Agent 框架或 HTTP API 調用工具,管理會話生命週期
使用案例
化學化合物查詢
查詢特定化學化合物的詳細信息
網絡價格查詢
搜索最新產品價格信息
數據分析任務
執行復雜的數據處理和分析任務
常見問題
如何添加新的本地工具?
在 server 目錄下創建新的工具目錄,使用 @mcp.tool() 裝飾器定義工具函數,然後在 config/server_list.json 中添加對應的 Python 文件路徑。
會話超時時間如何設置?
在創建 StreamToolManager 時可以通過 timeout 參數設置會話超時時間,默認超時時間為180秒。
如何處理工具執行錯誤?
工具執行錯誤會在返回結果中包含錯誤信息,可以通過檢查返回結果中的 error 字段來處理異常情況。
如何釋放會話資源?
調用 close_session() 方法可以釋放當前會話佔用的資源,包括內存和變量空間。
支持哪些類型的遠程工具連接?
支持通過 SSE (Server-Sent Events) 協議連接的遠程 MCP 服務,需要在配置文件中提供完整的 SSE 鏈接。
相關資源
MCP 協議官方文檔
Model Context Protocol 的官方文檔和規範說明
Docker 部署指南
Docker 容器化部署的詳細指南
PubChem 數據庫 API
PubChem 化學數據庫的 API 文檔
示例代碼庫
包含工具示例和配置模板的代碼庫
安裝
複製以下命令到你的Client進行配置
注意:您的密鑰屬於敏感信息,請勿與任何人分享。
🚀 工具導入說明
本說明文檔詳細介紹了工具的導入方式、服務的運行方法以及服務的調用方式,幫助你順利使用相關工具和服務。
🚀 快速開始
✨ 本地client導入
在 server 目錄下新建目錄,每個目錄有一個用 fastmcp 裝飾的工具實例。以 server/PubChem-MCP-Server/pubchem_server.py 為例,裡面定義了一個 mcp 工具:
@mcp.tool()
async def search_pubchem_by_name(name: str, max_results: int = 5) -> List[Dict[str, Any]]:
logging.info(f"Searching for compounds with name: {name}, max_results: {max_results}")
"""
Search for chemical compounds on PubChem using a compound name.
Args:
name: Name of the chemical compound
max_results: Maximum number of results to return (default: 5)
Returns:
List of dictionaries containing compound information
"""
try:
results = await asyncio.to_thread(search_by_name, name, max_results)
return results
except Exception as e:
return [{"error": f"An error occurred while searching: {str(e)}"}]
文件定義好之後需要在 config/server_list.json 中指定對應的 py 文件路徑(在這裡是 server/PubChem-MCP-Server/pubchem_server.py),同時一些簡單的 mcp 服務可以直接在 mcp_server.py 文件中定義,默認會從中導入。
✨ sse client 導入
在 config/server_list.json 裡面加入需要的 sse 鏈接即可,示例如下:
[
"server/Agents-Server/agents_server.py",
"server/BASE-TOOL-Server/base_tool_server.py",
"https://dpa-uuid1750659890.app-space.dplink.cc/sse?token=b42b991d062341fba15a9f7975e190b0"
]
✨ 運行服務
建議服務跑在 docker 鏡像下,我們有一個自己的 docker 鏡像,啟動參考腳本如下:
docker run -d \
--name backend_server_shenshi \
--cpuset-cpus="64-95" \
-p 30004:30004 \
-v #Agent對應的目錄:/mnt \
fastapi-server \
tail -f /dev/null
這裡指定 CPU 是為了提升多核性能,提高併發性。在容器中運行腳本:
bash deploy_server.sh
💻 使用示例
基礎用法
使用 Agent 框架下自帶的 tool manager 執行代碼(推薦):
class StreamToolManager(BaseToolManager):
def __init__(self, url, session_id:str = None, timeout:int=180):
super().__init__(url)
self.session_id = str(uuid4()) if not session_id else session_id
# self.session_id = str("test_id2")
self.timeout = timeout
async def submit_task(self, code:str):
...
async def recieve_task_process(self, ):
...
async def execute_code_async_stream(self, tool_call: str,):
submit_status = await self.submit_task(tool_call)
if submit_status["status"] == "fail":
yield {"output":""}
return
async for item in self.recieve_task_process():
yield item
async def close_session(self):
async with httpx.AsyncClient() as client:
resp = await client.post(
f"{self.server_url}/del_session",
params={"session_id": self.session_id}
)
return resp.json()
使用說明:
- 需要自己維護好自己
session id下的tool manager,每個session id對應的tool manager會有一個獨立的代碼執行空間,歷史的函數和變量都會保留。 - 在整個
session infer結束後,如果你不需要這個session,需要手動刪除(close_session()函數),釋放你這個session的代碼執行內存和變量。 - 通過
execute_code_async_stream來執行代碼,代碼執行結果會流式出現,分別包含以下幾種情況:- agent 直接調用工具,工具正常返回,會流式返回所有調用的工具,和最終代碼執行結果,工具返回的時候,
other_info裡面會有函數名:結果的字典,代碼返回的時候main_stream_type是code_result,stream_state有start,running,end三種。
- agent 直接調用工具,工具正常返回,會流式返回所有調用的工具,和最終代碼執行結果,工具返回的時候,
{
"main_stream_type": "tool_result",
"sub_stream_type": "",
"content": "",
"from_sandbox": true,
"stream_state": "start",
"other_info": {}
},
{
"main_stream_type": "tool_result",
"sub_stream_type": "",
"content": "",
"from_sandbox": true,
"stream_state": "running",
"other_info": {
"web_search": {
"tool_result": {
"organic": [
{
"title": "Buy iPhone 15 and iPhone 15 Plus - Apple",
"link": "https://www.apple.com/shop/buy-iphone/iphone-15",
"snippet": "BuyFrom $799.00Footnote**Pay with Apple Pay or other payment methods. Finance ...",
"sitelinks": [
{
"title": "Buy iPhone 15",
"link": "https://www.apple.com/shop/buy-iphone/iphone-15/6.1-inch-display-128gb-black-unlocked"
}
],
"position": 1
},
{
"title": "Buy iPhone - Apple",
"link": "https://www.apple.com/shop/buy-iphone",
"snippet": "Shop the latest iPhone models and accessories. Save with Apple Trade In, carrier offers, and flexible monthly payment options. Get expert help today.",
"position": 2
},
{
"title": "iPhone - Apple",
"link": "https://www.apple.com/iphone/",
"snippet": "The ultimate iPhone ... From $999 or $41.62/mo. for 24 mo ... Learn more Buy ... Apple Intelligence.",
"position": 3
},
{
"title": "Apple Store - Find a Store",
"link": "https://www.apple.com/retail/",
"snippet": "Activation required. AT&T iPhone 15 Special Deal: Buy an iPhone 15 128 GB and get $441.36 in bill credits applied over 36 months. Buy an iPhone 15 256 GB and ...",
"position": 4
},
{
"title": "Apple iPhone 15: Order, Price, Colors, Features - Verizon",
"link": "https://www.verizon.com/smartphones/apple-iphone-15/",
"snippet": "You'll pay $0.00/mo after a credit of $20.27/mo on your billed price of $20.27/mo per device for 36 mos. Full retail price $729.99. Your total payments will ...",
"position": 5
},
{
"title": "iPhone - Buying iPhone - Apple",
"link": "https://www.apple.com/iphone/buy/",
"snippet": "Purchase your next iPhone from the Apple Store. Get answers about carriers ... Greatest price. From $599. Buy \u00b7 Learn more \u00b7 View in AR. 6.1\u2033. Super Retina ...",
"position": 6
},
{
"title": "Amazon.com: Apple iPhone 15 Pro Max, 256GB, Natural Titanium",
"link": "https://www.amazon.com/Apple-iPhone-15-Pro-Max/dp/B0CMZD7VCV",
"snippet": "List Price: $829.00$829.00 Details. The List Price is the suggested retail price of a new product as provided by a manufacturer, supplier, or seller. Except ...",
"rating": 3.9,
"ratingCount": 1511,
"position": 7
},
{
"title": "Interesting to see the USD price difference of the iPhone 15 Pro ...",
"link": "https://www.reddit.com/r/iphone/comments/16kl59k/interesting_to_see_the_usd_price_difference_of/",
"snippet": "1K votes, 332 comments. For fun I priced out a top-spec 15 Pro Max in Turkey and it comes out to US$3458.88. Cheap!",
"date": "Sep 17, 2023",
"position": 8
},
{
"title": "Apple",
"link": "https://www.apple.com/",
"snippet": "Discover the innovative world of Apple and shop everything iPhone, iPad, Apple Watch, Mac, and Apple TV, plus explore accessories, entertainment, ...",
"position": 9
}
],
"peopleAlsoAsk": [
{
"question": "What is the iPhone 15 going to cost?",
"snippet": "New or existing customer Retail price: $729.99. One-time activation fee of $35.",
"title": "Apple iPhone 15: Order, Price, Colors, Features - Verizon",
"link": "https://www.verizon.com/smartphones/apple-iphone-15/"
},
{
"question": "How much will Apple pay for an iPhone 15?",
"snippet": "Get $45\u2013$600 for your trade-in. Get 3% Daily Cash back with Apple Card.",
"title": "Buy iPhone 15 and iPhone 15 Plus - Apple",
"link": "https://www.apple.com/shop/buy-iphone/iphone-15"
},
{
"question": "How much will I get for an iPhone 15?",
"snippet": "Get \u00a330-\u00a3595 when you trade in an iPhone. 1\nYour device\nEstimated trade-in value 1\niPhone 15 Pro Max\nUp to \u00a3595\niPhone 15 Pro\nUp to \u00a3535\niPhone 15 Plus\nUp to \u00a3420\niPhone 15\nUp to \u00a3385",
"title": "Apple Trade In - Apple (UK)",
"link": "https://www.apple.com/uk/shop/trade-in"
},
{
"question": "How much did the iPhone 15 originally cost?",
"snippet": "Pricing and Availability iPhone 15 and iPhone 15 Plus will be available in pink, yellow, green, blue, and black in 128GB, 256GB, and 512GB storage capacities, starting at $799 (U.S.) or $33.29 (U.S.) per month, and $899 (U.S.) or $37.45 (U.S.) per month, respectively.",
"title": "Apple debuts iPhone 15 and iPhone 15 Plus",
"link": "https://www.apple.com/newsroom/2023/09/apple-debuts-iphone-15-and-iphone-15-plus/"
}
],
"relatedSearches": [
{
"query": "Apple IPhone 13"
},
{
"query": "Iphone 15 price official apple store usa"
},
{
"query": "Iphone 15 price official apple store near me"
},
{
"query": "iPhone 15 Pro Max"
},
{
"query": "iPhone 15 price in USA"
},
{
"query": "iPhone 15 Pro Max price"
},
{
"query": "iPhone 15 Pro Max price in USA"
},
{
"query": "iPhone 14"
},
{
"query": "iPhone 15 Pro price in USA"
}
]
},
"tool_elapsed_time": 2.1127848625183105
}
}
},
{
"main_stream_type": "code_result",
"sub_stream_type": "",
"content": "{'tool_result': {'organic': [{'title': 'Buy iPhone 15 and iPhone 15 Plus - Apple', 'link': 'https://www.apple.com/shop/buy-iphone/iphone-15', 'snippet': 'BuyFrom $799.00Footnote**Pay with Apple Pay or other payment methods. Finance ...', 'sitelinks': [{'title': 'Buy iPhone 15', 'link': 'https://www.apple.com/shop/buy-iphone/iphone-15/6.1-inch-display-128gb-black-unlocked'}], 'position': 1}, {'title': 'Buy iPhone - Apple', 'link': 'https://www.apple.com/shop/buy-iphone', 'snippet': 'Shop the latest iPhone models and accessories. Save with Apple Trade In, carrier offers, and flexible monthly payment options. Get expert help today.', 'position': 2}, {'title': 'iPhone - Apple', 'link': 'https://www.apple.com/iphone/', 'snippet': 'The ultimate iPhone ... From $999 or $41.62/mo. for 24 mo ... Learn more Buy ... Apple Intelligence.', 'position': 3}, {'title': 'Apple Store - Find a Store', 'link': 'https://www.apple.com/retail/', 'snippet': 'Activation required. AT&T iPhone 15 Special Deal: Buy an iPhone 15 128 GB and get $441.36 in bill credits applied over 36 months. Buy an iPhone 15 256 GB and ...', 'position': 4}, {'title': 'Apple iPhone 15: Order, Price, Colors, Features - Verizon', 'link': 'https://www.verizon.com/smartphones/apple-iphone-15/', 'snippet': \"You'll pay $0.00/mo after a credit of $20.27/mo on your billed price of $20.27/mo per device for 36 mos. Full retail price $729.99. Your total payments will ...\", 'position': 5}, {'title': 'iPhone - Buying iPhone - Apple', 'link': 'https://www.apple.com/iphone/buy/', 'snippet': 'Purchase your next iPhone from the Apple Store. Get answers about carriers ... Greatest price. From $599. Buy \u00b7 Learn more \u00b7 View in AR. 6.1\u2033. Super Retina ...', 'position': 6}, {'title': 'Amazon.com: Apple iPhone 15 Pro Max, 256GB, Natural Titanium', 'link': 'https://www.amazon.com/Apple-iPhone-15-Pro-Max/dp/B0CMZD7VCV', 'snippet': 'List Price: $829.00$829.00 Details. The List Price is the suggested retail price of a new product as provided by a manufacturer, supplier, or seller. Except ...', 'rating': 3.9, 'ratingCount': 1511, 'position': 7}, {'title': 'Interesting to see the USD price difference of the iPhone 15 Pro ...', 'link': 'https://www.reddit.com/r/iphone/comments/16kl59k/interesting_to_see_the_usd_price_difference_of/', 'snippet': '1K votes, 332 comments. For fun I priced out a top-spec 15 Pro Max in Turkey and it comes out to US$3458.88. Cheap!', 'date': 'Sep 17, 2023', 'position': 8}, {'title': 'Apple', 'link': 'https://www.apple.com/', 'snippet': 'Discover the innovative world of Apple and shop everything iPhone, iPad, Apple Watch, Mac, and Apple TV, plus explore accessories, entertainment, ...', 'position': 9}], 'peopleAlsoAsk': [{'question': 'What is the iPhone 15 going to cost?', 'snippet': 'New or existing customer Retail price: $729.99. One-time activation fee of $35.', 'title': 'Apple iPhone 15: Order, Price, Colors, Features - Verizon', 'link': 'https://www.verizon.com/smartphones/apple-iphone-15/'}, {'question': 'How much will Apple pay for an iPhone 15?', 'snippet': 'Get $45\u2013$600 for your trade-in. Get 3% Daily Cash back with Apple Card.', 'title': 'Buy iPhone 15 and iPhone 15 Plus - Apple', 'link': 'https://www.apple.com/shop/buy-iphone/iphone-15'}, {'question': 'How much will I get for an iPhone 15?', 'snippet': 'Get \u00a330-\u00a3595 when you trade in an iPhone. 1\\nYour device\\nEstimated trade-in value 1\\niPhone 15 Pro Max\\nUp to \u00a3595\\niPhone 15 Pro\\nUp to \u00a3535\\niPhone 15 Plus\\nUp to \u00a3420\\niPhone 15\\nUp to \u00a3385', 'title': 'Apple Trade In - Apple (UK)', 'link': 'https://www.apple.com/uk/shop/trade-in'}, {'question': 'How much did the iPhone 15 originally cost?', 'snippet': 'Pricing and Availability iPhone 15 and iPhone 15 Plus will be available in pink, yellow, green, blue, and black in 128GB, 256GB, and 512GB storage capacities, starting at $799 (U.S.) or $33.29 (U.S.) per month, and $899 (U.S.) or $37.45 (U.S.) per month, respectively.', 'title': 'Apple debuts iPhone 15 and iPhone 15 Plus', 'link': 'https://www.apple.com/newsroom/2023/09/apple-debuts-iphone-15-and-iphone-15-plus/'}], 'relatedSearches': [{'query': 'Apple IPhone 13'}, {'query': 'Iphone 15 price official apple store usa'}, {'query': 'Iphone 15 price official apple store near me'}, {'query': 'iPhone 15 Pro Max'}, {'query': 'iPhone 15 price in USA'}, {'query': 'iPhone 15 Pro Max price'}, {'query': 'iPhone 15 Pro Max price in USA'}, {'query': 'iPhone 14'}, {'query': 'iPhone 15 Pro price in USA'}]}, 'tool_elapsed_time': 2.1127848625183105}\n",
"from_sandbox": true,
"stream_state": "running",
"other_info": {}
},
{
"main_stream_type": "tool_result",
"sub_stream_type": "",
"content": "",
"from_sandbox": true,
"stream_state": "end",
"other_info": {}
},
2. agent 調用其他 agent 作為工具,此時會流式返回其他 agent 的 text 和工具調用結果。
{
"main_stream_type": "tool_result",
"sub_stream_type": "text",
"content": ">\n\n",
"from_sandbox": true,
"stream_state": "running",
"other_info": {}
},
{
"main_stream_type": "tool_result",
"sub_stream_type": "tool_result",
"content": "",
"from_sandbox": true,
"stream_state": "start",
"other_info": {}
},
{
"main_stream_type": "tool_result",
"sub_stream_type": "tool_result",
"content": "",
"from_sandbox": true,
"stream_state": "running",
"other_info": {
"web_search": {
"tool_result": {
"organic": [
{
"title": "Buy iPhone 16 and iPhone 16 Plus - Apple",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16",
"snippet": "iPhone 16, Ultramarine finish, back exterior, top rounded corners, advanced dual-camera system, flash, microphone. From $799 or $33.29/mo. per month for 24 mo. ...",
"position": 1
},
{
"title": "iPhone 16 and iPhone 16 Plus - Apple",
"link": "https://www.apple.com/iphone-16/",
"snippet": "iPhone 16 and iPhone 16 Plus. Built for Apple Intelligence. Camera Control. 48MP Fusion camera. Five vibrant colors. A18 chip.",
"position": 2
},
{
"title": "Buy iPhone 16 Plus 128GB Black - Apple",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-128gb-black-unlocked",
"snippet": "iPhone 16 Plus 128GB Black. $929.00. One-time payment. Get 3% Daily Cash with Apple Card. Add to Bag. Order now. Pick up, in store: Today at Apple Knox Street.",
"position": 3
},
{
"title": "Buy iPhone 16 Plus 128GB White - Apple",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-128gb-white-unlocked",
"snippet": "Get $45 - $600 off a new iPhone 16 or iPhone 16 Plus when you trade in an iPhone 8 or newer. 0% financing available. Buy now with free shipping.",
"sitelinks": [
{
"title": "Model. Which Is Best For You...",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-128gb-white-unlocked#:~:text=Model.%20Which%20is%20best%20for%20you%3F"
},
{
"title": "Connectivity. Choose A...",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-128gb-white-unlocked#:~:text=Connectivity.%20Choose%20a%20carrier."
},
{
"title": "What's In The Box",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-128gb-white-unlocked#:~:text=What%27s%20in%20the%20Box"
}
],
"position": 4
},
{
"title": "Buy iPhone 16 Plus 256GB Black - Apple",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-256gb-black-unlocked",
"snippet": "Get $45 - $600 off a new iPhone 16 or iPhone 16 Plus when you trade in an iPhone 8 or newer. 0% financing available. Buy now with free shipping.",
"sitelinks": [
{
"title": "Model. Which Is Best For You...",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-256gb-black-unlocked#:~:text=Model.%20Which%20is%20best%20for%20you%3F"
},
{
"title": "Connectivity. Choose A...",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-256gb-black-unlocked#:~:text=Connectivity.%20Choose%20a%20carrier."
},
{
"title": "What's In The Box",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-256gb-black-unlocked#:~:text=What%27s%20in%20the%20Box"
}
],
"position": 5
},
{
"title": "Buy iPhone - Apple",
"link": "https://www.apple.com/shop/buy-iphone",
"snippet": "Shop the latest iPhone models and accessories. Save with Apple Trade In, carrier offers, and flexible monthly payment options. Get expert help today.",
"position": 6
},
{
"title": "iPhone - Apple",
"link": "https://www.apple.com/iphone/",
"snippet": "Designed for Apple Intelligence. Discover the iPhone 16e along with iPhone 16 Pro, iPhone 16, and iPhone 15 ... Greatest price. From $599 or $24.95/mo ...",
"position": 7
},
{
"title": "Buy iPhone 16 and iPhone 16 Plus - Education - Apple",
"link": "https://www.apple.com/us-edu/shop/buy-iphone/iphone-16",
"snippet": "iPhone 16, Ultramarine finish, back exterior, top rounded corners, advanced dual-camera system, flash, microphone. From $799 or $33.29/mo. per month for 24 mo. ...",
"sitelinks": [
{
"title": "Model. Which Is Best For You...",
"link": "https://www.apple.com/us-edu/shop/buy-iphone/iphone-16#:~:text=Model.%20Which%20is%20best%20for%20you%3F"
},
{
"title": "Connectivity. Choose A...",
"link": "https://www.apple.com/us-edu/shop/buy-iphone/iphone-16#:~:text=Connectivity.%20Choose%20a%20carrier."
},
{
"title": "Applecare+ Coverage. Protect...",
"link": "https://www.apple.com/us-edu/shop/buy-iphone/iphone-16#:~:text=AppleCare%2B%20coverage.%20Protect%20your%20new%20iPhone."
}
],
"position": 8
},
{
"title": "Apple introduces iPhone 16 and iPhone 16 Plus",
"link": "https://www.apple.com/newsroom/2024/09/apple-introduces-iphone-16-and-iphone-16-plus/",
"snippet": "iPhone 16 and iPhone 16 Plus are built for Apple Intelligence, and feature Camera Control, the Action button, a 48MP Fusion camera, and the A18 chip.",
"date": "Sep 9, 2024",
"position": 9
},
{
"title": "Buy iPhone 16 Plus 256GB Pink - Apple",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-256gb-pink-unlocked",
"snippet": "Latest iPhone. Greatest price. From $599. 6.1\u2033. Super Retina XDR display footnote \u00b9. \u2014 No ProMotion technology. \u2014 ...",
"sitelinks": [
{
"title": "Model. Which Is Best For You...",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-256gb-pink-unlocked#:~:text=Model.%20Which%20is%20best%20for%20you%3F"
},
{
"title": "Connectivity. Choose A...",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-256gb-pink-unlocked#:~:text=Connectivity.%20Choose%20a%20carrier."
},
{
"title": "What's In The Box",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-256gb-pink-unlocked#:~:text=What%27s%20in%20the%20Box"
}
],
"position": 10
}
],
"peopleAlsoAsk": [
{
"question": "How much is the iPhone 16 Plus at the Apple Store?",
"snippet": "BuyFrom $899.00**Pay with Apple Pay or other payment methods. Finance$37.45/mo.",
"title": "Buy iPhone 16 Plus 128GB Black - Apple",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-128gb-black-unlocked"
},
{
"question": "How much will the iPhone 16 Plus be?",
"snippet": "Tariffs for iPhone 16 Plus:\nMonthly phone payment\n\u00a322.24\nCash price\n\u00a3800.64\nCredit amount\n\u00a3800.64\nInterest rate (fixed)\n0%\nAPR representative\n0%",
"title": "iPhone 16 Plus | Pay Monthly Deals & Contracts - Tesco Mobile",
"link": "https://www.tescomobile.com/shop/apple/iphone-16-plus"
},
{
"question": "How to get iPhone 16 cheapest?",
"snippet": "Signing up for Boost Mobile's $60 per month Unlimited Premium plan saves you $500 on the iPhone 16E, and the Infinite Access plan for $65 a month saves up to $1,000 on the other models, which will net you the basic iPhone 16, 16 Plus and 16 Pro for free and the 16 Pro Max for less than $6 per month.",
"title": "Best iPhone 16 Deals: Grab a New Phone for Free Thanks to ... - CNET",
"link": "https://www.cnet.com/deals/best-iphone-16-deals/"
},
{
"question": "How much is an iPhone 16 Plus 256GB in the USA?",
"snippet": "BuyFrom $999.00**Pay with Apple Pay or other payment methods.",
"title": "Buy iPhone 16 Plus 256GB Black - Apple",
"link": "https://www.apple.com/shop/buy-iphone/iphone-16/6.7-inch-display-256gb-black-unlocked"
}
],
"relatedSearches": [
{
"query": "Apple iphone 16 plus price official site unlocked"
},
{
"query": "Apple iphone 16 plus price official site usa"
}
]
},
"tool_elapsed_time": 1.5962419509887695
}
}
},
高級用法
使用 Http 請求直接調用 execute 端點:
import requests
import time
url = "http://127.0.0.1:30004"
test_code = f"""
from tools import *
link = "https://www2.census.gov/library/publications/2001/demo/p60-214.html"
query = "Does this document mention any towns with 0% poverty rate for 65+ population and the specified income figures?"
result = web_parse_qwen(link, query)
print(result)
"""
headers = {
"Content-Type": "application/json"
}
def code_tool(code:str):
start_time = time.time() # 記錄開始時間
payload = {
"code":code
}
resp = requests.post(
f"{url}/execute",
headers=headers,
json=payload
)
# print(resp.json())
print(resp.content)
response = resp.json()
elapsed = time.time() - start_time # 計算總耗時
response['total_time'] = elapsed
response['server_time'] = resp.elapsed.total_seconds()
return response
code_tool(test_code)
print([test_code])
替代品
K
Klavis
Klavis AI是一個開源項目,提供在Slack、Discord和Web平臺上簡單易用的MCP(模型上下文協議)服務,包括報告生成、YouTube工具、文檔轉換等多種功能,支持非技術用戶和開發者使用AI工作流。
TypeScript
9.2K
5分
M
MCP
微軟官方MCP服務器,為AI助手提供最新微軟技術文檔的搜索和獲取功能
8.9K
5分
A
Aderyn
Aderyn是一個開源的Solidity智能合約靜態分析工具,由Rust編寫,幫助開發者和安全研究人員發現Solidity代碼中的漏洞。它支持Foundry和Hardhat項目,可生成多種格式報告,並提供VSCode擴展。
Rust
5.9K
5分
D
Devtools Debugger MCP
Node.js調試器MCP服務器,提供基於Chrome DevTools協議的完整調試功能,包括斷點設置、單步執行、變量檢查和表達式評估等
TypeScript
5.4K
4分
S
Scrapling
Scrapling是一個自適應網頁抓取庫,能自動學習網站變化並重新定位元素,支持多種抓取方式和AI集成,提供高性能解析和開發者友好體驗。
Python
7.9K
5分
M
Mcpjungle
MCPJungle是一個自託管的MCP網關,用於集中管理和代理多個MCP服務器,為AI代理提供統一的工具訪問接口。
Go
0
4.5分

Cipher
Cipher是一個專為編程AI代理設計的開源記憶層框架,通過MCP協議與各種IDE和AI編碼助手集成,提供自動記憶生成、團隊記憶共享和雙系統記憶管理等核心功能。
TypeScript
0
5分
N
Nexus
Nexus是一個AI工具聚合網關,支持連接多個MCP服務器和LLM提供商,通過統一端點提供工具搜索、執行和模型路由功能,支持安全認證和速率限制。
Rust
0
4分

Markdownify MCP
Markdownify是一個多功能文件轉換服務,支持將PDF、圖片、音頻等多種格式及網頁內容轉換為Markdown格式。
TypeScript
19.6K
5分

Baidu Map
已認證
百度地圖MCP Server是國內首個兼容MCP協議的地圖服務,提供地理編碼、路線規劃等10個標準化API接口,支持Python和Typescript快速接入,賦能智能體實現地圖相關功能。
Python
27.5K
4.5分

Firecrawl MCP Server
Firecrawl MCP Server是一個集成Firecrawl網頁抓取能力的模型上下文協議服務器,提供豐富的網頁抓取、搜索和內容提取功能。
TypeScript
66.5K
5分

Sequential Thinking MCP Server
一個基於MCP協議的結構化思維服務器,通過定義思考階段幫助分解複雜問題並生成總結
Python
21.9K
4.5分

Notion Api MCP
已認證
一個基於Python的MCP服務器,通過Notion API提供高級待辦事項管理和內容組織功能,實現AI模型與Notion的無縫集成。
Python
13.4K
4.5分

Edgeone Pages MCP Server
EdgeOne Pages MCP是一個通過MCP協議快速部署HTML內容到EdgeOne Pages並獲取公開URL的服務
TypeScript
16.4K
4.8分

Magic MCP
Magic Component Platform (MCP) 是一個AI驅動的UI組件生成工具,通過自然語言描述幫助開發者快速創建現代化UI組件,支持多種IDE集成。
JavaScript
15.5K
5分

Context7
Context7 MCP是一個為AI編程助手提供即時、版本特定文檔和代碼示例的服務,通過Model Context Protocol直接集成到提示中,解決LLM使用過時信息的問題。
TypeScript
45.5K
4.7分
