feat: modify env interface with Symbol #2
Merged
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 pull request introduces a significant refactor to the handling of environment variables and improves testing for MCP (Model Context Protocol) connections and server interactions. The main changes include replacing the
env
andenvMapper
properties with a unifiedexternalEnv
property, adding support for required and optional environment variables, and enhancing test coverage with mock implementations and additional assertions.Refactor of Environment Variable Handling:
env
andenvMapper
withexternalEnv
inconnectMcp
and related functions to streamline environment variable management (src/cli.ts
,src/index.ts
,src/mcp.ts
). [1] [2] [3] [4] [5]RequiredEnv
andOptionalEnv
symbols to differentiate between mandatory and optional environment variables inStdioMcpConnection
(src/mcp.ts
).extractEnvFromName
to handle required and optional environment variables, logging warnings for missing required variables (src/mcp.ts
).Test Enhancements:
StdioClientTransport
and improved test coverage forconnectMcp
, including handling of required/optional environment variables and multiple MCP servers (src/mcp.test.ts
). [1] [2] [3]createServer
tests to include cleanup of resources (e.g., closing clients and servers) and added tests for tool listing and tool call requests (src/server.test.ts
). [1] [2] [3]