- OpenAI Connectors: OpenAI-maintained MCP wrappers for third party services that don’t have official MCP servers (Gmail, Google Drive, Outlook, Microsoft Teams, Dropbox etc.). Using these connectors requires OAuth client registration and authorization with the provider.
- Remote MCP servers: Any MCP server operated by you or a third party. You provide the server URL and any required authentication details, and the agent can call the server’s MCP tools.
Two ways to use MCP Tools & OpenAI Connectors in MeshAgent
1. User-Toggleable Tools (Per-Message)
Use this when you want users to choose tools on demand, per message or per conversation — similar to ChatGPT/Claude tool toggles. Examples- “Enable Google Drive only for this question”
- “Use Teams for this message, but not the next”
- Avoid tool bloat by not attaching dozens of tools permanently
- You deploy MCP servers / connectors as services so they’re available in a room/project
- Your agent is configured to accept MCP tools dynamically
- Your UI lets users toggle tools on/off, and passes the selection to the agent
- ChatGPT-style experiences
- Reducing agent bloat by deploying multiple tools and toggling them on/off as needed during interactive agent sessions
- Best when tools require explicit approval
2. Always-On Tools (Agent-Owned)
Use this when your agent should always have access to specific tools. Examples- A support agent that always needs ticketing tools
- A repo assistant that always needs GitHub MCP tools
- A bot that always reads from a single internal system
- You attach MCP tools to the agent via the SDK (
toolkits), or deploy an agent/service that includes them. - The agent will always have these tools available on every turn.
- Agents that routinely need access to certain tools
- Background agents who should have access to the tool by default
- Cases when users should not choose tools manually
OpenAIResponsesAdapter. This adapter gathers the toolkits available to the agent on that turn, manages tool execution, streaming responses, and returning the final result.
Tool lists are rebuilt on every user message by merging always-on toolkits with any user-selected toolkits for that turn. For the full flow see How Tools and Toolkits Work.
User-Toggleable Tools (Per-Message)
This section shows you how to let users dynamically enable/disable OpenAI Connectors and MCP servers per conversation or message — similar to how ChatGPT and Claude let you toggle tools on and off.When to use user-toggleable tools
Use this mode when you want users to control which capabilities are available on demand. This helps reduce agent bloat by avoiding deployments where each agent has a different permutation of tools. If an agent should always have specific capabilities, you can use the always-on approach instead (attach tools viatoolkits).
Note: Even with user-toggleable tools, users can enable multiple (or even all) tools at once. The difference is that tools are opt-in per message, rather than permanently attached to the agent.User-toggleable tools are supported automatically when you run a process-backed agent with a chat channel and flags like
--mcp. This enables per-message tool selection and is supported in MeshAgent Studio and Powerboards automatically. You can implement the same pattern when building agents with the MeshAgent SDK by adding toolkit builders (e.g. MCPToolkitBuilder()) and passing the user’s tool selection to the agent each turn.
How user-toggleable tools work
User-toggleable MCP tool selection has three pieces:- Deployed services that expose MCP servers or OpenAI Connectors
- An agent configured to accept MCP tools dynamically
- A UI that displays available services and lets users toggle them on/off
Example 1: Dynamic MCP Tools in MeshAgent
Step 1: Create the Service YAML
First you need to package and deploy a project or room service for the MCP Servers or OpenAI Connectors you want the agent to have access to. You can do this by defining a service yaml file and deploying the service using the MeshAgent CLI. For example, let’s deploy the DeepWiki MCP Server which provides tools for reading public GitHub repositories (no authentication required). To do so we’ll create a YAML file that defines the service and deploy it with the CLI. Create ameshagent.yaml file for the MCP DeepWiki service.
Step 2: Deploy the service
Step 3: Configure your agent to accept MCP tools
Your agent needs to be configured withMCPToolkitBuilder() so it can accept tools selected by the user. A process-backed agent with a chat channel does this automatically with the --mcp flag.
Note: The process CLI also supports other dynamic toolkits like--web-searchand--storagethat work similarly. They add toolkit builders so users can enable/disable these capabilities per message.
Step 4: Test in MeshAgent Studio
Go to MeshAgent Studio and try out the agent. You’ll be able to turn on the MCP DeepWiki tool from the UI. The UI automatically discovers and displays available services and shows them as selectable tools that users can toggle on/off. If you’re building a custom UI, you’ll need to implement similar discovery and selection functionality.Example 2: Create a MeshAgent Service for an OpenAI Connector
OpenAI Connectors require OAuth authentication. You’ll need to register an OAuth client with the service provider first. See OpenAI’s documentation for additional instructions. Once you register your OAuth API client you can create and deploy the service just like we did for the MCP Server.Step 1: Create the Service YAML
Step 2: Deploy the service
Step 3: Start a process-backed agent with MCP enabled
Step 4: Use It in MeshAgent Studio
Open MeshAgent Studio, go to your room, and you’ll see “Microsoft Teams” as a toggleable tool. Enable it to let the agent read Teams messages!Example 3: Always-on MCP Tools with meshagent process
If the agent should always have MCP tools available on every turn, enable required MCP instead of making the tools user-toggleable.
Once the MCP or connector service is deployed, start the agent with --require-mcp:
- the agent should always have MCP tools available
- users should not toggle the tool on and off per message
- you want a stable tool configuration for every turn
Security and best practices
When adding external tools like MCP Servers or OpenAI Connectors consider:- What data you’re sharing with external services
- Who operates the MCP servers you connect to
- Whether agents should require approval before using certain tools
Related Topics
- How Tools and Toolkits Work: How toolkits are collected per turn and routed to the adapter.
- Introduction to Services and Containers: Learn more about project and room services and how to run ad-hoc commands using the Containers API.
- Packaging and Deploying Services: Learn how to create a meshagent.yaml file to package a project or room service
- Packaging and Deploying Services: Learn how to deploy a project or room service from MeshAgent Studio or using the MeshAgent CLI
- Secrets: Understand how to use secrets and OAuth with MeshAgent