This repository was archived by the owner on May 29, 2026. It is now read-only.
Add support for Claude MCP configuration files in CLI run command#1923
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Apply the changes from https://github.com/microsoft/genaiscript/pull/1922 in dev branch.
Add support for Claude MCP configuration files in CLI run command
Sep 13, 2025
Contributor
|
Warning LLM error (403): error Warning LLM error (403): error Warning LLM error (403): error
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for loading MCP (Model Context Protocol) servers from Claude format configuration files using the new
--mcp-configoption in thegenaiscript runcommand.Problem
Previously, MCP servers could only be configured directly in script files using the
mcpServersproperty. Users working with Claude Desktop who already have MCP configuration files (.vscode/mcp.jsonor similar) had to duplicate their server configurations when using GenAIScript.Solution
Added a new
--mcp-config <file>CLI option that:serversandmcpServersobject structures${workspaceFolder}- resolves to workspace directory or config file directory${env:VARIABLE_NAME}- resolves to environment variable values${VARIABLE_NAME}- resolves to capitalized environment variable valuesmcpServersdefined in the scriptgenaiscriptDebugto trace MCP server resolutionUsage
# Load MCP servers from Claude configuration file genaiscript run my-script --mcp-config .vscode/mcp.jsonExample MCP configuration file:
{ "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "${workspaceFolder}"], "env": { "DEBUG": "${env:DEBUG}", "API_KEY": "${API_KEY}" } }, "memory": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-memory"] } } }Implementation Details
packages/core/src/mcp-config.tshandles configuration parsing and variable interpolationPromptScriptRunOptionsinterface to includemcpConfigpropertyTesting
The implementation includes comprehensive testing for:
This change is backwards compatible and doesn't affect existing functionality when the
--mcp-configoption is not used.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cdn.sheetjs.comnode /home/REDACTED/.local/share/pnpm/.tools/pnpm/10.12.3/bin/pnpm install(dns block)esm.ubuntu.com/usr/lib/apt/methods/https(dns block)example.comhttps://api.github.com/markdownnode (vitest 3)(http block)https://api.github.com/repos/microsoft/genaiscript/branchesnode (vitest 3)(http block)https://api.github.com/repos/microsoft/genaiscript/contents/README.mdnode (vitest 3)(http block)https://api.github.com/repos/microsoft/genaiscript/contents/packages%2Fcore%2Fsrcnode (vitest 3)(http block)https://api.github.com/repos/microsoft/genaiscript/git/blobsnode (vitest 3)(http block)https://api.github.com/repos/microsoft/genaiscript/git/ref/heads%2Ftest-ignorenode (vitest 3)(http block)https://api.github.com/repos/microsoft/genaiscript/issuesnode (vitest 3)(http block)https://api.github.com/repos/microsoft/genaiscript/labelsnode (vitest 3)(http block)https://api.github.com/repos/microsoft/genaiscript/languagesnode (vitest 3)(http block)https://api.github.com/repos/microsoft/genaiscript/pullsnode (vitest 3)(http block)https://api.github.com/repos/microsoft/genaiscript/pulls/999999node (vitest 3)(http block)https://api.github.com/testnode (vitest 3)(http block)microsoft.github.ionode (vitest 2)(dns block)telemetry.astro.buildnode /home/REDACTED/work/genaiscript/genaiscript/docs/node_modules/.bin/../astro/astro.js build(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.