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
| Method | Responsibility |
|---|---|
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:
- Minimal native methods (
cloneInfo,pollPr,matchesRemote). mcpStdioDescriptorpointing at@modelcontextprotocol/server-gitlab.allowedMcpToolswhitelisting high-value GitLab MCP operations.- Optional snippet under
intelligence/snippets/*.md.
Copy its structure when adding self-managed GitLab, Gitea, Forgejo, etc.