Skip to main content

MCP Server

SCM can run as an MCP (Model Context Protocol) server, allowing AI assistants to access your context directly.

Running the MCP Server

scm mcp serve

This starts SCM as an MCP server over stdio.

Claude Code Configuration

Add SCM to ~/.claude/settings.json:

{
"mcpServers": {
"scm": {
"command": "/path/to/scm",
"args": ["mcp", "serve"]
}
}
}

Replace /path/to/scm with your actual binary location (e.g., ~/go/bin/scm).

Auto-Registration

By default, SCM auto-registers itself as an MCP server. Control this with:

scm mcp auto-register --disable
scm mcp auto-register --enable

Or in config:

mcp:
auto_register_scm: false

Available MCP Tools

Context Tools

ToolDescription
list_fragmentsList fragments with optional filtering
get_fragmentGet specific fragment content
list_profilesList all profiles
get_profileGet profile configuration
assemble_contextCombine fragments, profiles, tags
list_promptsList all prompts
get_promptGet prompt content
search_contentSearch across all content types

Management Tools

ToolDescription
create_profileCreate new profile
update_profileModify existing profile
delete_profileRemove profile
create_fragmentCreate new fragment
delete_fragmentRemove fragment
apply_hooksApply hooks to backend configs

Remote Tools

ToolDescription
list_remotesList configured remotes
add_remoteRegister new remote
remove_remoteUnregister remote
discover_remotesSearch GitHub/GitLab for SCM repos
browse_remoteList items in remote
preview_remotePreview content before pulling
confirm_pullInstall previewed item

MCP Server Tools

ToolDescription
list_mcp_serversList configured servers
add_mcp_serverAdd server config
remove_mcp_serverRemove server
set_mcp_auto_registerToggle auto-registration

Sync Tools

ToolDescription
sync_dependenciesSync remote dependencies
lock_dependenciesGenerate lockfile
install_dependenciesInstall from lockfile
check_outdatedCheck for updates
check_missing_dependenciesFind missing deps

Tool Schemas

assemble_context

{
"profile": "string",
"bundles": ["string"],
"tags": ["string"]
}

list_fragments

{
"query": "string",
"tags": ["string"],
"sort_by": "name|source",
"sort_order": "asc|desc"
}

search_content

{
"query": "string (required)",
"types": ["fragment", "prompt", "profile", "mcp_server"],
"tags": ["string"],
"sort_by": "name|type|relevance",
"sort_order": "asc|desc",
"limit": "integer"
}

create_profile

{
"name": "string (required)",
"description": "string",
"parents": ["string"],
"bundles": ["string"],
"tags": ["string"],
"default": "boolean"
}

update_profile

{
"name": "string (required)",
"description": "string",
"add_parents": ["string"],
"remove_parents": ["string"],
"add_bundles": ["string"],
"remove_bundles": ["string"],
"add_tags": ["string"],
"remove_tags": ["string"],
"default": "boolean"
}

add_mcp_server

{
"name": "string (required)",
"command": "string (required)",
"args": ["string"],
"backend": "unified|claude-code|gemini"
}

sync_dependencies

{
"profiles": ["string"],
"force": "boolean",
"lock": "boolean",
"apply_hooks": "boolean"
}

MCP Usage Examples

Within an AI assistant conversation:

> assemble context with the developer profile

● scm - assemble_context (MCP)(profile: "developer")
⎿ { "context": "# Development Standards\n..." }

> search for python content

● scm - search_content (MCP)(query: "python", types: ["fragment"])
⎿ { "results": [...], "count": 5 }

> list available remotes

● scm - list_remotes (MCP)()
⎿ { "remotes": [{"name": "scm-main", ...}] }

Managing MCP Servers

SCM can manage MCP server configurations:

scm mcp list
scm mcp add tree-sitter -c "npx" -a "tree-sitter-mcp"
scm mcp add my-server -c "/path/to/server" -b claude-code
scm mcp remove tree-sitter
scm mcp show tree-sitter

Bundle MCP Definitions

Bundles can include MCP server definitions:

mcp:
tree-sitter:
command: "tree-sitter-mcp"
args: ["--stdio"]
notes: "AST parsing for code"
installation: "npm install -g tree-sitter-mcp"

database:
command: "postgres-mcp"
args: ["--connection", "localhost:5432"]
env:
PGPASSWORD: "${PGPASSWORD}"

These MCP servers are registered when the bundle is used.

Security Considerations

warning

MCP servers can execute arbitrary commands with user permissions. Only install servers from trusted sources.

When pulling from remotes:

  • MCP Servers: Can execute arbitrary commands
  • Context Items: Risk of prompt injection
  • Bundles: Combine both risks

Always review content before installing with scm fragment install.