Skip to content

Commit

Permalink
Merge pull request #3600 from continuedev/nate/fixes123
Browse files Browse the repository at this point in the history
add env option to MCP
  • Loading branch information
sestinj authored Jan 3, 2025
2 parents 67f3488 + efd3b7b commit 170c4d4
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions core/context/mcp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class MCPConnection {
return new StdioClientTransport({
command: options.transport.command,
args: options.transport.args,
env: options.transport.env,
});
case "websocket":
return new WebSocketClientTransport(new URL(options.transport.url));
Expand Down
1 change: 1 addition & 0 deletions core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ export interface StdioOptions {
type: "stdio";
command: string;
args: string[];
env?: Record<string, string>;
}

export interface WebSocketOptions {
Expand Down
2 changes: 0 additions & 2 deletions core/indexing/docs/DocsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import TransformersJsEmbeddingsProvider from "../../llm/llms/TransformersJsEmbed
import { FromCoreProtocol, ToCoreProtocol } from "../../protocol";
import { IMessenger } from "../../protocol/messenger";
import { fetchFavicon, getFaviconBase64 } from "../../util/fetchFavicon";
import { IMessenger } from "../../protocol/messenger";
import { GlobalContext } from "../../util/GlobalContext";
import {
editConfigJson,
getDocsSqlitePath,
Expand Down
7 changes: 7 additions & 0 deletions extensions/vscode/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3151,6 +3151,13 @@
"items": {
"type": "string"
}
},
"env": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Environment variables to pass to the command"
}
},
"required": ["type", "command", "args"]
Expand Down
12 changes: 6 additions & 6 deletions gui/src/components/dialogs/AddDocsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import {
PlusIcon,
} from "@heroicons/react/24/outline";
import { IndexingStatus, PackageDocsResult, SiteIndexingConfig } from "core";
import preIndexedDocs from "core/indexing/docs/preIndexedDocs";
import { usePostHog } from "posthog-js/react";
import { useContext, useLayoutEffect, useMemo, useRef, useState } from "react";
import { useDispatch } from "react-redux";
import { Input, SecondaryButton } from "..";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import { useAppSelector } from "../../redux/hooks";
import { updateConfig } from "../../redux/slices/configSlice";
import { updateIndexingStatus } from "../../redux/slices/indexingSlice";
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
import { ToolTip } from "../gui/Tooltip";
import FileIcon from "../FileIcon";
import { ToolTip } from "../gui/Tooltip";
import DocsIndexingPeeks from "../indexing/DocsIndexingPeeks";
import preIndexedDocs from "core/indexing/docs/preIndexedDocs";
import { updateIndexingStatus } from "../../redux/slices/indexingSlice";
import { useAppSelector } from "../../redux/hooks";
import { setConfig } from "../../redux/slices/configSlice";

function AddDocsDialog() {
const config = useAppSelector((store) => store.config.config);
Expand Down Expand Up @@ -146,7 +146,7 @@ function AddDocsDialog() {

// Optimistic status update
dispatch(
setConfig({
updateConfig({
...config,
docs: [
...(config.docs?.filter(
Expand Down
14 changes: 12 additions & 2 deletions gui/src/redux/slices/configSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export const configSlice = createSlice({
state.config = config;
state.defaultModelTitle = defaultModelTitle;
},
updateConfig: (
state,
{ payload: config }: PayloadAction<BrowserSerializedContinueConfig>,
) => {
state.config = config;
},
setConfigError: (
state,
{ payload: error }: PayloadAction<ConfigValidationError[] | undefined>,
Expand Down Expand Up @@ -93,8 +99,12 @@ export const configSlice = createSlice({
},
});

export const { setDefaultModel, setConfigResult, setConfigError } =
configSlice.actions;
export const {
setDefaultModel,
updateConfig,
setConfigResult,
setConfigError,
} = configSlice.actions;

export const {
selectDefaultModel,
Expand Down

0 comments on commit 170c4d4

Please sign in to comment.