Skip to content

[问题] 为什么要在validateToolEndpoint方法中ban掉内部地址调用? #299

@DamosChen

Description

@DamosChen

⚠️ 验证

  • 我已经搜索过 issues,确信这不是一个重复的问题。

❓ 您的问题

我在本地通过kind部署了unla,使用traefik作为gateway。
traefik、mcp-gateway通过kubectl forward放行了端口到宿主机。
因为kind与宿主机localhost天生隔离,故mcp-gateway无法通过默认配置localhost:5236/users访问mockserver。我将工具配置中的url改为了K8S core DNS(mock-server.unla.svc.cluster.local:),且pod内验证可以访问
root@mcp-gateway-795dd8cc97-2khzk:/app# curl http://mock-server.unla.svc.cluster.local:5236/users/email/i@damos.wang
{"error":"user not found"}
但通过MCP CLIENT访问(SSE)时,仍旧会报下面的错
Error: internal network access is disabled for tool endpoint

代码搜索后,发现是validateToolEndpoint中验证了internalAddr并做了拦截

请问针对kind用户,有什么好的解决方法吗?另外很想学习了解下拦截内部地址的考量?

📚 上下文

No response

🔗 相关资源

No response

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions