Spring AI Mcp Tool调用乱码
·
Spring AI Mcp Tool调用乱码

由于Spring AI 编写的Mcp Server在Stdio通信方式下,System.in和System.out使用的字符集与Mcp Client不同,所以造成乱码。我的问题出现在windows系统中,因为默认终端编码为GBK,如果Server编码为UTF-8,Client为GBK,就会出现这种乱码情况。
解决方法:
Client和Server的 JVM 都指定 -Dfile.encoding=UTF-8,applicatoin.yaml增加配置如下:
server:
servlet:
encoding:
charset: UTF-8
force: true
enabled: true
更多推荐



所有评论(0)