Elffuss BraidHub

kikocis/continue public

main · 5.7 KiBRawPermalink
1---
2title: "How to Set Up Model Context Protocol (MCP) in Continue"
3description: MCP use and customization
4keywords: [tool, use, function calling, claude, automatic]
5sidebarTitle: "Model Context Protocol (MCP)"
6---
7
8As AI systems get better, they're still held back by their training data and
9can't access real-time information or specialized tools. The [Model Context
10Protocol](https://modelcontextprotocol.io/introduction) (MCP) fixes this by
11letting AI models connect with outside data sources, tools, and environments.
12This allows smooth sharing of information and abilities between AI systems and
13the wider digital world. This standard, created by Anthropic to bring together
14prompts, context, and tool use, is key for building truly useful AI experiences
15that can be set up with custom tools.
16
17## How MCP Works in Continue
18
19Currently custom tools can be configured using the Model Context
20Protocol standard to unify prompts, context, and tool use.
21
22MCP Servers can be added to hub Agents using `mcpServers` blocks. You can
23explore available MCP server blocks
24[here](https://hub.continue.dev/explore/mcp).
25
26<Info>MCP can only be used in the **agent** mode.</Info>
27
28## Quick Start: How to Set Up Your First MCP Server
29
30Below is a quick example of setting up a new MCP server for use in your agent:
31
321. Create a folder called `.continue/mcpServers` at the top level of your workspace
332. Add a file called `playwright-mcp.yaml` to this folder.
343. Write the following contents to `playwright-mcp.yaml` and save.
35
36```yaml title=".continue/mcpServers/playwright-mcp.yaml"
37name: Playwright mcpServer
38version: 0.0.1
39schema: v1
40mcpServers:
41 - name: Browser search
42 command: npx
43 args:
44 - "@playwright/mcp@latest"
45```
46
47Now test your MCP server by prompting the following command:
48
49```
50Open the browser and navigate Hacker News. Save the top 10 headlines in a hn.txt file.
51```
52
53The result will be a generated file called `hn.txt` in the current working directory.
54
55![playwright mcp](/images/mcp-playwright.png)
56
57## How to Set Up Continue Documentation Search with MCP
58
59You can set up an MCP server to search the Continue documentation directly from your agent. This is particularly useful for getting help with Continue configuration and features.
60
61For complete setup instructions, troubleshooting, and usage examples, see the [Continue MCP Reference](/reference/continue-mcp).
62
63## How to Configure MCP Servers
64
65To set up your own MCP server, read the [MCP
66quickstart](https://modelcontextprotocol.io/quickstart) and then [create an
67`mcpServers`
68block](https://hub.continue.dev/new?type=block&blockType=mcpServers) or add a local MCP
69server block to your [config file](./configuration.md):
70
71<Tabs>
72 <Tab title="YAML">
73 ```yaml title="config.yaml"
74 mcpServers:
75 - name: SQLite MCP
76 command: npx
77 args:
78 - "-y"
79 - "mcp-sqlite"
80 - "/path/to/your/database.db"
81
82````
83</Tab>
84<Tab title="JSON">
85```json title="config.json"
86{
87 "experimental": {
88 "modelContextProtocolServers": [
89 {
90 "transport": {
91 "type": "stdio",
92 "command": "uvx",
93 "args": ["mcp-server-sqlite", "--db-path", "/path/to/your/database.db"]
94 }
95 }
96 ]
97 }
98}
99````
100
101 </Tab>
102</Tabs>
103
104### How to Configure MCP Server Properties
105
106MCP blocks follow the established syntax for blocks, with a few additional properties specific to MCP servers.
107
108- `name`: A display name for the MCP server.
109- `type`: The type of the MCP server: `sse`, `stdio`, `streamable-http`
110- `command`: The command to run to start the MCP server.
111- `args`: Arguments to pass to the command.
112- `env`: Secrets to be injected into the command as environment variables.
113
114### How to Choose MCP Transport Types
115
116MCP now supports remote server connections through HTTP-based transports, expanding beyond the traditional local stdio transport method. This enables integration with cloud-hosted MCP servers and distributed architectures.
117
118#### How to Use Server-Sent Events Transport (`sse`)
119
120For real-time streaming communication, use the SSE transport:
121
122```yaml
123mcpServers:
124 - name: Name
125 type: sse
126 url: https://....
127```
128
129#### How to Use Standard Input/Output (`stdio`)
130
131For local MCP servers that communicate via standard input and output:
132
133```yaml
134mcpServers:
135 - name: Name
136 type: stdio
137 command: npx
138 args:
139 - "@modelcontextprotocol/server-sqlite"
140 - "/path/to/your/database.db"
141```
142
143#### How to Use Streamable HTTP Transport
144
145For standard HTTP-based communication with streaming capabilities:
146
147```yaml
148mcpServers:
149 - name: Name
150 type: streamable-http
151 url: https://....
152```
153
154These remote transport options allow you to connect to MCP servers hosted on remote infrastructure, enabling more flexible deployment architectures and shared server resources across multiple clients.
155
156For detailed information about transport mechanisms and their use cases, refer to the official MCP documentation on [transports](https://modelcontextprotocol.io/docs/concepts/transports#server-sent-events-sse).
157
158### How to Work with Secrets in MCP Servers
159
160With some MCP servers you will need to use API keys or other secrets. You can leverage locally stored environments secrets
161as well as access hosted secrets in the Continue Hub. To leverage Hub secrets, you can use the `inputs` property in your MCP env block instead of `secrets`.
162
163```yaml
164mcpServers:
165 - name: Supabase MCP
166 command: npx
167 args:
168 - -y
169 - "@supabase/mcp-server-supabase@latest"
170 - --access-token
171 - ${{ secrets.SUPABASE_TOKEN }}
172 env:
173 SUPABASE_TOKEN: ${{ secrets.SUPABASE_TOKEN }}
174 - name: GitHub
175 command: npx
176 args:
177 - "-y"
178 - "@modelcontextprotocol/server-github"
179 env:
180 GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GITHUB_PERSONAL_ACCESS_TOKEN }}
181```