MCP settings: suggestion catalog for GitHub, HubSpot and Make
The connections list now serves a shipped catalog of well-known hosted MCP servers (data in the binary, like the entitlements catalog — never a TIER fork). 'Use' prefills name/url/transport/authKind and shows a secretHint placeholder; the credential stays the user's to paste (write-only discipline unchanged). Verified against vendor docs: GitHub (api.githubcopilot.com/mcp/) and Make (<zone>.make.com/mcp/v2) accept Bearer tokens and are connectable today. HubSpot's remote MCP (mcp.hubspot.com) requires OAuth 2.1 + PKCE with no static-token path — the client speaks none/bearer/header only, so the entry is shown honestly labeled 'OAuth required' with a note and docs link, and NO Use button. Go test asserts the catalog; browser regression covers the prefill and the HubSpot treatment.
This commit is contained in:
@@ -111,7 +111,7 @@ Bearer / custom-header auth. Stored in `McpConnection` (migration 018).
|
||||
|
||||
| Method | Path | Returns |
|
||||
|---|---|---|
|
||||
| GET | `/api/mcp/connections` | `{connections:[…]}` — secret masked `••••••••` when set, never plaintext |
|
||||
| GET | `/api/mcp/connections` | `{connections:[…],suggestions:[…]}` — secret masked `••••••••` when set, never plaintext; suggestions are the shipped catalog of well-known hosted MCP servers (GitHub, HubSpot, Make) with `available:false` marking auth the client cannot satisfy (HubSpot requires OAuth 2.1 + PKCE) |
|
||||
| POST | `/api/mcp/connections` | 201 masked projection; body `{name,url,transport,authKind,headerName?,secret?}`; secret required for bearer/header; cap 10 per user |
|
||||
| PATCH | `/api/mcp/connections/{id}` | masked projection; **requires `version`** (409 on stale); a mask or omitted `secret` keeps the stored value; switching `authKind` to `none` clears it |
|
||||
| DELETE | `/api/mcp/connections/{id}` | `{ok:true}`; 404 for another user's row |
|
||||
|
||||
@@ -59,7 +59,46 @@ func mcpProjection(row object) object {
|
||||
}
|
||||
}
|
||||
|
||||
// HandleMcpConnectionsList returns the caller's connections, masked.
|
||||
// mcpSuggestions is the product catalog of well-known hosted MCP servers
|
||||
// offered on the MCP settings tab — DATA in the shipped binary (like the
|
||||
// entitlements catalog), not deployment config and never a TIER fork.
|
||||
// "Use" prefills the connection form; the user still supplies the credential
|
||||
// and confirms. available=false marks a server whose authentication this
|
||||
// client cannot satisfy today: HubSpot's remote MCP requires OAuth 2.1 with
|
||||
// PKCE (no static-token path), while internal/mcpclient speaks none/bearer/
|
||||
// header only — the entry stays visible, honestly labeled, without a Use
|
||||
// button. URLs/auth verified against the vendors' docs 2026-11.
|
||||
var mcpSuggestions = []object{
|
||||
{
|
||||
"kind": "github", "name": "GitHub",
|
||||
"url": "https://api.githubcopilot.com/mcp/",
|
||||
"transport": "streamable-http", "authKind": "bearer", "available": true,
|
||||
"description": "Repos, issues, pull requests, code search and Actions.",
|
||||
"secretHint": "GitHub personal access token (fine-grained recommended)",
|
||||
"note": "Append /readonly to the URL for read-only tools.",
|
||||
"docsUrl": "https://github.com/github/github-mcp-server",
|
||||
},
|
||||
{
|
||||
"kind": "hubspot", "name": "HubSpot",
|
||||
"url": "https://mcp.hubspot.com",
|
||||
"transport": "streamable-http", "authKind": "bearer", "available": false,
|
||||
"description": "CRM contacts, companies, deals, tickets and activities.",
|
||||
"note": "Requires OAuth 2.1 sign-in (PKCE) — HubSpot refuses token-only connections, and Superbrain's MCP client does not do OAuth flows yet.",
|
||||
"docsUrl": "https://developers.hubspot.com/ai-tools/mcp",
|
||||
},
|
||||
{
|
||||
"kind": "make", "name": "Make",
|
||||
"url": "https://us1.make.com/mcp/v2",
|
||||
"transport": "streamable-http", "authKind": "bearer", "available": true,
|
||||
"description": "Run your Make scenarios as tools; manage scenarios and data stores.",
|
||||
"secretHint": "Make API token with the mcp:use scope (Profile → API access)",
|
||||
"note": "Swap in your account's zone: eu1, eu2, us1 or us2.make.com.",
|
||||
"docsUrl": "https://developers.make.com/mcp-server/",
|
||||
},
|
||||
}
|
||||
|
||||
// HandleMcpConnectionsList returns the caller's connections, masked, plus
|
||||
// the suggestion catalog (always an array so clients can map() blindly).
|
||||
func HandleMcpConnectionsList(w http.ResponseWriter, r *http.Request) {
|
||||
rows, e := db.Many(r.Context(), database(r),
|
||||
`SELECT to_jsonb(t) FROM "McpConnection" t WHERE "ownerId"=$1 ORDER BY "createdAt"`, user(r))
|
||||
@@ -71,7 +110,7 @@ func HandleMcpConnectionsList(w http.ResponseWriter, r *http.Request) {
|
||||
for _, row := range rows {
|
||||
out = append(out, mcpProjection(row))
|
||||
}
|
||||
respond(w, 200, object{"connections": out}, nil)
|
||||
respond(w, 200, object{"connections": out, "suggestions": mcpSuggestions}, nil)
|
||||
}
|
||||
|
||||
func cleanMcpFields(b object, create bool) (object, error) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
"net/http/cookiejar"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp"
|
||||
@@ -135,3 +136,34 @@ func TestMcpConnections(t *testing.T) {
|
||||
|
||||
// maxTestMcpConns mirrors handlers.maxMcpConns.
|
||||
const maxTestMcpConns = 10
|
||||
|
||||
// The suggestion catalog ships with the list: GitHub and Make are
|
||||
// token-connectable (bearer), HubSpot is honestly flagged unavailable
|
||||
// because its remote MCP requires OAuth 2.1 + PKCE, which the client
|
||||
// (none/bearer/header) cannot do.
|
||||
func TestMcpSuggestions(t *testing.T) {
|
||||
srv := testServer(t)
|
||||
c, _ := accountClient(t, srv.URL, "mcp-sugg@superbrain.test")
|
||||
list := c.request("GET", "/api/mcp/connections", nil, 200)
|
||||
sugg, _ := list["suggestions"].([]any)
|
||||
byKind := map[string]map[string]any{}
|
||||
for _, s := range sugg {
|
||||
m := s.(map[string]any)
|
||||
byKind[m["kind"].(string)] = m
|
||||
}
|
||||
if len(byKind) != 3 {
|
||||
t.Fatalf("want github/hubspot/make suggestions, got %v", byKind)
|
||||
}
|
||||
gh := byKind["github"]
|
||||
if gh["url"] != "https://api.githubcopilot.com/mcp/" || gh["authKind"] != "bearer" || gh["available"] != true {
|
||||
t.Fatalf("github suggestion wrong: %v", gh)
|
||||
}
|
||||
mk := byKind["make"]
|
||||
if mk["authKind"] != "bearer" || mk["available"] != true || !strings.Contains(mk["url"].(string), "make.com/mcp/v2") {
|
||||
t.Fatalf("make suggestion wrong: %v", mk)
|
||||
}
|
||||
hs := byKind["hubspot"]
|
||||
if hs["available"] != false || hs["url"] != "https://mcp.hubspot.com" {
|
||||
t.Fatalf("hubspot must be flagged OAuth-only: %v", hs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,11 @@ const carddavSuggestions = [{ kind: 'nextcloud', name: 'Nextcloud contacts', url
|
||||
// Unified Nextcloud connect fixture: mirrors handlers/nextcloud.go — the
|
||||
// origin is normalized, per-user DAV roots composed server-side, repeat
|
||||
// connects report "exists", and a wrong password stores nothing.
|
||||
const mcpSuggestions = [
|
||||
{ kind: 'github', name: 'GitHub', url: 'https://api.githubcopilot.com/mcp/', transport: 'streamable-http', authKind: 'bearer', available: true, description: 'Repos, issues, pull requests, code search and Actions.', secretHint: 'GitHub personal access token (fine-grained recommended)', note: 'Append /readonly to the URL for read-only tools.' },
|
||||
{ kind: 'hubspot', name: 'HubSpot', url: 'https://mcp.hubspot.com', transport: 'streamable-http', authKind: 'bearer', available: false, description: 'CRM contacts, companies, deals, tickets and activities.', note: 'Requires OAuth 2.1 sign-in (PKCE) — HubSpot refuses token-only connections, and Superbrain\'s MCP client does not do OAuth flows yet.' },
|
||||
{ kind: 'make', name: 'Make', url: 'https://us1.make.com/mcp/v2', transport: 'streamable-http', authKind: 'bearer', available: true, description: 'Run your Make scenarios as tools; manage scenarios and data stores.', secretHint: 'Make API token with the mcp:use scope (Profile → API access)', note: 'Swap in your account\'s zone: eu1, eu2, us1 or us2.make.com.' },
|
||||
]
|
||||
let lastNextcloudConnect = null
|
||||
// Automations fixture: the sidebar dropdown and the /automations workspace
|
||||
// exercise against the same projection handlers/agent.go returns.
|
||||
@@ -319,6 +324,8 @@ const api = http.createServer(async (req, res) => {
|
||||
results[key] = { status: 'created', id: conn.id, name: conn.name, url: u }
|
||||
}
|
||||
result = { results }
|
||||
} else if (url.pathname === '/api/mcp/connections') {
|
||||
result = { connections: [], suggestions: mcpSuggestions }
|
||||
} else if (url.pathname === '/api/agent/tasks') {
|
||||
result = agentTasks
|
||||
} else if (url.pathname === '/api/agent/runs') {
|
||||
@@ -915,6 +922,21 @@ try {
|
||||
await page.getByPlaceholder('https://cloud.example.com').waitFor()
|
||||
console.log('PASS: Automations lives in the sidebar with a task dropdown, deep-links to /automations, and the legacy settings tab redirects')
|
||||
|
||||
// Settings → MCP: the suggestion catalog offers GitHub and Make (token
|
||||
// auth) with a Use prefill; HubSpot is honestly flagged OAuth-required
|
||||
// with no Use button — the client speaks none/bearer/header only.
|
||||
await page.goto(`${base}/settings`)
|
||||
await page.getByRole('tab', { name: 'MCP' }).click()
|
||||
await page.getByText('Repos, issues, pull requests, code search and Actions.').waitFor()
|
||||
assert.equal(await page.getByRole('button', { name: 'Use', exact: true }).count(), 2, 'only token-connectable suggestions may offer Use')
|
||||
await page.getByText('OAuth required').waitFor()
|
||||
await page.getByRole('button', { name: 'Use', exact: true }).first().click()
|
||||
assert.equal(await page.getByPlaceholder('https://mcp.example.tld/mcp').inputValue(), 'https://api.githubcopilot.com/mcp/')
|
||||
assert.equal(await page.getByPlaceholder('e.g. House gateway, Maps tools…').inputValue(), 'GitHub')
|
||||
await page.getByPlaceholder('GitHub personal access token (fine-grained recommended)').waitFor()
|
||||
await page.locator('[role="dialog"]').getByRole('button', { name: 'Cancel' }).click()
|
||||
console.log('PASS: Settings → MCP offers GitHub/Make suggestions with Use prefill and flags HubSpot as OAuth-required')
|
||||
|
||||
// Mobile pass (390x844): the shell becomes a drawer, tables become cards,
|
||||
// rail screens become master-detail, and NO screen may overflow the
|
||||
// viewport horizontally. A separate context keeps the desktop session and
|
||||
|
||||
@@ -23,12 +23,16 @@ type McpConnection = {
|
||||
id: string; name: string; url: string; transport: string; authKind: string
|
||||
headerName: string; secret: string; enabled: boolean; version: number
|
||||
}
|
||||
type Suggestion = {
|
||||
kind: string; name: string; url: string; transport: string; authKind: string
|
||||
available: boolean; description?: string; secretHint?: string; note?: string; docsUrl?: string
|
||||
}
|
||||
type TestResult = { ok: boolean; count?: number; tools?: { name: string; description: string }[]; error?: string }
|
||||
|
||||
type FormState = {
|
||||
id: string | null; version: number
|
||||
name: string; url: string; transport: string; authKind: string; headerName: string
|
||||
secret: string; hasStoredSecret: boolean
|
||||
secret: string; hasStoredSecret: boolean; secretHint?: string
|
||||
}
|
||||
|
||||
const emptyForm: FormState = {
|
||||
@@ -42,6 +46,7 @@ async function api(path: string, init?: RequestInit): Promise<Response> {
|
||||
|
||||
export function McpSettings() {
|
||||
const [connections, setConnections] = useState<McpConnection[]>([])
|
||||
const [suggestions, setSuggestions] = useState<Suggestion[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [form, setForm] = useState<FormState | null>(null)
|
||||
const [saving, setSaving] = useState(false)
|
||||
@@ -51,13 +56,22 @@ export function McpSettings() {
|
||||
const reload = useCallback(() =>
|
||||
api('/api/mcp/connections')
|
||||
.then(r => r.json())
|
||||
.then(data => setConnections(Array.isArray(data?.connections) ? data.connections : []))
|
||||
.then(data => {
|
||||
setConnections(Array.isArray(data?.connections) ? data.connections : [])
|
||||
setSuggestions(Array.isArray(data?.suggestions) ? data.suggestions : [])
|
||||
})
|
||||
.catch(() => toast.error('Could not load MCP connections'))
|
||||
.finally(() => setLoading(false)), [])
|
||||
|
||||
useEffect(() => { reload() }, [reload])
|
||||
|
||||
const openCreate = () => setForm({ ...emptyForm })
|
||||
// A suggestion prefills everything except the credential — the user still
|
||||
// pastes their own token and confirms (write-only discipline unchanged).
|
||||
const openSuggestion = (s: Suggestion) => setForm({
|
||||
...emptyForm, name: s.name, url: s.url, transport: s.transport,
|
||||
authKind: s.authKind, secretHint: s.secretHint,
|
||||
})
|
||||
const openEdit = (c: McpConnection) => setForm({
|
||||
id: c.id, version: c.version, name: c.name, url: c.url, transport: c.transport,
|
||||
authKind: c.authKind, headerName: c.headerName, secret: '', hasStoredSecret: c.secret === KEY_MASK,
|
||||
@@ -140,6 +154,30 @@ export function McpSettings() {
|
||||
<Button size="sm" onClick={openCreate}><Plus className="h-4 w-4 mr-1" /> Add connection</Button>
|
||||
</div>
|
||||
|
||||
{suggestions.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
{suggestions.map(s => (
|
||||
<div key={s.kind} className="flex items-start gap-3 rounded-md border border-dashed p-3">
|
||||
<PlugZap className="mt-0.5 h-5 w-5 shrink-0 text-muted-foreground" />
|
||||
<div className="min-w-0 flex-1 space-y-0.5">
|
||||
<p className="text-sm font-medium flex items-center gap-2">
|
||||
{s.name}
|
||||
{!s.available && <Badge variant="outline" className="text-[10px] text-amber-600 dark:text-amber-400">OAuth required</Badge>}
|
||||
</p>
|
||||
{s.description && <p className="text-xs text-muted-foreground">{s.description}</p>}
|
||||
<p className="truncate text-xs text-muted-foreground font-mono">{s.url}</p>
|
||||
{s.note && <p className="text-xs text-muted-foreground">{s.note}</p>}
|
||||
</div>
|
||||
{s.available
|
||||
? <Button size="sm" variant="outline" className="shrink-0" onClick={() => openSuggestion(s)}>Use</Button>
|
||||
: s.docsUrl && (
|
||||
<a href={s.docsUrl} target="_blank" rel="noreferrer" className="shrink-0 text-xs text-muted-foreground underline hover:text-foreground">Docs</a>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{connections.length === 0 ? (
|
||||
<p className="text-sm text-muted-foreground">No MCP connections yet.</p>
|
||||
) : (
|
||||
@@ -231,7 +269,7 @@ export function McpSettings() {
|
||||
type="password"
|
||||
value={form.secret}
|
||||
onChange={e => setForm({ ...form, secret: e.target.value })}
|
||||
placeholder={form.hasStoredSecret ? `${KEY_MASK} (leave blank to keep)` : 'Paste the credential'}
|
||||
placeholder={form.hasStoredSecret ? `${KEY_MASK} (leave blank to keep)` : (form.secretHint || 'Paste the credential')}
|
||||
maxLength={2000}
|
||||
/>
|
||||
{form.hasStoredSecret && <p className="mt-1 text-xs text-muted-foreground">Stored credentials are never shown; blank keeps the current one.</p>}
|
||||
|
||||
Reference in New Issue
Block a user