To connect your Cline AI agent to a local MCP server, you'll need to configure it using the STDIO transport method, which is designed specifically for local servers running on your machine[1].
Cline stores all MCP server settings in a file called cline_mcp_settings.json
[1]. This file uses a JSON format with an mcpServers
object containing your server configurations.
Here's the typical structure for connecting to a local MCP server:
{
"mcpServers": {
"your-server-name": {
"command": "python",
"args": ["/path/to/your/server.py"],
"env": {
"API_KEY": "your_api_key"
},
"alwaysAllow": ["tool1", "tool2"],
"disabled": false
}
}
}
command
: The executable command to run your local server (e.g.,"python"
,"node"
,"npx"
)args
: Array of arguments passed to the command, typically including the path to your server script
env
: Environment variables to inject into the server process (useful for API keys or configuration)alwaysAllow
: Array of tool names that should be automatically allowed without confirmationdisabled
: Boolean to enable/disable the server (defaults tofalse
)
{
"mcpServers": {
"my-python-server": {
"command": "python",
"args": ["/path/to/server.py"],
"env": {
"DATABASE_URL": "sqlite:///local.db"
}
}
}
}
{
"mcpServers": {
"my-node-server": {
"command": "node",
"args": ["/path/to/server.js"],
"env": {
"PORT": "3000"
}
}
}
}
{
"mcpServers": {
"sqlite-server": {
"command": "npx",
"args": ["-y", "mcp-sqlite", "/path/to/database.db"]
}
}
}
You can also configure MCP servers through Cline's interface[1]:
- Click the MCP Servers icon in the top navigation bar
- Select the "Installed" tab
- Click "Configure MCP Servers" at the bottom
- Add your server configuration through the UI
You can set the maximum response time for MCP server tool calls using the Network Timeout dropdown, with options ranging from 30 seconds to 1 hour (default is 1 minute)[1].
Cline allows you to restrict or disable MCP server functionality entirely using the Cline>Mcp:Mode
setting[1].
- Use absolute paths for your server executables and scripts
- Set appropriate environment variables for configuration rather than hardcoding values
- Test your server independently before adding it to Cline
- Use the
alwaysAllow
parameter for frequently-used, trusted tools to reduce confirmation prompts
This configuration will enable your Cline AI agent to communicate with your local MCP server using the STDIO transport protocol, allowing seamless integration of your custom tools and capabilities.
[1] https://github.com/lastmile-ai/mcp-agent [2] https://modelcontextprotocol.io/clients [3] https://github.com/mcp-use/mcp-use [4] https://dzone.com/articles/mcp-client-agent-architecture-amp-implementation [5] https://openai.github.io/openai-agents-python/mcp/ [6] https://code.visualstudio.com/docs/copilot/chat/mcp-servers [7] https://docs.mistral.ai/agents/mcp/ [8] https://learn.microsoft.com/en-us/dynamics365/customer-service/administer/configure-ai-agent-to-use-mcp-server [9] https://docs.anthropic.com/en/docs/claude-code/mcp [10] https://dev.to/debs_obrien/building-your-first-mcp-server-a-beginners-tutorial-5fag [11] https://huggingface.co/learn/mcp-course/en/unit1/mcp-clients [12] https://docs.continue.dev/customize/deep-dives/mcp [13] https://www.mcpworld.com/en/detail/4d6d346fbbd6c049cc34b7f719c1b7d3 [14] https://www.pulsemcp.com/posts/introduction-to-fast-agent-mcp-client [15] https://modelcontextprotocol.io/quickstart/user [16] https://www.youtube.com/watch?v=aiH79Q-LGjY [17] https://modelcontextprotocol.io/quickstart/server [18] https://docs.cline.bot/mcp/configuring-mcp-servers [19] https://dev.to/developer_harsh/how-to-build-mcp-servers-and-test-locally-from-scratch-3d4j [20] https://www.reddit.com/r/ClaudeAI/comments/1ll88ay/local_mcp_servers_can_now_be_installed_with_one/
MCP Configuration for Terminal-Based Servers
When your local MCP server runs in a terminal, you'll use the STDIO transport method, which is the standard approach for terminal-based processes. The configuration follows the same basic structure as other local servers but with specific considerations for terminal execution.
Basic Terminal Server Configuration
For a terminal-based MCP server, your
cline_mcp_settings.json
configuration will look like this:Key Configuration Parameters
Required Parameters
command
: The executable that runs your terminal server (e.g.,"node"
,"python"
,"npx"
)args
: Array containing the path to your server script and any startup argumentsOptional Parameters
env
: Environment variables for the terminal process1alwaysAllow
: Tools that don't require confirmation (commonly["execute_command"]
for terminal servers)disabled
: Enable/disable the server (defaults tofalse
)Common Terminal Server Examples
Node.js Terminal Server
Python Terminal Server
NPX-based Terminal Server
Terminal Server Capabilities
Most terminal-based MCP servers provide the
execute_command
tool with these parameters2:command
session
env
host
username
Environment Configuration
Terminal servers often require specific environment variables2:
Important Considerations
Path Requirements
Security Settings
alwaysAllow
for trusted tools likeexecute_command
Session Management
Terminal servers typically support session persistence, allowing you to maintain state across multiple command executions within the same session2.
This configuration enables your Cline AI agent to communicate with your terminal-based MCP server using the STDIO transport protocol, providing full terminal command execution capabilities within your development environment.
Footnotes
https://docs.cline.bot/mcp/configuring-mcp-servers ↩
https://playbooks.com/mcp/weidwonder-terminal ↩ ↩2 ↩3