mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-21 04:41:16 -05:00
Add mcp-servers dir
This commit is contained in:
@@ -2,12 +2,12 @@ import osName from "os-name"
|
||||
import defaultShell from "default-shell"
|
||||
import os from "os"
|
||||
import { McpServer } from "../../shared/mcp"
|
||||
import { McpHub } from "../../services/mcp/McpHub"
|
||||
|
||||
export const SYSTEM_PROMPT = async (
|
||||
cwd: string,
|
||||
supportsComputerUse: boolean,
|
||||
mcpSettingsPath: string,
|
||||
mcpServers: McpServer[] = [],
|
||||
mcpHub: McpHub,
|
||||
) => `You are Cline, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
|
||||
|
||||
====
|
||||
@@ -295,8 +295,9 @@ When a server is connected, you can:
|
||||
# Connected MCP Servers
|
||||
|
||||
${
|
||||
mcpServers.length > 0
|
||||
? `${mcpServers
|
||||
mcpHub.getServers().length > 0
|
||||
? `${mcpHub
|
||||
.getServers()
|
||||
.filter((server) => server.status === "connected")
|
||||
.map((server) => {
|
||||
const tools =
|
||||
@@ -354,6 +355,8 @@ The user may ask you something along the lines of "add a tool" that does some fu
|
||||
|
||||
When creating MCP servers, it's important to understand that they operate in a non-interactive environment. The server cannot initiate OAuth flows, open browser windows, or prompt for user input during runtime. All credentials and authentication tokens must be provided upfront through environment variables in the MCP settings configuration. For example, Spotify's API uses OAuth to get a refresh token for the user, but the MCP server cannot initiate this flow. While you can walk the user through obtaining an application client ID and secret, you may have to create a separate one-time setup script (like get-refresh-token.js) that captures and logs the final piece of the puzzle: the user's refresh token (i.e. you might run the script using execute_command which would open a browser for authentication, and then log the refresh token so that you can see it in the command output for you to use in the MCP settings configuration).
|
||||
|
||||
Unless the user specifies otherwise, new MCP servers should be created in: ${mcpHub.getMcpServersPath()}
|
||||
|
||||
### Example MCP Server
|
||||
|
||||
For example, if the user wanted to give you the ability to retrieve weather information, you could create an MCP server that uses the OpenWeather API to get weather information, add it to the MCP settings configuration file, and then notice that you now have access to new tools and resources in the system prompt that you might use to show the user your new abilities.
|
||||
@@ -663,7 +666,7 @@ npm run build
|
||||
|
||||
4. Whenever you need an environment variable such as an API key to configure the MCP server, walk the user through the process of getting the key. For example they may need to create an account and go to a developer dashboard to generate the key. Provide step by step instructions and markdown formatted links to make it easy for the user to retrieve the necessary information. Then use the ask_followup_question tool to ask the user for the key, in this case the OpenWeather API key.
|
||||
|
||||
5. Install the MCP Server by adding the MCP server configuration to the settings file located at '${mcpSettingsPath}'. The settings file may have other MCP servers already configured, so you would read it first and then add your new server to the existing \`mcpServers\` object.
|
||||
5. Install the MCP Server by adding the MCP server configuration to the settings file located at '${mcpHub.getMcpSettingsFilePath()}'. The settings file may have other MCP servers already configured, so you would read it first and then add your new server to the existing \`mcpServers\` object.
|
||||
|
||||
\`\`\`json
|
||||
{
|
||||
@@ -750,7 +753,12 @@ async with httpx.AsyncClient() as client:
|
||||
|
||||
## Editing MCP Servers
|
||||
|
||||
The user may ask to add tools or resources to an existing MCP server (listed under 'Connected MCP Servers' above: ${mcpServers.map((server) => server.name).join(", ") || "(None running currently)"}), or may more generally ask to add functionality that may make sense to add to an existing local MCP server rather than creating a new one. This would be possible if you can locate the MCP server repository on the user's system by looking at the server arguments for a filepath.
|
||||
The user may ask to add tools or resources to an existing MCP server (listed under 'Connected MCP Servers' above: ${
|
||||
mcpHub
|
||||
.getServers()
|
||||
.map((server) => server.name)
|
||||
.join(", ") || "(None running currently)"
|
||||
}), or may more generally ask to add functionality that may make sense to add to an existing local MCP server rather than creating a new one. This would be possible if you can locate the MCP server repository on the user's system by looking at the server arguments for a filepath.
|
||||
|
||||
If you edit a Connected MCP server, you will need to guide the user to restart the server manually for any changes to take effect. They would need to:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user