@@ -5,6 +5,7 @@ package e2e_test
5
5
import (
6
6
"context"
7
7
"encoding/json"
8
+ "fmt"
8
9
"os"
9
10
"os/exec"
10
11
"slices"
@@ -88,20 +89,14 @@ func setupMCPClient(t *testing.T, options ...ClientOption) *mcpClient.Client {
88
89
option (opts )
89
90
}
90
91
91
- // Set the GitHub token and other environment variables
92
- t .Setenv ("GITHUB_PERSONAL_ACCESS_TOKEN" , token )
93
- for key , value := range opts .EnvVars {
94
- t .Setenv (key , value )
95
- }
96
-
97
92
// Prepare Docker arguments
98
93
args := []string {
99
94
"docker" ,
100
95
"run" ,
101
96
"-i" ,
102
97
"--rm" ,
103
98
"-e" ,
104
- "GITHUB_PERSONAL_ACCESS_TOKEN" ,
99
+ "GITHUB_PERSONAL_ACCESS_TOKEN" , // Personal access token is all required
105
100
}
106
101
107
102
// Add all environment variables to the Docker arguments
@@ -112,9 +107,16 @@ func setupMCPClient(t *testing.T, options ...ClientOption) *mcpClient.Client {
112
107
// Add the image name
113
108
args = append (args , "github/e2e-github-mcp-server" )
114
109
110
+ // Construct the env vars for the MCP Client to execute docker with
111
+ dockerEnvVars := make ([]string , 0 , len (opts .EnvVars )+ 1 )
112
+ dockerEnvVars = append (dockerEnvVars , fmt .Sprintf ("GITHUB_PERSONAL_ACCESS_TOKEN=%s" , token ))
113
+ for key , value := range opts .EnvVars {
114
+ dockerEnvVars = append (dockerEnvVars , fmt .Sprintf ("%s=%s" , key , value ))
115
+ }
116
+
115
117
// Create the client
116
118
t .Log ("Starting Stdio MCP client..." )
117
- client , err := mcpClient .NewStdioMCPClient (args [0 ], [] string {} , args [1 :]... )
119
+ client , err := mcpClient .NewStdioMCPClient (args [0 ], dockerEnvVars , args [1 :]... )
118
120
require .NoError (t , err , "expected to create client successfully" )
119
121
t .Cleanup (func () {
120
122
require .NoError (t , client .Close (), "expected to close client successfully" )
@@ -139,6 +141,8 @@ func setupMCPClient(t *testing.T, options ...ClientOption) *mcpClient.Client {
139
141
}
140
142
141
143
func TestGetMe (t * testing.T ) {
144
+ t .Parallel ()
145
+
142
146
mcpClient := setupMCPClient (t )
143
147
144
148
ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
@@ -173,6 +177,8 @@ func TestGetMe(t *testing.T) {
173
177
}
174
178
175
179
func TestToolsets (t * testing.T ) {
180
+ t .Parallel ()
181
+
176
182
mcpClient := setupMCPClient (
177
183
t ,
178
184
WithEnvVars (map [string ]string {
0 commit comments