Skip to content

SCM plugins

SCM integrations subclass ScmPluginBase (@coro-ai/plugin-sdk). The runner always needs a tiny native footprint even when ninety percent of automation flows through MCP.

Required lifecycle + native ops

MethodResponsibility
init(config, deps)Validate credentials (Zod-enforced manifest schema)
cloneInfo({ repo })Return HTTPS URL plus GIT_* env vars for spawning git
matchesRemote(remoteUrl)Decide whether .git/config URIs bind to this plugin
pollPr(ref)Poll PR snapshot while no MCP session exists (PollingTransport)

Failure to implement accurate pollPr breaks parked jobs in local polling mode.

Optional native PR operations

Traditional REST implementations may override:

  • createPr, getPrStatus, listPrComments, postPrComment, mergePr, …

MCP-first plugins omit these entirely and expose mcpServer() instead — the shim tools (scm_create_pr) may respond with redirection payload telling the agent to invoke mcp__<provider>__* directly.

normalizeInbound?(req)

Converts webhook HTTP envelopes into canonical NormalizedEvent objects { ref, kind, raw, … }. Return null for irrelevant payloads.

writerCreatePr?(args)

Self-improvement PRs bypass live MCP sessions — plugins must optionally implement a miniature native opener or refuse proposals gracefully.

Reference implementation

@coro-ai/plugin-gitlab demonstrates MCP-first authoring:

  1. Minimal native methods (cloneInfo, pollPr, matchesRemote).
  2. mcpStdioDescriptor pointing at @modelcontextprotocol/server-gitlab.
  3. allowedMcpTools whitelisting high-value GitLab MCP operations.
  4. Optional snippet under intelligence/snippets/*.md.

Copy its structure when adding self-managed GitLab, Gitea, Forgejo, etc.