MCP — Slack Server
Enforce Scopebound policies on agents using the Slack MCP server.
Install
Role template
from scopebound import ScopeboundSDK
from scopebound.adapters.mcp_slack import SlackMCPAdapter
sb = ScopeboundSDK(base_url="https://your-partner.api.scopebound.ai", api_key="sb-...")
role = SlackMCPAdapter.role_template(
name="slack-agent",
allowed_channels=["#engineering", "#alerts", "#scopebound-demo"],
block_external_dms=True, # block DMs to users outside your workspace
approval_required_external=True # HITL on any send to an external-facing channel
)
sb.create_role(**role)
Integration
from scopebound.adapters.mcp_slack import SlackMCPAdapter
adapter = SlackMCPAdapter(sb, role_id="slack-agent")
@server.pre_call
def enforce(tool_name: str, arguments: dict) -> None:
adapter.enforce(tool_name, arguments)
Enforced tools
| Tool | Default policy | Notes |
|---|---|---|
list_channels |
Allow | No channel restriction on listing |
send_message |
Allow | Channel must be in allowed_channels |
post_to_channel |
Allow | Channel must be in allowed_channels |
send_dm |
Deny | Blocked entirely when block_external_dms=True |
External channel sends
If approval_required_external=True, any post_to_channel or send_message targeting a channel outside your internal whitelist triggers HITL approval before delivery.
Deny codes
| Code | Trigger |
|---|---|
SCOPE_VIOLATION |
Tool not in role's allowed_tools |
PARAMETER_VIOLATION |
Channel not in allowed_channels, or DM to external user blocked |
MCP_SERVER_UNAUTHORIZED |
Agent's JWT does not include slack in allowed_mcp_servers |
MCP_TOOL_NOT_FOUND |
Tool name not in Slack MCP server's declared manifest |
MCP_ARGUMENT_SCHEMA_VIOLATION |
Required argument (channel or user) missing from call |
Example: block message to unlisted channel
from scopebound import ScopeboundDenyError
try:
adapter.enforce("post_to_channel", {"channel": "#all-company", "text": "Hello!"})
except ScopeboundDenyError as e:
print(e.deny_code) # PARAMETER_VIOLATION
print(e.reason) # "channel #all-company is not in allowed_channels"
Direct endpoint
curl -X POST https://your-partner.api.scopebound.ai/v1/mcp/enforce \
-H "X-Scopebound-API-Key: sb-your-key" \
-H "Content-Type: application/json" \
-d '{
"jwt": "your-session-jwt",
"tool_name": "post_to_channel",
"arguments": {"channel": "#engineering", "text": "Deploy complete"},
"mcp_server": "slack",
"mcp_tool_schema": {"required": ["channel", "text"]}
}'