MCP Reference

The Media Control Protocol (MCP) is a low-level agentic API for interacting with the SwiftyClip environment.

Transport

Communication happens over a secure WebSocket or via stdio for local execution. All messages are JSON-RPC 2.0 compliant.

Tools

list_directory: List files and directories.


interface ListDirectoryParams {
  dir_path: string;
}
// Returns: string[]

Error Codes

CodeDescription
1001Path not found
1002Permission denied

read_file: Read the contents of a file.


interface ReadFileParams {
  file_path: string;
  start_line?: number;
  end_line?: number;
}
// Returns: string

Error Codes

CodeDescription
1001File not found
1003File is binary or too large

grep_search: Search for a pattern in files.


interface GrepSearchParams {
  pattern: string;
  dir_path?: string;
  case_sensitive?: boolean;
}
// Returns: { file_path: string; line: string; line_number: number }[]

Error Codes

CodeDescription
2001Invalid regex pattern

glob: Find files matching a glob pattern.


interface GlobParams {
  pattern: string;
}
// Returns: string[]

Error Codes

CodeDescription

replace: Replace text within a file.


interface ReplaceParams {
  file_path: string;
  old_string: string;
  new_string: string;
  allow_multiple?: boolean;
}
// Returns: void

Error Codes

CodeDescription
1001File not found
3001String to replace not found (exact match required)

write_file: Write content to a file.


interface WriteFileParams {
  file_path: string;
  content: string;
}
// Returns: void

Error Codes

CodeDescription
1002Permission denied or directory does not exist

run_shell_command: Execute a shell command.


interface RunShellCommandParams {
  command: string;
  dir_path?: string;
}
// Returns: { stdout: string; stderr: string; exit_code: number }

Error Codes

CodeDescription
4001Command failed to execute (non-zero exit)
4002Command not in allowlist

web_fetch: Fetch content from a URL.


interface WebFetchParams {
  prompt: string; // Contains URL(s) and instructions
}
// Returns: string

Error Codes

CodeDescription
5001URL is invalid or unreachable
5002Request timed out

google_web_search: Perform a Google web search.


interface GoogleWebSearchParams {
  query: string;
}
// Returns: { title: string; link: string; snippet: string }[]

Error Codes

CodeDescription
6001Search API error

Example Agent Workflow

An agent might use these tools sequentially to accomplish a task, such as finding all TODO comments and consolidating them into a single file.

1. glob({ pattern: "**/*.ts" })
2. For each file -> grep_search({ pattern: "TODO", file_path: file })
3. write_file({ file_path: "TODOs.md", content: ... })

Allowlist & Permissions

By default, agents operate with a restrictive allowlist. File system access is limited to the project directory. The run_shell_command tool can only execute a pre-approved set of safe commands.

Rate Limiting

The MCP API is rate-limited to prevent abuse. The standard limit is 100 requests per minute. Please contact support for higher limits.

Notifications

Agents can send notifications to the user interface by emitting a specially formatted JSON object to stdout.