@@ -5,6 +5,7 @@ package e2e_test
55import (
66 "context"
77 "encoding/json"
8+ "fmt"
89 "os"
910 "os/exec"
1011 "slices"
@@ -88,20 +89,14 @@ func setupMCPClient(t *testing.T, options ...ClientOption) *mcpClient.Client {
8889 option (opts )
8990 }
9091
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-
9792 // Prepare Docker arguments
9893 args := []string {
9994 "docker" ,
10095 "run" ,
10196 "-i" ,
10297 "--rm" ,
10398 "-e" ,
104- "GITHUB_PERSONAL_ACCESS_TOKEN" ,
99+ "GITHUB_PERSONAL_ACCESS_TOKEN" , // Personal access token is all required
105100 }
106101
107102 // Add all environment variables to the Docker arguments
@@ -112,9 +107,16 @@ func setupMCPClient(t *testing.T, options ...ClientOption) *mcpClient.Client {
112107 // Add the image name
113108 args = append (args , "github/e2e-github-mcp-server" )
114109
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+
115117 // Create the client
116118 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 :]... )
118120 require .NoError (t , err , "expected to create client successfully" )
119121 t .Cleanup (func () {
120122 require .NoError (t , client .Close (), "expected to close client successfully" )
@@ -139,6 +141,8 @@ func setupMCPClient(t *testing.T, options ...ClientOption) *mcpClient.Client {
139141}
140142
141143func TestGetMe (t * testing.T ) {
144+ t .Parallel ()
145+
142146 mcpClient := setupMCPClient (t )
143147
144148 ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
@@ -173,6 +177,8 @@ func TestGetMe(t *testing.T) {
173177}
174178
175179func TestToolsets (t * testing.T ) {
180+ t .Parallel ()
181+
176182 mcpClient := setupMCPClient (
177183 t ,
178184 WithEnvVars (map [string ]string {
0 commit comments