| layout | default |
|---|---|
| title | Chapter 6: MCP and Tool Extensions |
| nav_order | 6 |
| parent | Roo Code Tutorial |
Welcome to Chapter 6: MCP and Tool Extensions. In this part of Roo Code Tutorial: Run an AI Dev Team in Your Editor, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.
Roo Code becomes a platform interface when connected to external tools. This chapter defines a safe rollout model for MCP and custom tool extensions.
- issue and incident systems
- internal docs and knowledge APIs
- deployment and CI systems
- cloud and observability controls
flowchart LR
A[Roo Task] --> B[MCP Client Layer]
B --> C1[Docs Tool]
B --> C2[Issue Tool]
B --> C3[Ops Tool]
C1 --> D[Structured Result]
C2 --> D
C3 --> D
D --> E[Next Step Decision]
| Contract Area | Requirement |
|---|---|
| inputs | strict schema and validation |
| outputs | deterministic structured response |
| side effects | explicit read-only vs mutating |
| errors | actionable machine-readable categories |
| runtime | timeout and retry bounds |
Loose tool contracts create unreliable agent behavior.
- start with read-only tools
- verify output quality in real workflows
- add mutating tools with explicit approvals
- log all mutating calls
- disable or remove noisy tools quickly
- least-privilege tokens per tool
- environment-separated credentials
- audit logs for mutating operations
- emergency disable switch for unstable tools
- one tool doing too many unrelated actions
- vague or unstructured error responses
- implicit side effects not declared in contract
- retries with no maximum bound
- schema contracts are documented
- side effects are explicit
- auth scopes are minimal
- timeout/retry behavior is tested
- approval policy is aligned with risk level
You now have a practical extension strategy for Roo Code:
- MCP-first integration model
- staged risk-based rollout
- secure credential and audit boundaries
Next: Chapter 7: Profiles and Team Standards
Use the following upstream sources to verify MCP and tool extension implementation details while reading this chapter:
src/shared/mcp.ts— defines the MCP server configuration types and connection settings used to declare external tool servers in Roo Code's settings.src/services/mcp/McpHub.ts— manages the lifecycle of MCP server connections, tool discovery, and tool invocation routing for all registered MCP servers.
Suggested trace strategy:
- review the
McpServerConfigtype insrc/shared/mcp.tsto understand what connection parameters are configurable - trace
McpHub.tsfor connection establishment, tool listing (listTools), and invocation flow - check
src/core/tools/use_mcp_tool.tsfor how the agent constructs MCP tool calls during task execution
flowchart LR
A[mcp.ts config] --> B[McpHub.ts connection manager]
B --> C[MCP server process]
C --> D[use_mcp_tool.ts invocation]
D --> E[Tool result returned to agent]