cline-local mcp for Cline CLI
Interact with the local Cline CLI via two MCP tools: ask_cline (analysis/chat) and ask_cline_workspace (isolated Git worktree analysis).
ask_cline: Ask the authenticated Cline CLI for analysis/chat responses without approving file edits. Parameters:prompt(required), optionalcwd,thinking(none/low/medium/high/xhigh),systemPrompt, andtimeoutSeconds(max 300).ask_cline_workspace: Analyze a Git repository in a disposable detached worktree that is always cleaned up. Parameters:promptandcwd(required), optionalthinkingandtimeoutSeconds(max 300).Note: The README describes an
apply_cline_editstool, but it is not present in the provided server schema, so it is not exposed by this server version.
Provides tools for applying edits to a Git checkout and analyzing Git repositories in disposable detached worktrees, including diff inspection and worktree management.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cline-local mcp for Cline CLIReview this repository for security issues without modifying any files."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Local Cline MCP Bridge
This is a local stdio MCP server that exposes tools to interact with the authenticated Cline CLI: ask_cline (analysis/chat), apply_cline_edits (development tasks in the current Git checkout), and ask_cline_workspace (isolated Git workspace analysis in a temporary worktree).
Requirements
Node.js 20 or newer
The Cline CLI already installed and authenticated (
cline.exeon Windows)
Related MCP server: Workbench MCP Server
Install, build, and launch
npm install
npm run build
npm test
npm startnpm start runs a stdio server, so it will appear idle until an MCP client connects. Do not type prompts into that terminal.
MCP client configuration
Build first, then add this server to an MCP client that supports stdio servers:
{
"mcpServers": {
"cline-local": {
"command": "node",
"args": ["C:\\Develop\\ClineMcp\\dist\\index.js"]
}
}
}Tools
1. ask_cline
Ask the locally installed Cline CLI for an analysis/chat response. File edits are not approved (--auto-approve false).
ask_cline({
prompt: string,
cwd?: string,
thinking?: "none" | "low" | "medium" | "high" | "xhigh",
timeoutSeconds?: number,
systemPrompt?: string,
provider?: string,
model?: string
})timeoutSecondsdefaults to180and is limited to300.thinkingdefaults tonone.provider: Optional provider identifier (regex:^[A-Za-z0-9._:/@-]{1,120}$), passed to Cline as-P <provider>.model: Optional model identifier (regex:^[A-Za-z0-9._:/@-]{1,120}$), passed to Cline as-m <model>.Reserved object property names (
__proto__,constructor,prototype) are rejected.On Windows,
promptis limited to 20,000 characters andsystemPromptto 8,000. Together they may not exceed 24,000 characters.The bridge always spawns the CLI with
shell: falseand mergesCLINE_NO_AUTO_UPDATE=1intoprocess.env.
2. apply_cline_edits
Have Cline implement a development task directly in the current Git checkout. Files may change, but commits are forbidden and the resulting diff is returned.
apply_cline_edits({
prompt: string,
cwd: string,
thinking?: "none" | "low" | "medium" | "high" | "xhigh",
timeoutSeconds?: number,
provider?: string,
model?: string
})Errors from apply_cline_edits return structured JSON output with kind, message, exitCode, attempts, stderrTail, stdoutTail, and Git evidence.
3. ask_cline_workspace
Analyze a Git repository in a disposable detached worktree. The worktree is always cleaned up after execution.
ask_cline_workspace({
prompt: string,
cwd: string,
thinking?: "none" | "low" | "medium" | "high" | "xhigh",
timeoutSeconds?: number,
provider?: string,
model?: string
})Provider and Model Settings Coordination
Configuration file access and override runs are coordinated using a fair readers-writer lock (AsyncRwLock):
Calls without an override take a shared read lock for their run, allowing multiple default runs to execute concurrently while ensuring no override run modifies the underlying configuration file during their execution.
Calls with a
providerormodeloverride take an exclusive write lock for their execution and restore lifecycle.Writers are queued fairly without starvation.
If a call is aborted while waiting for the lock, it is immediately dequeued and cancelled with kind
cancelled.Before spawning an override run, the bridge snapshots the current default settings (
lastUsedProvider, and the target provider'ssettings.modelandsettings.reasoning) from the providers configuration file (CLINE_PROVIDER_SETTINGS_PATH,CLINE_DATA_DIR/settings/providers.json, or~/.cline/data/settings/providers.json).If the provider block was absent before the run and created by Cline, only
lastUsedProvideris restored; fields in the newly created block are never deleted.After the run (success or failure), the bridge re-reads the configuration file and restores only those specific fields if they were modified, preserving refreshed OAuth tokens, credentials, and all other provider configurations.
Restoration is performed via an atomic write (temporary file with mode
0o600+ atomic rename, with Windows retry onEPERM/EBUSY). If no tracked fields were modified, no disk write occurs.On unparseable or read-failing settings files, restoration is skipped with a warning to prevent corrupting disk state.
Error Handling, Warnings, and Recovery
The bridge makes failures visible and recoverable rather than returning generic messages:
Real Errors, Tails, and Secret Redaction
On failure, errors are surfaced as structured text (or JSON for apply_cline_edits) containing:
Kind: Machine-readable error code.Message: Human-readable description, including extracted JSONL error messages where available.Exit code: The CLI exit code or signal termination detail (if applicable).Attempts: Total attempts made (initial + retry).Stderr tail: Last ~2,000 characters of stderr, with sensitive secrets redacted.Stdout tail: Last ~2,000 characters of stdout, with sensitive secrets redacted.
Secret redaction is applied to full stdout/stderr streams before taking tails to prevent tokens from being split across tail boundaries, and also applies to extractedMessage and error summaries. Redaction patterns cover sk-..., nvapi-..., Bearer ..., JSON keys ("apiKey", "api_key", "accessToken", "refreshToken", "token", "secret", "password", "key", "authorization"), and environment-style KEY=value / *_KEY=value definitions (API_KEY, TOKEN, SECRET, PASSWORD, KEY, NVIDIA_KEY, etc.).
Process Exit and Settlement Grace Period
Settlement listens for process exit as well as close. If Cline or a child daemon keeps stdio pipes open after exiting, the bridge waits a 500 ms grace period after exit before destroying the streams and settling with the collected output, preventing hangs and avoiding holding the settings lock indefinitely.
Error Kinds
non_zero_exit: CLI exited with a non-zero code on a non-transient error, was terminated by an external signal without a completed result, or failed with an explicit error inrun_result.transient_provider_error: Provider overload, rate limit (429), 5xx with HTTP context, "temporarily unavailable", ECONNRESET, ETIMEDOUT, or upstream provider errors that failed after an automatic retry with backoff (~2-3s). Stderr info messages (such asrate limit remaining: 99) are ignored when classifying errors.timeout: CLI exceeded the configured timeout. The error message includes configured limit and actual elapsed seconds, plus output tails.cline_updating: Cline CLI entry file is missing or stderr indicatedMODULE_NOT_FOUND/Cannot find moduleduring an update. The bridge retries once and reports"Cline CLI is missing or being updated; retry in ~30 s".cancelled: Request cancelled via client abort signal before execution, during backoff, or while waiting in the lock queue.launch_failed: Invalid input arguments, missing executable, process spawn errors (ENOENT,EACCES), or process launch failure.malformed_json/missing_final_result: Process completed with code 0 but stdout did not produce a valid terminal result.workspace_not_git,workspace_setup_failed,workspace_cleanup_failed: Worktree management failures.commit_created,edits_inspection_failed: Git checkout modification failures.
Success Despite Non-Zero Exit or External Signal
When Cline successfully answers but exits with code 1 or an external signal (for example, printing a completed run_result or an agent_event done with reason:"completed", followed by session not found on stderr), the bridge recovers the completed text, returns success, and includes a warnings array (e.g. ["cline exited with code 1 after a completed result: session not found: <id>"]).
Clean Exit 0 Provider Errors
If Cline exits with code 0 but stdout contains a run_result with finishReason: "error", the error is extracted and classified prior to clean exit parsing. Transient errors trigger an automatic retry; non-transient errors report the extracted failure message clearly rather than throwing missing_final_result.
Safe Retry Behavior
Transient errors trigger a single automatic retry with a short backoff.
Timeouts are retried once if
timeoutSeconds <= 120. Runs withtimeoutSeconds > 120are not retried to prevent exceeding client-side timeouts.Non-transient errors (syntax errors, invalid flags, authentication rejections) are never retried.
For
apply_cline_edits, a retry is only attempted if the first attempt produced no tool calls and no working tree / HEAD modifications; if any change occurred or if uncertain, edits are not retried.
Available Tools
2 toolsask_clineC
Ask the locally installed Cline CLI for an analysis/chat response. File edits are not approved.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | ||
| prompt | Yes | ||
| thinking | No | ||
| systemPrompt | No | ||
| timeoutSeconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must carry the behavioral disclosure burden. It does disclose one important trait: file edits are not approved. However, it leaves other behaviors unstated, such as how the CLI is invoked, whether commands can be executed, what side effects may occur, and how errors or partial responses are handled.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short sentences with no filler. The purpose is front-loaded, and the safety constraint earns its place. It is concise without sacrificing the key message.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has five parameters and no annotations or output schema, yet the description only covers the high-level action and a single safety note. It omits any explanation of cwd, thinking levels, system prompt, timeout settings, or return value shape, making it incomplete for reliable invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate for the schema's silence. It does not mention or explain any of the five parameters (prompt, cwd, thinking, systemPrompt, timeoutSeconds), providing no semantic value beyond what the plain parameter names suggest.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a clear verb and resource: 'Ask the locally installed Cline CLI for an analysis/chat response.' This makes the basic purpose evident. It does not explicitly contrast with the sibling ask_cline_workspace, though the 'locally installed' phrasing hints at a distinction.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to use this tool versus ask_cline_workspace, nor are any exclusions or prerequisites mentioned. The sentence 'File edits are not approved' is a constraint, not usage guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ask_cline_workspaceB
Analyze a Git workspace through Cline in a disposable worktree. The worktree is always removed after the request.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | Yes | ||
| prompt | Yes | ||
| thinking | No | ||
| timeoutSeconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It discloses the key non-obvious behavior: 'The worktree is always removed after the request.' This clarifies that side effects are contained in a disposable environment, which is valuable. It does not mention other potential behaviors like network access or code execution, but the lifecycle disclosure is strong.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two tightly written sentences, with the core purpose first and the essential disposal behavior second. Every word earns its place; there is no fluff or repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers purpose and one behavioral trait, but with four undocumented parameters, no output schema, and no annotations, an agent is left without guidance on parameter meaning, expected return value, or how this differs from ask_cline. Too much is left to inference for a complete tool definition.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description does not explicitly define any of the four parameters. It indirectly hints that cwd refers to the Git workspace and prompt is the Cline request, but thinking and timeoutSeconds are completely unexplained. The description fails to compensate for the schema's silence.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('Analyze') and resource ('a Git workspace'), and adds a mechanism ('through Cline in a disposable worktree') that distinguishes it from the sibling ask_cline. It is clear but not as explicit as naming the alternative or describing the exact outcome.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for analyzing a Git workspace in a safe, throwaway context, but it does not explicitly say when to prefer this tool over ask_cline or when not to use it. No exclusion criteria or alternative routing is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v1.0.0- First observed
ask_cline - First observed
ask_cline_workspace
TDQS
Scored across 2 tools
The two tools are completely distinct: one is for general chat/analysis, and the other specifically analyzes a Git workspace in a disposable worktree. There is no ambiguity in their purposes.
Both tools share the 'ask_cline' prefix with one using a descriptive '_workspace' suffix. The naming pattern is clear, consistent, and easy to predict.
Two tools is slightly below the typical range, but each tool has a distinct and necessary role for the server's stated purpose. The set is minimal yet not underdeveloped.
For an analysis-only interface to the Cline CLI, the two tools cover all stated use cases: general chat and workspace analysis. No obvious missing operations or dead ends exist within this narrow domain.
Maintenance
Related MCP Connectors
Paid remote MCP for LLM security scans, jailbreak checks, analytics, checkout, and readiness.
A paid remote MCP for OpenAI Codex agent coordination MCP, built to return verdicts, receipts, usage
Remote MCP for Gemini upgrade evals, prompt regressions, output diffs, and eval receipts.
- QuallaaOAuthcom.quallaa
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables MCP clients to spawn and control Codex CLI and Claude Code sessions on the host machine, with session management and filesystem access.4MIT
- AlicenseNot gradedqualityDmaintenanceProvides remote project access via MCP, enabling file operations, code search, git commands, and background Claude CLI execution.0MIT
- FlicenseNot gradedqualityCmaintenanceEnables ISLI agents and MCP clients to dispatch natural-language coding and terminal tasks to a locally-installed Claude Code CLI, supporting both one-shot execution and persistent sessions with workspace and security controls.-
- AlicenseAqualityAmaintenanceEnables MCP clients like Claude Code and Codex to delegate coding tasks to Cursor's CLI agent, which implements changes in the workspace and returns clean, structured results for review.3255 npm9MIT