@@ -34,7 +34,7 @@ func TestMCPHTTP_E2E_ClientIntegration(t *testing.T) {
34
34
_ = coderdtest .CreateFirstUser (t ,coderClient )
35
35
36
36
// Create MCP client pointing to our endpoint
37
- mcpURL := api .AccessURL .String ()+ "/api/experimental/mcp/http"
37
+ mcpURL := api .AccessURL .String ()+ mcpserver . MCPEndpoint
38
38
39
39
// Configure client with authentication headers using RFC 6750 Bearer token
40
40
mcpClient ,err := mcpclient .NewStreamableHttpClient (mcpURL ,
@@ -133,7 +133,7 @@ func TestMCPHTTP_E2E_UnauthenticatedAccess(t *testing.T) {
133
133
defer cancel ()
134
134
135
135
// Test direct HTTP request to verify 401 status code
136
- mcpURL := api .AccessURL .String ()+ "/api/experimental/mcp/http"
136
+ mcpURL := api .AccessURL .String ()+ mcpserver . MCPEndpoint
137
137
138
138
// Make a POST request without authentication (MCP over HTTP uses POST)
139
139
//nolint:gosec // Test code using controlled localhost URL
@@ -197,7 +197,7 @@ func TestMCPHTTP_E2E_ToolWithWorkspace(t *testing.T) {
197
197
workspace := coderdtest .CreateWorkspace (t ,coderClient ,template .ID )
198
198
199
199
// Create MCP client
200
- mcpURL := api .AccessURL .String ()+ "/api/experimental/mcp/http"
200
+ mcpURL := api .AccessURL .String ()+ mcpserver . MCPEndpoint
201
201
mcpClient ,err := mcpclient .NewStreamableHttpClient (mcpURL ,
202
202
transport .WithHTTPHeaders (map [string ]string {
203
203
"Authorization" :"Bearer " + coderClient .SessionToken (),
@@ -280,7 +280,7 @@ func TestMCPHTTP_E2E_ErrorHandling(t *testing.T) {
280
280
_ = coderdtest .CreateFirstUser (t ,coderClient )
281
281
282
282
// Create MCP client
283
- mcpURL := api .AccessURL .String ()+ "/api/experimental/mcp/http"
283
+ mcpURL := api .AccessURL .String ()+ mcpserver . MCPEndpoint
284
284
mcpClient ,err := mcpclient .NewStreamableHttpClient (mcpURL ,
285
285
transport .WithHTTPHeaders (map [string ]string {
286
286
"Authorization" :"Bearer " + coderClient .SessionToken (),
@@ -339,7 +339,7 @@ func TestMCPHTTP_E2E_ConcurrentRequests(t *testing.T) {
339
339
_ = coderdtest .CreateFirstUser (t ,coderClient )
340
340
341
341
// Create MCP client
342
- mcpURL := api .AccessURL .String ()+ "/api/experimental/mcp/http"
342
+ mcpURL := api .AccessURL .String ()+ mcpserver . MCPEndpoint
343
343
mcpClient ,err := mcpclient .NewStreamableHttpClient (mcpURL ,
344
344
transport .WithHTTPHeaders (map [string ]string {
345
345
"Authorization" :"Bearer " + coderClient .SessionToken (),
@@ -410,7 +410,7 @@ func TestMCPHTTP_E2E_RFC6750_UnauthenticatedRequest(t *testing.T) {
410
410
// Make a request without any authentication headers
411
411
req := & http.Request {
412
412
Method :"POST" ,
413
- URL :mustParseURL (t ,api .AccessURL .String ()+ "/api/experimental/mcp/http" ),
413
+ URL :mustParseURL (t ,api .AccessURL .String ()+ mcpserver . MCPEndpoint ),
414
414
Header :make (http.Header ),
415
415
}
416
416
@@ -493,7 +493,7 @@ func TestMCPHTTP_E2E_OAuth2_EndToEnd(t *testing.T) {
493
493
// In a real OAuth2 flow, this would be an OAuth2 access token
494
494
sessionToken := coderClient .SessionToken ()
495
495
496
- mcpURL := api .AccessURL .String ()+ "/api/experimental/mcp/http"
496
+ mcpURL := api .AccessURL .String ()+ mcpserver . MCPEndpoint
497
497
mcpClient ,err := mcpclient .NewStreamableHttpClient (mcpURL ,
498
498
transport .WithHTTPHeaders (map [string ]string {
499
499
"Authorization" :"Bearer " + sessionToken ,
@@ -640,7 +640,7 @@ func TestMCPHTTP_E2E_OAuth2_EndToEnd(t *testing.T) {
640
640
t .Logf ("Successfully obtained refresh token: %s..." ,refreshToken [:10 ])
641
641
642
642
// Step 3: Use access token to authenticate with MCP endpoint
643
- mcpURL := api .AccessURL .String ()+ "/api/experimental/mcp/http"
643
+ mcpURL := api .AccessURL .String ()+ mcpserver . MCPEndpoint
644
644
mcpClient ,err := mcpclient .NewStreamableHttpClient (mcpURL ,
645
645
transport .WithHTTPHeaders (map [string ]string {
646
646
"Authorization" :"Bearer " + accessToken ,
@@ -776,7 +776,7 @@ func TestMCPHTTP_E2E_OAuth2_EndToEnd(t *testing.T) {
776
776
t .Parallel ()
777
777
req := & http.Request {
778
778
Method :"POST" ,
779
- URL :mustParseURL (t ,api .AccessURL .String ()+ "/api/experimental/mcp/http" ),
779
+ URL :mustParseURL (t ,api .AccessURL .String ()+ mcpserver . MCPEndpoint ),
780
780
Header :map [string ][]string {
781
781
"Authorization" : {"Bearer invalid_token_value" },
782
782
"Content-Type" : {"application/json" },
@@ -805,7 +805,7 @@ func TestMCPHTTP_E2E_OAuth2_EndToEnd(t *testing.T) {
805
805
t .Run ("DynamicClientRegistrationWithMCPFlow" ,func (t * testing.T ) {
806
806
t .Parallel ()
807
807
// Step 1: Attempt unauthenticated MCP access
808
- mcpURL := api .AccessURL .String ()+ "/api/experimental/mcp/http"
808
+ mcpURL := api .AccessURL .String ()+ mcpserver . MCPEndpoint
809
809
req := & http.Request {
810
810
Method :"POST" ,
811
811
URL :mustParseURL (t ,mcpURL ),
@@ -1232,7 +1232,7 @@ func TestMCPHTTP_E2E_ChatGPTEndpoint(t *testing.T) {
1232
1232
template := coderdtest .CreateTemplate (t ,coderClient ,user .OrganizationID ,version .ID )
1233
1233
1234
1234
// Create MCP client pointing to the ChatGPT endpoint
1235
- mcpURL := api .AccessURL .String ()+ "/api/experimental/mcp/http ?toolset=chatgpt"
1235
+ mcpURL := api .AccessURL .String ()+ mcpserver . MCPEndpoint + " ?toolset=chatgpt"
1236
1236
1237
1237
// Configure client with authentication headers using RFC 6750 Bearer token
1238
1238
mcpClient ,err := mcpclient .NewStreamableHttpClient (mcpURL ,