Skip to content

Commit 8cdbf6c

Browse files
committed
refactor(server-edition): rename Teams → Server edition
Reconcile the multi-user code/config to the product's "Server edition" naming (editions are Server and Personal; "Teams" was the legacy name). - Go identifiers: TeamsConfig→ServerEditionConfig, TeamsOAuthConfig, TeamsAuthMiddleware, TeamsStatusInfo/Info, and locals → ServerEdition*. - Package: internal/teams/ → internal/serveredition/ (git-mv, history preserved); package teams → serveredition; import paths/aliases updated. - Config key: "teams" → "server_edition" with a backward-compat alias — the legacy key is normalized on read (Config.UnmarshalJSON) so existing deployments keep working; SaveConfig always writes the new key. New key wins when both are present. - Docs/comments/strings: Teams → Server edition (CLAUDE.md, settings-page). - Unchanged by design: the //go:build server tag and the server/personal edition strings (binary identity). Tested: builds (personal + server), config alias unit tests (both editions), full serveredition suite -race, API E2E 65/65, linter clean. Related MCP-1085
1 parent 6c6736c commit 8cdbf6c

70 files changed

Lines changed: 502 additions & 371 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CLAUDE.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ MCPProxy is built in two editions from the same codebase using Go build tags:
4444
| Directory | Purpose |
4545
|-----------|---------|
4646
| `cmd/mcpproxy/edition.go` | Default edition = "personal" |
47-
| `cmd/mcpproxy/edition_teams.go` | Build-tagged override for server edition |
48-
| `cmd/mcpproxy/teams_register.go` | Server feature registration entry point |
49-
| `internal/teams/` | Server-only code (all files have `//go:build server`) |
50-
| `internal/teams/auth/` | OAuth authentication, session management, JWT tokens, middleware |
51-
| `internal/teams/users/` | User/session models, BBolt store, user server management |
52-
| `internal/teams/workspace/` | Per-user workspace manager for personal upstream servers |
53-
| `internal/teams/multiuser/` | Multi-user router, tool filtering, activity isolation |
54-
| `internal/teams/api/` | Server REST API endpoints (user, admin, auth) |
47+
| `cmd/mcpproxy/edition_server.go` | Build-tagged override for server edition |
48+
| `cmd/mcpproxy/server_edition_register.go` | Server feature registration entry point |
49+
| `internal/serveredition/` | Server-only code (all files have `//go:build server`) |
50+
| `internal/serveredition/auth/` | OAuth authentication, session management, JWT tokens, middleware |
51+
| `internal/serveredition/users/` | User/session models, BBolt store, user server management |
52+
| `internal/serveredition/workspace/` | Per-user workspace manager for personal upstream servers |
53+
| `internal/serveredition/multiuser/` | Multi-user router, tool filtering, activity isolation |
54+
| `internal/serveredition/api/` | Server REST API endpoints (user, admin, auth) |
5555
| `native/macos/MCPProxy/` | Swift macOS tray app (SwiftUI, macOS 13+) |
5656
| `native/macos/MCPProxyUITest/` | Swift MCP server for UI testing (accessibility + screenshots) |
5757
| `native/windows/` | Future C# tray app (placeholder) |
@@ -68,9 +68,11 @@ Server edition supports OAuth-based multi-user authentication with Google, GitHu
6868

6969
### Server Configuration
7070

71+
The config key is `server_edition` (the legacy `teams` key is still accepted on read and auto-migrated to `server_edition` on next save).
72+
7173
```json
7274
{
73-
"teams": {
75+
"server_edition": {
7476
"enabled": true,
7577
"admin_emails": ["admin@company.com"],
7678
"oauth": {
@@ -117,7 +119,7 @@ Server edition supports OAuth-based multi-user authentication with Google, GitHu
117119
### Server Testing
118120

119121
```bash
120-
go test -tags server ./internal/teams/... -v -race # All server unit + integration tests
122+
go test -tags server ./internal/serveredition/... -v -race # All server unit + integration tests
121123
go build -tags server ./cmd/mcpproxy # Build server edition
122124
go build ./cmd/mcpproxy # Verify personal edition unaffected
123125
```
@@ -731,15 +733,12 @@ See `docs/prerelease-builds.md` for download instructions.
731733
- Go 1.24 (toolchain go1.24.10) (001-update-version-display)
732734
- In-memory only for version cache (no persistence per clarification) (001-update-version-display)
733735
- Go 1.24 (toolchain go1.24.10) + Cobra CLI framework, encoding/json, gopkg.in/yaml.v3 (014-cli-output-formatting)
734-
- N/A (CLI output only) (014-cli-output-formatting)
735736
- Go 1.24 (toolchain go1.24.10) + BBolt (storage), Chi router (HTTP), Zap (logging), existing event bus (016-activity-log-backend)
736737
- BBolt database (existing `~/.mcpproxy/config.db`) (016-activity-log-backend)
737738
- Go 1.24 (toolchain go1.24.10) + Cobra CLI framework, encoding/json, internal/cli/output (spec 014), internal/cliclien (017-activity-cli-commands)
738-
- N/A (CLI layer only - uses REST API from spec 016) (017-activity-cli-commands)
739739
- Go 1.24 (toolchain go1.24.10) + Cobra CLI, Chi router, BBolt (storage), Zap (logging), mark3labs/mcp-go (MCP protocol) (018-intent-declaration)
740740
- BBolt database (`~/.mcpproxy/config.db`) - ActivityRecord extended with intent metadata (018-intent-declaration)
741741
- TypeScript 5.9, Vue 3.5, Go 1.24 (backend already exists) + Vue 3, Vue Router 4, Pinia 2, Tailwind CSS 3, DaisyUI 4, Vite 5 (019-activity-webui)
742-
- N/A (frontend consumes REST API from backend) (019-activity-webui)
743742
- Go 1.24 (toolchain go1.24.10) + Cobra (CLI), Chi router (HTTP), Zap (logging), mark3labs/mcp-go (MCP protocol) (020-oauth-login-feedback)
744743
- Go 1.24 (toolchain go1.24.10) + Cobra (CLI), Chi router (HTTP), Zap (logging), google/uuid (ID generation) (021-request-id-logging)
745744
- BBolt database (`~/.mcpproxy/config.db`) - activity log extended with request_id field (021-request-id-logging)
@@ -756,7 +755,6 @@ See `docs/prerelease-builds.md` for download instructions.
756755
- Go 1.24 (toolchain go1.24.10) + TypeScript 5.9 / Vue 3.5 + Chi router, BBolt, Zap logging, mcp-go, golang-jwt/jwt/v5, Vue 3, Pinia, DaisyUI (024-teams-multiuser-oauth)
757756
- BBolt database (`~/.mcpproxy/config.db`) - new buckets for users, sessions, user servers (024-teams-multiuser-oauth)
758757
- Go 1.24 (toolchain go1.24.10) + `github.com/dop251/goja` (existing JS sandbox), `github.com/evanw/esbuild` (new - TypeScript transpilation), `github.com/mark3labs/mcp-go` (MCP protocol), `github.com/spf13/cobra` (CLI) (033-typescript-code-execution)
759-
- N/A (no new storage requirements) (033-typescript-code-execution)
760758
- Swift 5.9+ / Xcode 15+ + SwiftUI, AppKit (escape hatches), Sparkle 2.x (SPM), Foundation (URLSession, Process, UNUserNotificationCenter) (037-macos-swift-tray)
761759
- N/A (tray reads all state from core via REST API — no local persistence per Constitution III) (037-macos-swift-tray)
762760
- Go 1.24 (toolchain go1.24.10) — primary; Swift 5.9 — macOS tray header change only + `github.com/google/uuid` (existing), `github.com/go-chi/chi/v5` (existing, for `RoutePattern()`), `github.com/spf13/cobra` (existing, new subcommand), `go.uber.org/zap` (existing), stdlib `sync/atomic`, `sync`, `os` (042-telemetry-tier2)

cmd/mcpproxy/edition.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package main
22

33
// Edition identifies which MCPProxy edition this binary is.
4-
// This is the default value; teams edition overrides it via build tags.
4+
// This is the default value; server edition overrides it via build tags.
55
var Edition = "personal"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//go:build server
2+
3+
package main
4+
5+
// Server edition features are registered via init() functions in their
6+
// respective packages. The actual setup happens when the server calls
7+
// serveredition.SetupAll() during HTTP server initialization (see internal/server/server_edition_wire.go).
8+
//
9+
// This file imports the serveredition package for its init() side effects,
10+
// which register feature modules in the server registry.
11+
import _ "github.com/smart-mcp-proxy/mcpproxy-go/internal/serveredition"

cmd/mcpproxy/status_cmd.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@ import (
2121

2222
// StatusInfo holds the collected status data for display.
2323
type StatusInfo struct {
24-
State string `json:"state"`
25-
Edition string `json:"edition"`
26-
ListenAddr string `json:"listen_addr"`
27-
Uptime string `json:"uptime,omitempty"`
28-
UptimeSeconds float64 `json:"uptime_seconds,omitempty"`
29-
APIKey string `json:"api_key"`
30-
WebUIURL string `json:"web_ui_url"`
31-
RoutingMode string `json:"routing_mode"`
32-
Endpoints map[string]string `json:"endpoints"`
33-
Servers *ServerCounts `json:"servers,omitempty"`
34-
SocketPath string `json:"socket_path,omitempty"`
35-
ConfigPath string `json:"config_path,omitempty"`
36-
Version string `json:"version,omitempty"`
37-
TeamsInfo *TeamsStatusInfo `json:"teams,omitempty"`
24+
State string `json:"state"`
25+
Edition string `json:"edition"`
26+
ListenAddr string `json:"listen_addr"`
27+
Uptime string `json:"uptime,omitempty"`
28+
UptimeSeconds float64 `json:"uptime_seconds,omitempty"`
29+
APIKey string `json:"api_key"`
30+
WebUIURL string `json:"web_ui_url"`
31+
RoutingMode string `json:"routing_mode"`
32+
Endpoints map[string]string `json:"endpoints"`
33+
Servers *ServerCounts `json:"servers,omitempty"`
34+
SocketPath string `json:"socket_path,omitempty"`
35+
ConfigPath string `json:"config_path,omitempty"`
36+
Version string `json:"version,omitempty"`
37+
ServerEditionInfo *ServerEditionStatusInfo `json:"server_edition,omitempty"`
3838
}
3939

40-
// TeamsStatusInfo holds teams-specific status information.
41-
type TeamsStatusInfo struct {
40+
// ServerEditionStatusInfo holds server-edition-specific status information.
41+
type ServerEditionStatusInfo struct {
4242
OAuthProvider string `json:"oauth_provider"`
4343
AdminEmails []string `json:"admin_emails"`
4444
}
@@ -173,8 +173,8 @@ func collectStatusFromDaemon(cfg *config.Config, socketPath, configPath string)
173173
info.RoutingMode = config.RoutingModeRetrieveTools
174174
}
175175

176-
// Add teams info if available
177-
info.TeamsInfo = collectTeamsInfo(cfg)
176+
// Add server-edition info if available
177+
info.ServerEditionInfo = collectServerEditionInfo(cfg)
178178

179179
// Get status data (running, listen_addr, upstream_stats)
180180
statusData, err := client.GetStatus(ctx)
@@ -247,7 +247,7 @@ func collectStatusFromConfig(cfg *config.Config, socketPath, configPath string)
247247
ConfigPath: configPath,
248248
}
249249

250-
info.TeamsInfo = collectTeamsInfo(cfg)
250+
info.ServerEditionInfo = collectServerEditionInfo(cfg)
251251

252252
return info
253253
}
@@ -416,11 +416,11 @@ func printStatusTable(info *StatusInfo) {
416416
}
417417
}
418418

419-
if info.TeamsInfo != nil {
419+
if info.ServerEditionInfo != nil {
420420
fmt.Println()
421421
fmt.Println("Server Edition")
422-
fmt.Printf(" %-12s %s\n", "OAuth:", info.TeamsInfo.OAuthProvider)
423-
fmt.Printf(" %-12s %s\n", "Admins:", strings.Join(info.TeamsInfo.AdminEmails, ", "))
422+
fmt.Printf(" %-12s %s\n", "OAuth:", info.ServerEditionInfo.OAuthProvider)
423+
fmt.Printf(" %-12s %s\n", "Admins:", strings.Join(info.ServerEditionInfo.AdminEmails, ", "))
424424
}
425425
}
426426

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//go:build server
2+
3+
package main
4+
5+
import "github.com/smart-mcp-proxy/mcpproxy-go/internal/config"
6+
7+
func collectServerEditionInfo(cfg *config.Config) *ServerEditionStatusInfo {
8+
if cfg.ServerEdition == nil || !cfg.ServerEdition.Enabled {
9+
return nil
10+
}
11+
info := &ServerEditionStatusInfo{
12+
AdminEmails: cfg.ServerEdition.AdminEmails,
13+
}
14+
if cfg.ServerEdition.OAuth != nil {
15+
info.OAuthProvider = cfg.ServerEdition.OAuth.Provider
16+
}
17+
return info
18+
}

cmd/mcpproxy/status_teams_stub.go renamed to cmd/mcpproxy/status_server_edition_stub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ package main
44

55
import "github.com/smart-mcp-proxy/mcpproxy-go/internal/config"
66

7-
func collectTeamsInfo(_ *config.Config) *TeamsStatusInfo {
7+
func collectServerEditionInfo(_ *config.Config) *ServerEditionStatusInfo {
88
return nil
99
}

cmd/mcpproxy/status_teams.go

Lines changed: 0 additions & 18 deletions
This file was deleted.

cmd/mcpproxy/teams_register.go

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/features/settings-page.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ friendly, prioritized form sections instead of raw JSON:
1212
isolation, sensitive-data detection, output validation, output sanitisation,
1313
activity retention, logging, TLS, …).
1414
- **Raw JSON** — the full Monaco editor, kept as an escape hatch.
15-
- **Teams** — server edition only.
15+
- **Server edition**multi-user settings (server build only).
1616

1717
## How saving works
1818

0 commit comments

Comments
 (0)