Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: addaibridgedserver pkg#19902

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dannykopping merged 5 commits intomainfromdk/aibridgedserver
Sep 25, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletionsMakefile
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -641,7 +641,7 @@ GEN_FILES := \
provisionersdk/proto/provisioner.pb.go \
provisionerd/proto/provisionerd.pb.go \
vpn/vpn.pb.go \
aibridged/proto/aibridged.pb.go \
enterprise/x/aibridged/proto/aibridged.pb.go \
$(DB_GEN_FILES) \
$(SITE_GEN_FILES) \
coderd/rbac/object_gen.go \
Expand DownExpand Up@@ -690,7 +690,7 @@ gen/mark-fresh:
provisionersdk/proto/provisioner.pb.go \
provisionerd/proto/provisionerd.pb.go \
vpn/vpn.pb.go \
aibridged/proto/aibridged.pb.go \
enterprise/x/aibridged/proto/aibridged.pb.go \
coderd/database/dump.sql \
$(DB_GEN_FILES) \
site/src/api/typesGenerated.ts \
Expand DownExpand Up@@ -810,13 +810,13 @@ vpn/vpn.pb.go: vpn/vpn.proto
--go_opt=paths=source_relative \
./vpn/vpn.proto

aibridged/proto/aibridged.pb.go: aibridged/proto/aibridged.proto
enterprise/x/aibridged/proto/aibridged.pb.go:enterprise/x/aibridged/proto/aibridged.proto
protoc \
--go_out=. \
--go_opt=paths=source_relative \
--go-drpc_out=. \
--go-drpc_opt=paths=source_relative \
./aibridged/proto/aibridged.proto
./enterprise/x/aibridged/proto/aibridged.proto

site/src/api/typesGenerated.ts: site/node_modules/.installed $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
# -C sets the directory for the go run command
Expand Down
3 changes: 2 additions & 1 deletioncoderd/database/dump.sql
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
ALTER TABLE aibridge_interceptions DROP COLUMN metadata;
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
ALTER TABLE aibridge_interceptions ADD COLUMN metadata JSONB DEFAULT NULL;
9 changes: 5 additions & 4 deletionscoderd/database/models.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

22 changes: 13 additions & 9 deletionscoderd/database/queries.sql.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

4 changes: 2 additions & 2 deletionscoderd/database/queries/aibridge.sql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
-- name: InsertAIBridgeInterception :one
INSERT INTO aibridge_interceptions (id, initiator_id, provider, model, started_at)
VALUES (@id::uuid, @initiator_id::uuid, @provider, @model, @started_at)
INSERT INTO aibridge_interceptions (id, initiator_id, provider, model,metadata,started_at)
VALUES (@id::uuid, @initiator_id::uuid, @provider, @model,COALESCE(@metadata::jsonb, '{}'::jsonb),@started_at)
RETURNING *;

-- name: InsertAIBridgeTokenUsage :exec
Expand Down
3 changes: 3 additions & 0 deletionscoderd/mcp/mcp.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,6 +24,9 @@ const (
MCPServerName = "Coder"
// MCPServerInstructions is the instructions text for the MCP server.
MCPServerInstructions = "Coder MCP Server providing workspace and template management tools"

// Used in tests and aibridge.
MCPEndpoint = "/api/experimental/mcp/http"
)

// Server represents an MCP HTTP server instance
Expand Down
22 changes: 11 additions & 11 deletionscoderd/mcp/mcp_e2e_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,7 +34,7 @@ func TestMCPHTTP_E2E_ClientIntegration(t *testing.T) {
_ = coderdtest.CreateFirstUser(t, coderClient)

// Create MCP client pointing to our endpoint
mcpURL := api.AccessURL.String() +"/api/experimental/mcp/http"
mcpURL := api.AccessURL.String() +mcpserver.MCPEndpoint

// Configure client with authentication headers using RFC 6750 Bearer token
mcpClient, err := mcpclient.NewStreamableHttpClient(mcpURL,
Expand DownExpand Up@@ -133,7 +133,7 @@ func TestMCPHTTP_E2E_UnauthenticatedAccess(t *testing.T) {
defer cancel()

// Test direct HTTP request to verify 401 status code
mcpURL := api.AccessURL.String() +"/api/experimental/mcp/http"
mcpURL := api.AccessURL.String() +mcpserver.MCPEndpoint

// Make a POST request without authentication (MCP over HTTP uses POST)
//nolint:gosec // Test code using controlled localhost URL
Expand DownExpand Up@@ -197,7 +197,7 @@ func TestMCPHTTP_E2E_ToolWithWorkspace(t *testing.T) {
workspace := coderdtest.CreateWorkspace(t, coderClient, template.ID)

// Create MCP client
mcpURL := api.AccessURL.String() +"/api/experimental/mcp/http"
mcpURL := api.AccessURL.String() +mcpserver.MCPEndpoint
mcpClient, err := mcpclient.NewStreamableHttpClient(mcpURL,
transport.WithHTTPHeaders(map[string]string{
"Authorization": "Bearer " + coderClient.SessionToken(),
Expand DownExpand Up@@ -280,7 +280,7 @@ func TestMCPHTTP_E2E_ErrorHandling(t *testing.T) {
_ = coderdtest.CreateFirstUser(t, coderClient)

// Create MCP client
mcpURL := api.AccessURL.String() +"/api/experimental/mcp/http"
mcpURL := api.AccessURL.String() +mcpserver.MCPEndpoint
mcpClient, err := mcpclient.NewStreamableHttpClient(mcpURL,
transport.WithHTTPHeaders(map[string]string{
"Authorization": "Bearer " + coderClient.SessionToken(),
Expand DownExpand Up@@ -339,7 +339,7 @@ func TestMCPHTTP_E2E_ConcurrentRequests(t *testing.T) {
_ = coderdtest.CreateFirstUser(t, coderClient)

// Create MCP client
mcpURL := api.AccessURL.String() +"/api/experimental/mcp/http"
mcpURL := api.AccessURL.String() +mcpserver.MCPEndpoint
mcpClient, err := mcpclient.NewStreamableHttpClient(mcpURL,
transport.WithHTTPHeaders(map[string]string{
"Authorization": "Bearer " + coderClient.SessionToken(),
Expand DownExpand Up@@ -410,7 +410,7 @@ func TestMCPHTTP_E2E_RFC6750_UnauthenticatedRequest(t *testing.T) {
// Make a request without any authentication headers
req := &http.Request{
Method: "POST",
URL: mustParseURL(t, api.AccessURL.String()+"/api/experimental/mcp/http"),
URL: mustParseURL(t, api.AccessURL.String()+mcpserver.MCPEndpoint),
Header: make(http.Header),
}

Expand DownExpand Up@@ -493,7 +493,7 @@ func TestMCPHTTP_E2E_OAuth2_EndToEnd(t *testing.T) {
// In a real OAuth2 flow, this would be an OAuth2 access token
sessionToken := coderClient.SessionToken()

mcpURL := api.AccessURL.String() +"/api/experimental/mcp/http"
mcpURL := api.AccessURL.String() +mcpserver.MCPEndpoint
mcpClient, err := mcpclient.NewStreamableHttpClient(mcpURL,
transport.WithHTTPHeaders(map[string]string{
"Authorization": "Bearer " + sessionToken,
Expand DownExpand Up@@ -640,7 +640,7 @@ func TestMCPHTTP_E2E_OAuth2_EndToEnd(t *testing.T) {
t.Logf("Successfully obtained refresh token: %s...", refreshToken[:10])

// Step 3: Use access token to authenticate with MCP endpoint
mcpURL := api.AccessURL.String() +"/api/experimental/mcp/http"
mcpURL := api.AccessURL.String() +mcpserver.MCPEndpoint
mcpClient, err := mcpclient.NewStreamableHttpClient(mcpURL,
transport.WithHTTPHeaders(map[string]string{
"Authorization": "Bearer " + accessToken,
Expand DownExpand Up@@ -776,7 +776,7 @@ func TestMCPHTTP_E2E_OAuth2_EndToEnd(t *testing.T) {
t.Parallel()
req := &http.Request{
Method: "POST",
URL: mustParseURL(t, api.AccessURL.String()+"/api/experimental/mcp/http"),
URL: mustParseURL(t, api.AccessURL.String()+mcpserver.MCPEndpoint),
Header: map[string][]string{
"Authorization": {"Bearer invalid_token_value"},
"Content-Type": {"application/json"},
Expand DownExpand Up@@ -805,7 +805,7 @@ func TestMCPHTTP_E2E_OAuth2_EndToEnd(t *testing.T) {
t.Run("DynamicClientRegistrationWithMCPFlow", func(t *testing.T) {
t.Parallel()
// Step 1: Attempt unauthenticated MCP access
mcpURL := api.AccessURL.String() +"/api/experimental/mcp/http"
mcpURL := api.AccessURL.String() +mcpserver.MCPEndpoint
req := &http.Request{
Method: "POST",
URL: mustParseURL(t, mcpURL),
Expand DownExpand Up@@ -1232,7 +1232,7 @@ func TestMCPHTTP_E2E_ChatGPTEndpoint(t *testing.T) {
template := coderdtest.CreateTemplate(t, coderClient, user.OrganizationID, version.ID)

// Create MCP client pointing to the ChatGPT endpoint
mcpURL := api.AccessURL.String() +"/api/experimental/mcp/http?toolset=chatgpt"
mcpURL := api.AccessURL.String() +mcpserver.MCPEndpoint + "?toolset=chatgpt"

// Configure client with authentication headers using RFC 6750 Bearer token
mcpClient, err := mcpclient.NewStreamableHttpClient(mcpURL,
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp