MCP 协议详细分析一 (initialize ping tools/list tools/call)

本节基于 实现一个 java 的mcp client 调用的 一个python 的mcp server 的日志,完整展示一次典型的 MCP Java SDK 通信流程、工具调用、通知机制与日志记录,仅包含 echo-simple 和 echo-with-notifications 两个工具,内容简明、无省略。

2. 详细流程图

主程序McpAsyncClientCustomLoggingTransportHttpClientSseTransportMCP服务器创建CustomLoggingHttpClientTransport委托HTTP传输层构建McpAsyncClient调用initialize()发送initialize请求POST /sse/ (initialize)HTTP POST请求返回初始化响应传递响应处理初始化响应初始化完成发送initialized通知POST /sse/ (initialized)HTTP POST请求调用tools/list发送tools/list请求POST /sse/ (tools/list)HTTP POST请求返回工具列表传递响应处理工具列表响应工具列表返回调用callTool(echo-with-notifications)发送tools/call请求POST /sse/ (tools/call)HTTP POST请求发送多条notifications/message传递通知处理通知触发loggingConsumer发送tools/call响应传递最终响应处理最终响应返回工具调用结果调用closeGracefully()关闭连接关闭HTTP连接关闭SSE连接主程序McpAsyncClientCustomLoggingTransportHttpClientSseTransportMCP服务器

3. 详细日志记录(按请求分组)

请求:initialize

=== MCP DEMO CLIENT WITH NOTIFICATIONS AND SAMPLING ===
Connecting to MCP server at: http://localhost:8080
=========================================================
Custom logging HTTP transport created--- Initializing client ---
22:13:36.494 [main] DEBUG i.m.client.McpAsyncClient - Initialization process started
=== ESTABLISHING MCP CONNECTION ===
Target Server URL: http://localhost:8080
SSE Endpoint: http://localhost:8080/sse/
Setting up SSE connection for MCP communication
Handler configured for bidirectional message processing
=====================================
22:13:36.601 [main] DEBUG i.m.spec.McpClientSession - Sending message for method initialize
=== SENDING MCP MESSAGE ===
Target URL: http://localhost:8080/sse/
HTTP Method: POST
Content-Type: application/json
User-Agent: MCP-Java-SDK-Debug/1.0
Authorization: Bearer abcd1234
Message type: JSONRPCRequest
Message content: {"jsonrpc":"2.0","method":"initialize","id":"5ed91d29-0","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"Spring AI MCP Client","version":"0.3.1"}}}
===========================
=== MESSAGE SENT SUCCESSFULLY ===
HTTP POST to http://localhost:8080/sse/ completed
=================================
22:13:36.665 [HttpClient-1-Worker-1] DEBUG i.m.spec.McpSchema - Received JSON message: {"jsonrpc":"2.0","id":"5ed91d29-0","result":{"protocolVersion":"2024-11-05","capabilities":{"experimental":{},"prompts":{"listChanged":true},"resources":{"subscribe":false,"listChanged":true},"tools":{"listChanged":true}},"serverInfo":{"name":"python mcp server","version":"1.10.1"}}}
=== INCOMING MCP MESSAGE ===
Received from: http://localhost:8080/sse/
Message type: JSONRPCResponse
Message content: {"jsonrpc":"2.0","id":"5ed91d29-0","result":{"protocolVersion":"2024-11-05","capabilities":{"experimental":{},"prompts":{"listChanged":true},"resources":{"subscribe":false,"listChanged":true},"tools":{"listChanged":true}},"serverInfo":{"name":"python mcp server","version":"1.10.1"}}}
============================
22:13:36.715 [HttpClient-1-Worker-1] DEBUG i.m.spec.McpClientSession - Received Response: JSONRPCResponse[jsonrpc=2.0, id=5ed91d29-0, result={protocolVersion=2024-11-05, capabilities={experimental={}, prompts={listChanged=true}, resources={subscribe=false, listChanged=true}, tools={listChanged=true}}, serverInfo={name=python mcp server, version=1.10.1}}, error=null]
22:13:36.739 [HttpClient-1-Worker-1] INFO  i.m.client.McpAsyncClient - Server response with Protocol: 2024-11-05, Capabilities: ServerCapabilities[completions=null, experimental={}, logging=null, prompts=PromptCapabilities[listChanged=true], resources=ResourceCapabilities[subscribe=false, listChanged=true], tools=ToolCapabilities[listChanged=true]], Info: Implementation[name=python mcp server, version=1.10.1] and Instructions null
=== SENDING MCP MESSAGE ===
Target URL: http://localhost:8080/sse/
HTTP Method: POST
Content-Type: application/json
User-Agent: MCP-Java-SDK-Debug/1.0
Authorization: Bearer abcd1234
Message type: JSONRPCNotification
Message content: {"jsonrpc":"2.0","method":"notifications/initialized"}
===========================
=== OUTGOING MCP RESPONSE ===
Sending to: http://localhost:8080/sse/
Response type: JSONRPCResponse
=== MESSAGE SENT SUCCESSFULLY ===
HTTP POST to http://localhost:8080/sse/ completed
=================================
Response content: {"jsonrpc":"2.0","id":"5ed91d29-0","result":{"protocolVersion":"2024-11-05","capabilities":{"experimental":{},"prompts":{"listChanged":true},"resources":{"subscribe":false,"listChanged":true},"tools":{"listChanged":true}},"serverInfo":{"name":"python mcp server","version":"1.10.1"}}}
==============================
Client initialized successfully

请求:ping

--- Pinging server ---
22:13:36.765 [main] DEBUG i.m.client.McpAsyncClient - Joining previous initialization
22:13:36.767 [main] DEBUG i.m.spec.McpClientSession - Sending message for method ping
=== SENDING MCP MESSAGE ===
Target URL: http://localhost:8080/sse/
HTTP Method: POST
Content-Type: application/json
User-Agent: MCP-Java-SDK-Debug/1.0
Authorization: Bearer abcd1234
Message type: JSONRPCRequest
Message content: {"jsonrpc":"2.0","method":"ping","id":"5ed91d29-1"}
===========================
=== MESSAGE SENT SUCCESSFULLY ===
HTTP POST to http://localhost:8080/sse/ completed
=================================
22:13:36.773 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpSchema - Received JSON message: {"jsonrpc":"2.0","id":"5ed91d29-1","result":{}}
=== INCOMING MCP MESSAGE ===
Received from: http://localhost:8080/sse/
Message type: JSONRPCResponse
Message content: {"jsonrpc":"2.0","id":"5ed91d29-1","result":{}}
============================
22:13:36.775 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpClientSession - Received Response: JSONRPCResponse[jsonrpc=2.0, id=5ed91d29-1, result={}, error=null]
=== OUTGOING MCP RESPONSE ===
Sending to: http://localhost:8080/sse/
Response type: JSONRPCResponse
Ping successful. Response:
{ }

请求:tools/list

--- Listing tools ---
22:13:36.776 [main] DEBUG i.m.client.McpAsyncClient - Joining previous initialization
Response content: {"jsonrpc":"2.0","id":"5ed91d29-1","result":{}}
==============================
22:13:36.777 [main] DEBUG i.m.spec.McpClientSession - Sending message for method tools/list
=== SENDING MCP MESSAGE ===
Target URL: http://localhost:8080/sse/
HTTP Method: POST
Content-Type: application/json
User-Agent: MCP-Java-SDK-Debug/1.0
Authorization: Bearer abcd1234
Message type: JSONRPCRequest
Message content: {"jsonrpc":"2.0","method":"tools/list","id":"5ed91d29-2","params":{}}
===========================
=== MESSAGE SENT SUCCESSFULLY ===
HTTP POST to http://localhost:8080/sse/ completed
=================================
22:13:36.787 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpSchema - Received JSON message: {"jsonrpc":"2.0","id":"5ed91d29-2","result":{"tools":[{"name":"echo-simple","description":"简单的Echo工具:直接返回输入的消息(不包装JSON格式)\n\nArgs:\n    message: 要回显的消息\n    \nReturns:\n    相同的输入消息","inputSchema":{"properties":{"message":{"title":"Message","type":"string"}},"required":["message"],"type":"object"},"outputSchema":{"properties":{"result":{"title":"Result","type":"string"}},"required":["result"],"title":"_WrappedResult","type":"object","x-fastmcp-wrap-result":true}},{"name":"echo-with-notifications","description":"带不同级别通知的Echo工具:演示MCP日志通知功能\n\nArgs:\n    message: 要回显的消息\n    notification_level: 通知级别\n    \nReturns:\n    处理后的消息","inputSchema":{"properties":{"message":{"description":"要回显的消息","title":"Message","type":"string"},"notification_level":{"default":"info","description":"通知级别 (debug/info/warning/error)","title":"Notification Level","type":"string"}},"required":["message"],"type":"object"},"outputSchema":{"properties":{"result":{"title":"Result","type":"string"}},"required":["result"],"title":"_WrappedResult","type":"object","x-fastmcp-wrap-result":true}}]}}
=== INCOMING MCP MESSAGE ===
Received from: http://localhost:8080/sse/
Message type: JSONRPCResponse
Message content: {"jsonrpc":"2.0","id":"5ed91d29-2","result":{"tools":[{"name":"echo-simple","description":"简单的Echo工具:直接返回输入的消息(不包装JSON格式)\n\nArgs:\n    message: 要回显的消息\n    \nReturns:\n    相同的输入消息","inputSchema":{"properties":{"message":{"title":"Message","type":"string"}},"required":["message"],"type":"object"},"outputSchema":{"properties":{"result":{"title":"Result","type":"string"}},"required":["result"],"title":"_WrappedResult","type":"object","x-fastmcp-wrap-result":true}},{"name":"echo-with-notifications","description":"带不同级别通知的Echo工具:演示MCP日志通知功能\n\nArgs:\n    message: 要回显的消息\n    notification_level: 通知级别\n    \nReturns:\n    处理后的消息","inputSchema":{"properties":{"message":{"description":"要回显的消息","title":"Message","type":"string"},"notification_level":{"default":"info","description":"通知级别 (debug/info/warning/error)","title":"Notification Level","type":"string"}},"required":["message"],"type":"object"},"outputSchema":{"properties":{"result":{"title":"Result","type":"string"}},"required":["result"],"title":"_WrappedResult","type":"object","x-fastmcp-wrap-result":true}}]}}
============================
22:13:36.791 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpClientSession - Received Response: JSONRPCResponse[jsonrpc=2.0, id=5ed91d29-2, result={tools=[{name=echo-simple, description=简单的Echo工具:直接返回输入的消息(不包装JSON格式)Args:message: 要回显的消息Returns:相同的输入消息, inputSchema={properties={message={title=Message, type=string}}, required=[message], type=object}, outputSchema={properties={result={title=Result, type=string}}, required=[result], title=_WrappedResult, type=object, x-fastmcp-wrap-result=true}}, {name=echo-with-notifications, description=带不同级别通知的Echo工具:演示MCP日志通知功能Args:message: 要回显的消息notification_level: 通知级别Returns:处理后的消息, inputSchema={properties={message={description=要回显的消息, title=Message, type=string}, notification_level={default=info, description=通知级别 (debug/info/warning/error), title=Notification Level, type=string}}, required=[message], type=object}, outputSchema={properties={result={title=Result, type=string}}, required=[result], title=_WrappedResult, type=object, x-fastmcp-wrap-result=true}}]}, error=null]
=== OUTGOING MCP RESPONSE ===
Sending to: http://localhost:8080/sse/
Response type: JSONRPCResponse--- Testing Notifications Feature ---
Response content: {"jsonrpc":"2.0","id":"5ed91d29-2","result":{"tools":[{"name":"echo-simple","description":"简单的Echo工具:直接返回输入的消息(不包装JSON格式)\n\nArgs:\n    message: 要回显的消息\n    \nReturns:\n    相同的输入消息","inputSchema":{"properties":{"message":{"title":"Message","type":"string"}},"required":["message"],"type":"object"},"outputSchema":{"properties":{"result":{"title":"Result","type":"string"}},"required":["result"],"title":"_WrappedResult","type":"object","x-fastmcp-wrap-result":true}},{"name":"echo-with-notifications","description":"带不同级别通知的Echo工具:演示MCP日志通知功能\n\nArgs:\n    message: 要回显的消息\n    notification_level: 通知级别\n    \nReturns:\n    处理后的消息","inputSchema":{"properties":{"message":{"description":"要回显的消息","title":"Message","type":"string"},"notification_level":{"default":"info","description":"通知级别 (debug/info/warning/error)","title":"Notification Level","type":"string"}},"required":["message"],"type":"object"},"outputSchema":{"properties":{"result":{"title":"Result","type":"string"}},"required":["result"],"title":"_WrappedResult","type":"object","x-fastmcp-wrap-result":true}}]}}
==============================

请求:tools/call(echo-with-notifications)

Request params:
{"name" : "echo-with-notifications","arguments" : {"notification_level" : "warning","message" : "测试通知功能!"}
}
22:13:36.807 [main] DEBUG i.m.client.McpAsyncClient - Joining previous initialization
22:13:36.808 [main] DEBUG i.m.spec.McpClientSession - Sending message for method tools/call
=== SENDING MCP MESSAGE ===
Target URL: http://localhost:8080/sse/
HTTP Method: POST
Content-Type: application/json
User-Agent: MCP-Java-SDK-Debug/1.0
Authorization: Bearer abcd1234
Message type: JSONRPCRequest
Message content: {"jsonrpc":"2.0","method":"tools/call","id":"5ed91d29-3","params":{"name":"echo-with-notifications","arguments":{"notification_level":"warning","message":"测试通知功能!"}}}
===========================
=== MESSAGE SENT SUCCESSFULLY ===
HTTP POST to http://localhost:8080/sse/ completed
=================================
22:13:36.820 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpSchema - Received JSON message: {"method":"notifications/message","params":{"level":"debug","data":"这是一个调试级别的通知"},"jsonrpc":"2.0"}
=== INCOMING MCP MESSAGE ===
Received from: http://localhost:8080/sse/
Message type: JSONRPCNotification
Message content: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"debug","data":"这是一个调试级别的通知"}}
============================
22:13:36.823 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpClientSession - Received notification: JSONRPCNotification[jsonrpc=2.0, method=notifications/message, params={level=debug, data=这是一个调试级别的通知}]
22:13:36.842 [HttpClient-1-Worker-2] DEBUG i.m.client.McpAsyncClient - Logging: LoggingMessageNotification[level=DEBUG, logger=null, data=这是一个调试级别的通知]=== NOTIFICATION RECEIVED ===
Level: DEBUG
Logger: null
Data: 这是一个调试级别的通知
=============================
=== OUTGOING MCP RESPONSE ===
Sending to: http://localhost:8080/sse/
Response type: JSONRPCNotification
Response content: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"debug","data":"这是一个调试级别的通知"}}
==============================
22:13:36.845 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpSchema - Received JSON message: {"method":"notifications/message","params":{"level":"info","data":"这是一个信息级别的通知"},"jsonrpc":"2.0"}
=== INCOMING MCP MESSAGE ===
Received from: http://localhost:8080/sse/
Message type: JSONRPCNotification
Message content: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"这是一个信息级别的通知"}}
============================
22:13:36.847 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpClientSession - Received notification: JSONRPCNotification[jsonrpc=2.0, method=notifications/message, params={level=info, data=这是一个信息级别的通知}]
22:13:36.848 [HttpClient-1-Worker-2] DEBUG i.m.client.McpAsyncClient - Logging: LoggingMessageNotification[level=INFO, logger=null, data=这是一个信息级别的通知]=== NOTIFICATION RECEIVED ===
Level: INFO
Logger: null
Data: 这是一个信息级别的通知
=============================
=== OUTGOING MCP RESPONSE ===
Sending to: http://localhost:8080/sse/
Response type: JSONRPCNotification
Response content: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"这是一个信息级别的通知"}}
==============================
22:13:36.850 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpSchema - Received JSON message: {"method":"notifications/message","params":{"level":"warning","data":"警告:您选择了警告级别来处理消息: 测试通知功能!"},"jsonrpc":"2.0"}
=== INCOMING MCP MESSAGE ===
Received from: http://localhost:8080/sse/
Message type: JSONRPCNotification
Message content: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"warning","data":"警告:您选择了警告级别来处理消息: 测试通知功能!"}}
============================
22:13:36.851 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpClientSession - Received notification: JSONRPCNotification[jsonrpc=2.0, method=notifications/message, params={level=warning, data=警告:您选择了警告级别来处理消息: 测试通知功能!}]
22:13:36.852 [HttpClient-1-Worker-2] DEBUG i.m.client.McpAsyncClient - Logging: LoggingMessageNotification[level=WARNING, logger=null, data=警告:您选择了警告级别来处理消息: 测试通知功能!]=== NOTIFICATION RECEIVED ===
Level: WARNING
Logger: null
Data: 警告:您选择了警告级别来处理消息: 测试通知功能!
=============================
=== OUTGOING MCP RESPONSE ===
Sending to: http://localhost:8080/sse/
Response type: JSONRPCNotification
Response content: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"warning","data":"警告:您选择了警告级别来处理消息: 测试通知功能!"}}
==============================
22:13:36.854 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpSchema - Received JSON message: {"jsonrpc":"2.0","id":"5ed91d29-3","result":{"content":[{"type":"text","text":"{\"result\": true, \"message\": \"带warning级别通知的Echo成功\", \"timestamp\": \"2025-07-19T22:13:36.819802Z\", \"tool_name\": \"echo_with_notifications\", \"data\": {\"echo_message\": \"测试通知功能!\", \"notification_level\": \"warning\", \"notifications_sent\": [\"debug\", \"info\", \"warning\"]}}"}],"structuredContent":{"result":"{\"result\": true, \"message\": \"带warning级别通知的Echo成功\", \"timestamp\": \"2025-07-19T22:13:36.819802Z\", \"tool_name\": \"echo_with_notifications\", \"data\": {\"echo_message\": \"测试通知功能!\", \"notification_level\": \"warning\", \"notifications_sent\": [\"debug\", \"info\", \"warning\"]}}"},"isError":false}}
=== INCOMING MCP MESSAGE ===
Received from: http://localhost:8080/sse/
Message type: JSONRPCResponse
Message content: {"jsonrpc":"2.0","id":"5ed91d29-3","result":{"content":[{"type":"text","text":"{\"result\": true, \"message\": \"带warning级别通知的Echo成功\", \"timestamp\": \"2025-07-19T22:13:36.819802Z\", \"tool_name\": \"echo_with_notifications\", \"data\": {\"echo_message\": \"测试通知功能!\", \"notification_level\": \"warning\", \"notifications_sent\": [\"debug\", \"info\", \"warning\"]}}"}],"structuredContent":{"result":"{\"result\": true, \"message\": \"带warning级别通知的Echo成功\", \"timestamp\": \"2025-07-19T22:13:36.819802Z\", \"tool_name\": \"echo_with_notifications\", \"data\": {\"echo_message\": \"测试通知功能!\", \"notification_level\": \"warning\", \"notifications_sent\": [\"debug\", \"info\", \"warning\"]}}"},"isError":false}}
============================
22:13:36.856 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpClientSession - Received Response: JSONRPCResponse[jsonrpc=2.0, id=5ed91d29-3, result={content=[{type=text, text={"result": true, "message": "带warning级别通知的Echo成功", "timestamp": "2025-07-19T22:13:36.819802Z", "tool_name": "echo_with_notifications", "data": {"echo_message": "测试通知功能!", "notification_level": "warning", "notifications_sent": ["debug", "info", "warning"]}}}], structuredContent={result={"result": true, "message": "带warning级别通知的Echo成功", "timestamp": "2025-07-19T22:13:36.819802Z", "tool_name": "echo_with_notifications", "data": {"echo_message": "测试通知功能!", "notification_level": "warning", "notifications_sent": ["debug", "info", "warning"]}}}, isError=false}, error=null]
=== OUTGOING MCP RESPONSE ===
Sending to: http://localhost:8080/sse/
Response type: JSONRPCResponse
Response content: {"jsonrpc":"2.0","id":"5ed91d29-3","result":{"content":[{"type":"text","text":"{\"result\": true, \"message\": \"带warning级别通知的Echo成功\", \"timestamp\": \"2025-07-19T22:13:36.819802Z\", \"tool_name\": \"echo_with_notifications\", \"data\": {\"echo_message\": \"测试通知功能!\", \"notification_level\": \"warning\", \"notifications_sent\": [\"debug\", \"info\", \"warning\"]}}"}],"structuredContent":{"result":"{\"result\": true, \"message\": \"带warning级别通知的Echo成功\", \"timestamp\": \"2025-07-19T22:13:36.819802Z\", \"tool_name\": \"echo_with_notifications\", \"data\": {\"echo_message\": \"测试通知功能!\", \"notification_level\": \"warning\", \"notifications_sent\": [\"debug\", \"info\", \"warning\"]}}"},"isError":false}}
==============================
Notification tool response:
{"content" : [ {"type" : "text","text" : "{\"result\": true, \"message\": \"带warning级别通知的Echo成功\", \"timestamp\": \"2025-07-19T22:13:36.819802Z\", \"tool_name\": \"echo_with_notifications\", \"data\": {\"echo_message\": \"测试通知功能!\", \"notification_level\": \"warning\", \"notifications_sent\": [\"debug\", \"info\", \"warning\"]}}"} ],"isError" : false
}--- Waiting for notifications ---
Timeout waiting for notifications, received: 3 out of 5 expected

请求:closeGracefully

--- Closing client ---
=== CLOSING MCP CONNECTION ===
Closing connection to: http://localhost:8080/sse/
Initiating graceful shutdown of transport
Transport closed successfully
==============================
Client closed successfully

4. 工具列表与参数(本次仅包含 echo-simple、echo-with-notifications)

22:13:36.787 [HttpClient-1-Worker-2] DEBUG i.m.spec.McpSchema - Received JSON message: {"jsonrpc":"2.0","id":"5ed91d29-2","result":{"tools":[{"name": "echo-simple","description": "简单的Echo工具:直接返回输入的消息(不包装JSON格式)\n\nArgs:\n    message: 要回显的消息\n    \nReturns:\n    相同的输入消息","inputSchema": {"properties": {"message": { "title": "Message", "type": "string" }},"required": ["message"],"type": "object"},"outputSchema": {"properties": {"result": { "title": "Result", "type": "string" }},"required": ["result"],"title": "_WrappedResult","type": "object","x-fastmcp-wrap-result": true}},{"name": "echo-with-notifications","description": "带不同级别通知的Echo工具:演示MCP日志通知功能\n\nArgs:\n    message: 要回显的消息\n    notification_level: 通知级别\n    \nReturns:\n    处理后的消息","inputSchema": {"properties": {"message": { "description": "要回显的消息", "title": "Message", "type": "string" },"notification_level": { "default": "info", "description": "通知级别 (debug/info/warning/error)", "title": "Notification Level", "type": "string" }},"required": ["message"],"type": "object"},"outputSchema": {"properties": {"result": { "title": "Result", "type": "string" }},"required": ["result"],"title": "_WrappedResult","type": "object","x-fastmcp-wrap-result": true}}
]}}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/web/90164.shtml
繁体地址,请注明出处:http://hk.pswp.cn/web/90164.shtml
英文地址,请注明出处:http://en.pswp.cn/web/90164.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SLAM学习资料记录

ORB_SLAM2 创建自己的数据集(还未使用) 【SLAM实战篇】Ubuntu 20.04版本(OpenCV版本4.5.3)对于ORB-SLAM2安装运行,代码编译,自己的数据集构造_ubuntu20.04 安装运行orb_slam2算法-CSDN博客 卡尔曼滤波数据…

用Phi-3 Mini微调实现英文到尤达语翻译

用Phi-3 Mini微调实现英文到尤达语翻译 引言 本文将带你快速上手大模型微调实践——以微软的Phi-3 Mini 4K Instruct模型为例,教你如何将其微调为一个能把英文翻译成"尤达语"(《星球大战》中尤达大师的独特说话风格)的模型。这是一…

AI助力,轻松实现人声分离伴奏提取

亲爱的小伙伴们!前段时间,有一位同事家的可爱小孩参加了一场英语演讲比赛。同事找到我,希望我能帮个忙,把讲视频中的人声去掉,只提取出其中相应的伴奏。今天,我就来和大家分享一下究竟如何实现从 MP4 视频中…

第1章第2章笔记

OSI参考模型---开放式系统互联模型---OSI/RM ISO--->国际标准化组织;特点:先有模型,在又协议。 OSI七层参考模型:应用层 --- 提供网络服务;自然语言-->编码表示层 --- 对数据的处理;格式化&#xff0…

图的BFS和DFS

一,图的遍历逻辑1.之前我们学了图的存储,可以邻接表存和邻接矩阵存。现在我们要学习图的遍历操作和树类似可以分为深度遍历和广度遍历,而深度遍历也是用递归实现,广度遍历是用队列实现2.深度遍历(DFS)a.确定起点b.找到一条边按顺时…

WWDC 25 给自定义 SwiftUI 视图穿上“玻璃外衣”:最新 Liquid Glass 皮肤详解

引子 各位 iOS 足球体育健儿们,且听我一言!想当年在《少林足球》里,阿星一句“做人如果没梦想,那跟咸鱼有什么分别啊?”点燃了多少人的江湖梦。 如今在 SwiftUI 江湖里,Apple 于 WWDC 25 推出的 Liquid Gl…

Day01_C++

01.思维导图02.方法一&#xff1a;#include <iostream> #include <cstring> #include <iostream> using namespace std; class mystring { private:char* buf;int len;public:mystring(const char* str);void copy(const char* ptr);void copy(mystring ptr)…

C语言学习(days09)

二维数组的定义与特性二维数组的声明格式为&#xff1a;类型说明符 数组名[表达式1][表达式2];[下标1]表示行索引&#xff0c;[下标2]表示列索引。二维数组可视为由多个一维数组组成&#xff0c;a[0]表示第0行的首地址&#xff08;即一维数组地址&#xff09;a[0][0]表示第0的第…

WIFI路由器长期不重启,手机连接时提示无IP分配

今天在公司&#xff0c;突然发现手机连不上公司WIFI。每次链接&#xff0c;提示无IP分析。我以为是我手机出问题了&#xff0c;想复位一下。后来一想万一复位还是不灵&#xff0c;怎么办&#xff1f;同事认为是路由器没有重启的原因。于是找到路由器&#xff0c;重启&#xff0…

【前沿技术动态】【AI总结】RustFS:从 0 到 1 打造下一代分布式对象存储

目录1 引言&#xff1a;为什么我们又需要一个新的对象存储2 RustFS 全景速览3 技术架构深度拆解3.1 整体拓扑3.2 关键数据结构&#xff08;rust 伪代码&#xff09;3.3 读写路径&#xff08;写放大 < 1.1&#xff09;4 核心源码导读4.1 关键函数跟踪4.2 一段最小可复现示例5…

ImageNet1K数据集的下载解压与处理

前言 博主因为这个数据集踩了好多坑&#xff0c;浪费了好几天时间&#xff0c;最近终于找到了高效的办法&#xff0c;写此篇文章来记录具体操作方法&#xff0c;也希望可以帮助到有需要的人。&#xff08;主要是在云服务器是使用&#xff09; 下载数据集 一共下载三个文件&…

OkHttp 与 Room 结合使用:构建高效的 Android 本地缓存策略

前言在现代 Android 应用开发中&#xff0c;网络请求与本地数据持久化是两大核心功能。OkHttp 作为强大的网络请求库&#xff0c;与 Jetpack Room 持久化库的结合使用&#xff0c;可以创建高效的数据缓存策略&#xff0c;提升应用性能和用户体验。本文将详细介绍如何将这两者完…

Nacos中feign.FeignException$BadGateway: [502 Bad Gateway]

Nacos中feign.FeignException$BadGateway: [502 Bad Gateway] 文章目录Nacos中feign.FeignException$BadGateway: [502 Bad Gateway]背景原因背景 Mac本地运行Nacos微服务项目&#xff0c;调用服务失败 原因 关闭本地代理clash或者其他&#xff0c;windows没发现问题&#x…

基于deepseek的LORA微调

LORA微调&#xff1a; 核心是&#xff1a;低秩转换&#xff0c;减少参数。冻结大部分&#xff0c;调节部分模块(注意力模块的Wq&#xff0c;Wk&#xff0c;Wv)。 调整过后得到一个lora.safetensors, 内部记录了(detail W: 即部分修改的W)。推理使用原权重和lora权重。 具体操…

Linux运维新手的修炼手扎之第22天

Tomcat服务1 java项目部署方式&#xff1a;war包部署、jar包部署、源代码部署2 Ubuntu环境部署Java - openjdk[熟练]:#安装软件rootubuntu24-13:~# apt update; apt list openjdk*rootubuntu24-13:~# apt install openjdk-11-jdk -y#检测效果rootubuntu24-13:~# whereis javaja…

Python爬虫实战:研究Genius库相关技术

1. 引言 在当今数字化时代,音乐数据的分析与挖掘成为了音乐学、计算机科学等领域的研究热点。歌词作为音乐的重要组成部分,蕴含着丰富的情感、文化和社会信息。通过对歌词数据的分析,可以揭示音乐风格的演变、流行趋势的变化以及社会情绪的波动等。 Genius 是一个专注于歌词…

内核协议栈源码阅读(一) ---驱动与内核交互

文章目录 一、硬中断 1.1 `e100_intr` 1.2 `__netif_rx_schedule` 1.3 补充: 二、软中断 2.1 net_rx_action 2.2 e100_poll 2.3 补充 三、非 NAPI 的软中断处理 3.1 netif_rx 3.2 backlog_dev->poll 3.3 补充 四、总结 以 e100_intr 为例: 一、硬中断 1.1 e100_intr 网卡…

Vue3 面试题及详细答案120道(61-75 )

《前后端面试题》专栏集合了前后端各个知识模块的面试题&#xff0c;包括html&#xff0c;javascript&#xff0c;css&#xff0c;vue&#xff0c;react&#xff0c;java&#xff0c;Openlayers&#xff0c;leaflet&#xff0c;cesium&#xff0c;mapboxGL&#xff0c;threejs&…

ubuntulinux快捷键

1.复制文件使用cp命令。cp是复制的简写。语法也很简单。使用&#xff0c;cp后跟要复制的文件以及要将其移动到的目的地cp ~/Downloads/your-file.txt ~/Documents/2.复制文件夹为了复制文件夹及其内容&#xff0c;您将需要告诉cp命令以递归方式复制。使用-r标志就足够简单了。c…

将 `knife4j` 和 `springdoc-openapi` 集成到你的 Spring Boot 应用

集成 knife4j 和 springdoc-openapi 可以让你在 Spring Boot 应用中拥有更美观和功能丰富的 API 文档界面。knife4j 是基于 Swagger 的一个 UI 增强包,而 springdoc-openapi 则是用于生成 OpenAPI 3 文档的库。下面是如何将两者集成到你的 Spring Boot 项目中的步骤。 步骤 1…