Skip to content

.NET: Issue: Clarification Needed on "Code Mode" Usage and Best Practices for MCP Integration #2046

@rahulraibit

Description

@rahulraibit

I am currently building solutions that rely heavily on the MCP server. In many discussions and documentation sources, it’s suggested that Code Mode is the preferred or more efficient way to use MCP. Before we fully commit to this approach, we’re looking for confirmation from the community—has anyone successfully tested or deployed MCP using Code Mode? If so, could you please share your experiences or any best practices?

Background & Current Challenges:

My current setup results in high token consumption and significant associated costs when interacting with the MCP server.
To optimize, we have also evaluated the HostedCodeInterpreterTool, anticipating it would reduce these issues.
However, during runtime, we observed that outbound network calls are either blocked or not enabled, preventing successful connections to the MCP servers. This limitation is hindering our ability to properly test or utilize the tool.

Links for Reference:
https://blog.cloudflare.com/code-mode/
https://www.anthropic.com/engineering/code-execution-with-mcp

Questions & Request for Guidance

Has anyone validated Code Mode with MCP integration in a production-like scenario?
Are there recommended best practices or configurations to enable outbound calls when using tools like HostedCodeInterpreterTool, specifically for connecting with MCP servers?
Given my constraints (high token usage and blocked outbound calls), what would be the most efficient way to integrate and test MCP in real-world agent workflows?

I greatly appreciate any insights, examples, or workarounds from those who have addressed similar challenges. Your guidance will help me ensure I am following the most effective approach as we scale our use of MCP.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions