VS Code SetupAdvanced

How to Add an MCP Server to Cline

Extend Cline with a Model Context Protocol server so the agent can use external tools like a filesystem or web fetch.

10 minAdvanced

The Model Context Protocol, or MCP, lets agents call external tools through a standard interface. Cline supports MCP servers, which means you can give the agent abilities like fetching web pages, querying a database, or browsing a sandboxed filesystem. This guide adds an MCP server to Cline and confirms the new tools appear.

What you need

  • Cline installed and connected to a model
  • Node.js installed so npx can run server packages
  • About 9 minutes

Step 1: Open the MCP servers panel

In the Cline panel, open the menu and choose MCP Servers. This view lists installed servers and has an option to edit the configuration file directly. The config is JSON and maps a server name to the command that launches it.

VS Code - Cline MCP panel
MCP SERVERS
----------------------------------------
(no servers configured)
[ Edit Configuration ]
The MCP Servers view inside Cline.

Step 2: Add a server to the config

Click Edit Configuration to open the JSON file. Add an entry under mcpServers with a command and its arguments. The example below adds the official filesystem server, scoped to a single project directory so the agent cannot reach outside it.

cline_mcp_settings.json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/you/projects/demo"
      ]
    }
  }
}
Scope filesystem access tightly
The last argument is the directory the server can touch. Point it at one project folder, never your home directory or root, so an agent action cannot reach files it should not.

Step 3: Save and let the server start

Save the file. Cline launches the server with npx, which downloads the package on first use. When it connects, the server appears in the MCP Servers list with a green status dot and its available tools listed underneath.

Cline - server startup log
Starting MCP server: filesystem
npx @modelcontextprotocol/server-filesystem ...
Connected. Tools: read_file, write_file, list_directory
$

Step 4: Use the new tools in a task

Give Cline a task that needs the tool, such as list every Markdown file in the project and summarize each one. The agent now calls the MCP tools to do it, asking for approval just like any other action.

VS Code - Cline using a tool
You
List every Markdown file in the project
Agent
Calling the filesystem tool list_directory on the project root. Approve this tool use?
Cline calls an MCP tool and requests approval.
One server, many tools
Each MCP server can expose several tools. Add more servers, such as a web fetch or a sqlite server, by adding more entries under mcpServers. Restart is automatic when you save the config.

Result

Cline now has access to an MCP server and its tools, scoped safely to one directory. You can extend the agent with any MCP-compatible server the same way, growing what it can do without changing the extension itself.

Watch related tutorials

Tags
#cline#mcp#tools#agent#config