Skip to content

Commit 729c0db

Browse files
committed
More YAML tests
1 parent a707aeb commit 729c0db

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

tests/client/config/mcp.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ mcpServers:
55
time:
66
command: uvx mcp-server-time
77

8+
filesystem:
9+
command: npx -y @modelcontextprotocol/server-filesystem /Users/username/Desktop /path/to/other/allowed/dir
10+
811
# Stdio server with full command string
912
# The library will automatically parse this.
1013
# The effective_command will be "python" and effective_args will be ["-m", "my_server"]
@@ -40,12 +43,6 @@ mcpServers:
4043
args:
4144
- --debug # Will be appended to parsed args: ["-m", "my_server", "--debug"]
4245

43-
# Streamable HTTP server with headers
44-
streamable_http_server_with_headers:
45-
url: https://api.example.com/mcp
46-
headers:
47-
Authorization: Bearer token123
48-
4946
# Servers with explicit types - these demonstrate that type inference
5047
# can be overridden by explicitly specifying the "type" field
5148

tests/client/config/test_yaml_functionality.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_use_pyyaml_parameter_with_json_file():
4848
assert list(config.servers.keys()) == list(config_json.servers.keys())
4949

5050

51-
def test_time_server(mcp_yaml_config_file: Path):
51+
def test_uvx_time_server(mcp_yaml_config_file: Path):
5252
"""Test the time server configuration with uvx command."""
5353
config = MCPServersConfig.from_file(mcp_yaml_config_file)
5454

@@ -81,3 +81,29 @@ def test_streamable_http_server(mcp_yaml_config_file: Path):
8181
assert http_server.type == "streamable_http" # Should be auto-inferred
8282
assert http_server.url == "https://api.example.com/mcp"
8383
assert http_server.headers is None # No headers specified
84+
85+
86+
def test_npx_filesystem_server(mcp_yaml_config_file: Path):
87+
"""Test the filesystem server configuration with full command string and multiple arguments."""
88+
config = MCPServersConfig.from_file(mcp_yaml_config_file)
89+
90+
# Should have the filesystem server
91+
assert "filesystem" in config.servers
92+
93+
# Verify the server configuration
94+
filesystem_server = config.servers["filesystem"]
95+
assert isinstance(filesystem_server, StdioServerConfig)
96+
assert filesystem_server.type == "stdio" # Should be auto-inferred from command field
97+
assert filesystem_server.command == "npx -y @modelcontextprotocol/server-filesystem /Users/username/Desktop /path/to/other/allowed/dir"
98+
assert filesystem_server.args is None # No explicit args
99+
assert filesystem_server.env is None # No environment variables
100+
101+
# Test the effective command parsing
102+
assert filesystem_server.effective_command == "npx"
103+
expected_args = [
104+
"-y",
105+
"@modelcontextprotocol/server-filesystem",
106+
"/Users/username/Desktop",
107+
"/path/to/other/allowed/dir"
108+
]
109+
assert filesystem_server.effective_args == expected_args

0 commit comments

Comments
 (0)