Skip to content

feat: implement MCP HTTP server endpoint with authentication #18670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance
Choose a base branch
from

Conversation

ThomasK33
Copy link
Member

@ThomasK33 ThomasK33 commented Jun 30, 2025

Add MCP HTTP server with streamable transport support

  • Add MCP HTTP server with streamable transport support
  • Integrate with existing toolsdk for Coder workspace operations
  • Add comprehensive E2E tests with OAuth2 bearer token support
  • Register MCP endpoint at /api/experimental/mcp/http with authentication
  • Support RFC 6750 Bearer token authentication for MCP clients

Change-Id: Ib9024569ae452729908797c42155006aa04330af
Signed-off-by: Thomas Kosiewski [email protected]

@ThomasK33 ThomasK33 changed the title feat(mcp): implement MCP HTTP server with toolsdk integration feat: add MCP HTTP transport endpoint with authentication Jun 30, 2025
@ThomasK33 ThomasK33 marked this pull request as ready for review June 30, 2025 16:44
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from 4efb07a to 8a3f7a9 Compare June 30, 2025 16:45
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from 4d966b2 to 4ffc58e Compare June 30, 2025 16:45
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from 8a3f7a9 to e7d56c2 Compare June 30, 2025 17:08
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from 4ffc58e to 23804bb Compare June 30, 2025 17:08
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from e7d56c2 to 10701da Compare June 30, 2025 17:56
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from 23804bb to 06d9b57 Compare June 30, 2025 17:56
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from 10701da to a2607a8 Compare July 1, 2025 09:15
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from 06d9b57 to cee654a Compare July 1, 2025 09:15
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from a2607a8 to 990f706 Compare July 1, 2025 09:27
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch 2 times, most recently from 8cb9d74 to 3e540ef Compare July 1, 2025 13:23
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from 990f706 to 95c0496 Compare July 1, 2025 13:23
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from 95c0496 to b17d907 Compare July 1, 2025 13:43
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from 3e540ef to 0447dc7 Compare July 1, 2025 13:44
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from 674964b to de6e6b1 Compare July 1, 2025 16:56
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from 858b090 to 24ae9f0 Compare July 1, 2025 16:56
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from de6e6b1 to df6f22c Compare July 1, 2025 17:04
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch 2 times, most recently from 198bc92 to ffc544b Compare July 1, 2025 17:18
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from df6f22c to 60161d7 Compare July 1, 2025 17:18
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from ffc544b to d3aaec0 Compare July 1, 2025 19:54
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch 2 times, most recently from 16a48ef to 06236c5 Compare July 1, 2025 20:14
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from d3aaec0 to 968207c Compare July 1, 2025 20:14
@@ -11642,7 +11642,73 @@ const docTemplate = `{
}
},
"codersdk.CreateTestAuditLogRequest": {
"type": "object"
"type": "object",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hhmm, curious how this is related to your changes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea, CI was complaining that make gen contained unstaged changes, and this was what it generated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to figure out why, but non-blocking.

@@ -972,6 +972,10 @@ func New(options *Options) *API {
r.Route("/aitasks", func(r chi.Router) {
r.Get("/prompts", api.aiTasksPrompts)
})
r.Route("/mcp", func(r chi.Router) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to hide this behind a flag or experiment perhaps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I added an experiment up the stack in: #18712

@@ -972,6 +972,10 @@ func New(options *Options) *API {
r.Route("/aitasks", func(r chi.Router) {
r.Get("/prompts", api.aiTasksPrompts)
})
r.Route("/mcp", func(r chi.Router) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from 968207c to dea734b Compare July 2, 2025 12:08
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from 06236c5 to 991aeb7 Compare July 2, 2025 12:08
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from 991aeb7 to 7a4b271 Compare July 2, 2025 12:25
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch 2 times, most recently from 54086ed to f8aa2de Compare July 2, 2025 12:44
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from 7a4b271 to 5496826 Compare July 2, 2025 12:44
@ThomasK33 ThomasK33 changed the title feat: add MCP HTTP transport endpoint with authentication feat: add MCP HTTP server endpoint with authentication Jul 2, 2025
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from f8aa2de to 9851f81 Compare July 2, 2025 13:58
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch 2 times, most recently from 3df9b80 to e32fba8 Compare July 2, 2025 14:06
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_oauth2_remove_unique_constraint_on_app_names_for_rfc_7591_compliance branch from 9851f81 to 43ac8a0 Compare July 2, 2025 14:06
- Add MCP HTTP server with streamable transport support
- Integrate with existing toolsdk for Coder workspace operations
- Add comprehensive E2E tests with OAuth2 bearer token support
- Register MCP endpoint at /api/experimental/mcp/http with authentication
- Support RFC 6750 Bearer token authentication for MCP clients

Change-Id: Ib9024569ae452729908797c42155006aa04330af
Signed-off-by: Thomas Kosiewski <[email protected]>
@ThomasK33 ThomasK33 force-pushed the thomask33/06-30-feat_mcp_implement_mcp_http_server_with_toolsdk_integration branch from e32fba8 to d74cf24 Compare July 2, 2025 14:14
@ThomasK33 ThomasK33 changed the title feat: add MCP HTTP server endpoint with authentication feat: implement MCP HTTP server endpoint with authentication Jul 2, 2025
Comment on lines +19 to +36
const (
ToolNameReportTask = "coder_report_task"
ToolNameGetWorkspace = "coder_get_workspace"
ToolNameCreateWorkspace = "coder_create_workspace"
ToolNameListWorkspaces = "coder_list_workspaces"
ToolNameListTemplates = "coder_list_templates"
ToolNameListTemplateVersionParams = "coder_template_version_parameters"
ToolNameGetAuthenticatedUser = "coder_get_authenticated_user"
ToolNameCreateWorkspaceBuild = "coder_create_workspace_build"
ToolNameCreateTemplateVersion = "coder_create_template_version"
ToolNameGetWorkspaceAgentLogs = "coder_get_workspace_agent_logs"
ToolNameGetWorkspaceBuildLogs = "coder_get_workspace_build_logs"
ToolNameGetTemplateVersionLogs = "coder_get_template_version_logs"
ToolNameUpdateTemplateActiveVersion = "coder_update_template_active_version"
ToolNameUploadTarFile = "coder_upload_tar_file"
ToolNameCreateTemplate = "coder_create_template"
ToolNameDeleteTemplate = "coder_delete_template"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants