Skip to content
refact-planner edited this page Jun 7, 2026 · 1 revision

MCP

Model Context Protocol integration for local stdio servers and remote HTTP/SSE servers.

Refact’s MCP integration connects the agent to external MCP servers using the Rust SDK (rmcp). The engine supports stdio, SSE / streamable HTTP, and OAuth-based authentication for HTTP transports.

Transport support

The engine has separate transport initializers for local and remote servers:

  • stdio: launches a process and connects over stdin/stdout
  • SSE / streamable HTTP: connects to a remote endpoint and streams events
  • streamable HTTP: used by the HTTP transport implementation in the current engine code
  • OAuth 2.0 PKCE and client credentials: supported via the MCP auth layer

The default request headers include a Refact User-Agent string:

User-Agent: Refact.ai (+https://github.com/JegernOUTT/refact)

Lazy discovery

MCP tools are discovered lazily so the agent does not flood every request with every remote schema, prompt, and resource.

The intended flow is:

  1. search for a tool with tool_search
  2. call it with mcp_call

That keeps tool registration lightweight until a specific server capability is actually needed.

Configuration

Project-local MCP configs live under:

.refact/integrations/*.yaml

The engine also documents the same integration family in AGENTS.md and exposes integration configuration through the GUI and HTTP API.

What MCP covers

The MCP integration includes support for:

  • tool registration and execution
  • resources
  • prompts
  • sampling
  • auth token persistence and refresh
  • session state and reconnection settings

Related implementation files

  • src/integrations/mcp/integr_mcp_stdio.rs
  • src/integrations/mcp/integr_mcp_sse.rs
  • src/integrations/mcp/integr_mcp_http.rs
  • src/integrations/mcp/mcp_auth.rs
  • src/integrations/mcp/mcp_prompts.rs
  • src/integrations/mcp/mcp_resources.rs
  • src/integrations/mcp/session_mcp.rs
  • src/integrations/mcp/tool_mcp.rs

GUI and config surface

The MCP setup UI uses schema files such as mcp_stdio_schema.yaml, mcp_sse_schema.yaml, mcp_http_schema.yaml, and mcp_unified_schema.yaml to describe user-facing settings.

See also: Integrations, Agent Tools

Clone this wiki locally