Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e718a3d6e9 | ||
|
|
a167e376f7 | ||
|
|
c04be7529a | ||
|
|
4b6a58118e |
@@ -111,7 +111,7 @@ Bearer / custom-header auth. Stored in `McpConnection` (migration 018).
|
|||||||
|
|
||||||
| Method | Path | Returns |
|
| 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 |
|
| 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 |
|
| 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 |
|
| DELETE | `/api/mcp/connections/{id}` | `{ok:true}`; 404 for another user's row |
|
||||||
|
|||||||
@@ -7,6 +7,32 @@ Versions correspond to git tags and to the published image set
|
|||||||
(the line was reset to 0.2.x at 0.2.14 — Superbrain is pre-beta).
|
(the line was reset to 0.2.x at 0.2.14 — Superbrain is pre-beta).
|
||||||
Dates are tag dates.
|
Dates are tag dates.
|
||||||
|
|
||||||
|
## 0.3.8 — 2026-11-25
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **MCP suggestion catalog**: Settings → MCP offers GitHub, HubSpot and
|
||||||
|
Make as one-click prefills. The catalog ships as data in the binary
|
||||||
|
(like the entitlements catalog — never a TIER fork); "Use" prefills
|
||||||
|
name/url/transport/authKind with a credential hint, and the secret stays
|
||||||
|
write-only. Verified against vendor docs: GitHub
|
||||||
|
(`api.githubcopilot.com/mcp/`, PAT) and Make (`<zone>.make.com/mcp/v2`,
|
||||||
|
API token with `mcp:use`) accept Bearer tokens and are connectable today.
|
||||||
|
HubSpot's remote MCP (`mcp.hubspot.com`) requires OAuth 2.1 + PKCE with
|
||||||
|
no static-token path, so it is shown honestly labeled "OAuth required"
|
||||||
|
with a note and docs link and NO Use button — the client speaks
|
||||||
|
none/bearer/header only.
|
||||||
|
|
||||||
|
## 0.3.7 — 2026-11-24
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- **Accurate module identity after the Gitea rename**: the repository was
|
||||||
|
renamed `brain` → `superbrain` on Gitea; the Go module is now
|
||||||
|
`gitea.federated.computer/Federated_Computer/superbrain` (go.mod + every
|
||||||
|
internal import), and the agent's outbound User-Agent contact URL and the
|
||||||
|
README/RUNNING clone URLs follow. Pure identifier rename with no runtime
|
||||||
|
behavior change; verified with build + vet + unit tests and the full
|
||||||
|
database integration suite under `-race`.
|
||||||
|
|
||||||
## 0.3.6 — 2026-11-24
|
## 0.3.6 — 2026-11-24
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ Details: [web/docs/AUTHELIA.md](web/docs/AUTHELIA.md) §7.
|
|||||||
Requires Docker with Compose v2 or newer. On a new installation:
|
Requires Docker with Compose v2 or newer. On a new installation:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://gitea.federated.computer/Federated_Computer/brain.git
|
git clone https://gitea.federated.computer/Federated_Computer/superbrain.git
|
||||||
cd superbrain
|
cd superbrain
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
docker run --rm node:22-alpine node -e "console.log(require('node:crypto').randomBytes(32).toString('hex'))"
|
docker run --rm node:22-alpine node -e "console.log(require('node:crypto').randomBytes(32).toString('hex'))"
|
||||||
@@ -490,7 +490,7 @@ federatedcomputer/superbrain-migrate:<version> DB bootstrap (context db, db/D
|
|||||||
```
|
```
|
||||||
|
|
||||||
Platforms: `linux/amd64,linux/arm64`. Source of truth: this Gitea repo
|
Platforms: `linux/amd64,linux/arm64`. Source of truth: this Gitea repo
|
||||||
(`https://gitea.federated.computer/Federated_Computer/brain.git`) at the
|
(`https://gitea.federated.computer/Federated_Computer/superbrain.git`) at the
|
||||||
matching tag. The repositories auto-create on first push under the
|
matching tag. The repositories auto-create on first push under the
|
||||||
`federatedcomputer` namespace; keep them **public** so cores can pull
|
`federatedcomputer` namespace; keep them **public** so cores can pull
|
||||||
without registry credentials. Never move an existing tag — cut a new
|
without registry credentials. Never move an existing tag — cut a new
|
||||||
@@ -536,7 +536,7 @@ Watch the run under the repo's Actions tab; verify with
|
|||||||
From any Linux machine with Docker, buildx and login rights:
|
From any Linux machine with Docker, buildx and login rights:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://gitea.federated.computer/Federated_Computer/brain.git
|
git clone https://gitea.federated.computer/Federated_Computer/superbrain.git
|
||||||
cd brain && git checkout 0.2.17 # always build from the tag
|
cd brain && git checkout 0.2.17 # always build from the tag
|
||||||
|
|
||||||
# One-time per machine: buildx builder + cross-arch emulation
|
# One-time per machine: buildx builder + cross-arch emulation
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ Both commands should succeed. On Windows, Docker must be using Linux containers.
|
|||||||
## 1. Download the app
|
## 1. Download the app
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://gitea.federated.computer/Federated_Computer/brain.git
|
git clone https://gitea.federated.computer/Federated_Computer/superbrain.git
|
||||||
cd superbrain
|
cd superbrain
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ SUPERBRAIN_APP_IP="192.168.0.94"
|
|||||||
SUPERBRAIN_MIGRATE_IP="192.168.0.95"
|
SUPERBRAIN_MIGRATE_IP="192.168.0.95"
|
||||||
# Release to install; the generic `upgrade` flow keeps .env in step with the
|
# Release to install; the generic `upgrade` flow keeps .env in step with the
|
||||||
# service file's VERSION afterwards.
|
# service file's VERSION afterwards.
|
||||||
SUPERBRAIN_IMAGE_VERSION="0.3.6"
|
SUPERBRAIN_IMAGE_VERSION="0.3.8"
|
||||||
|
|
||||||
# render_superbrain_compose writes the app-dir compose file. Called by
|
# render_superbrain_compose writes the app-dir compose file. Called by
|
||||||
# config_superbrain (install) and by deploy/federated/update.sh after a lib
|
# config_superbrain (install) and by deploy/federated/update.sh after a lib
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ NAME=superbrain
|
|||||||
DESCRIPTION="Bookmark & Knowledge Base"
|
DESCRIPTION="Bookmark & Knowledge Base"
|
||||||
DOCS=https://github.com/andrew/superbrain
|
DOCS=https://github.com/andrew/superbrain
|
||||||
CONTAINER=federatedcomputer/superbrain-app
|
CONTAINER=federatedcomputer/superbrain-app
|
||||||
VERSION=0.3.6
|
VERSION=0.3.8
|
||||||
INTERNAL_IP=192.168.0.93
|
INTERNAL_IP=192.168.0.93
|
||||||
DEPENDS="postgresql"
|
DEPENDS="postgresql"
|
||||||
PORTS=3000
|
PORTS=3000
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module gitea.federated.computer/Federated_Computer/brain
|
module gitea.federated.computer/Federated_Computer/superbrain
|
||||||
|
|
||||||
go 1.26.0
|
go 1.26.0
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/ai"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/ai"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrCompileRejected means the model could not (or refused to) express the
|
// ErrCompileRejected means the model could not (or refused to) express the
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/ai"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/ai"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/mailer"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/mailer"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/notify"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -407,7 +407,7 @@ func fetchText(ctx context.Context, rawurl string) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
req.Header.Set("User-Agent", "Superbrain-agent/1.0 (+https://gitea.federated.computer/Federated_Computer/brain)")
|
req.Header.Set("User-Agent", "Superbrain-agent/1.0 (+https://gitea.federated.computer/Federated_Computer/superbrain)")
|
||||||
req.Header.Set("Accept", "text/html,application/xhtml+xml,application/json;q=0.9,text/plain;q=0.8")
|
req.Header.Set("Accept", "text/html,application/xhtml+xml,application/json;q=0.9,text/plain;q=0.8")
|
||||||
res, err := fetchClient.Do(req)
|
res, err := fetchClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+6
-6
@@ -33,12 +33,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DefaultModel is the fallback for the server env config (OpenRouter free
|
// DefaultModel is the fallback for the server env config (OpenRouter free
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package auth
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"github.com/jackc/pgx/v5/pgconn"
|
"github.com/jackc/pgx/v5/pgconn"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package auth
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/models"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/models"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/mailer"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/mailer"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
"crypto/hmac"
|
"crypto/hmac"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/handlers"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/handlers"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Conn is the dial-relevant projection of a stored CalDavConnection row plus
|
// Conn is the dial-relevant projection of a stored CalDavConnection row plus
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Conn is the dial-relevant projection of a stored CardDavConnection row
|
// Conn is the dial-relevant projection of a stored CardDavConnection row
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
_ "github.com/jackc/pgx/v5/stdlib"
|
_ "github.com/jackc/pgx/v5/stdlib"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Tenancy phase 1 (DESIGN_TENANCY_ENTITLEMENTS.md): every user belongs to
|
// Tenancy phase 1 (DESIGN_TENANCY_ENTITLEMENTS.md): every user belongs to
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/models"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserRepo struct{ db *DB }
|
type UserRepo struct{ db *DB }
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/agent"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/agent"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/ai"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/ai"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// compileLimiter bounds NL compilations per user (each one is an LLM call).
|
// compileLimiter bounds NL compilations per user (each one is an LLM call).
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/agent"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/agent"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/ai"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/ai"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
|
||||||
)
|
)
|
||||||
|
|
||||||
// aiKeyMask mirrors the notification-channel mask: write-only secrets.
|
// aiKeyMask mirrors the notification-channel mask: write-only secrets.
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// maxAPIKeys caps live keys per user — a product limit against credential
|
// maxAPIKeys caps live keys per user — a product limit against credential
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/markdown"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/markdown"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/preview"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/preview"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/caldav"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/caldav"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/carddav"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/carddav"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"github.com/jackc/pgx/v5/pgconn"
|
"github.com/jackc/pgx/v5/pgconn"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Structured export (trust phase): a single owner-scoped JSON archive that is
|
// Structured export (trust phase): a single owner-scoped JSON archive that is
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/kanban"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/kanban"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/mcpclient"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/mcpclient"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -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) {
|
func HandleMcpConnectionsList(w http.ResponseWriter, r *http.Request) {
|
||||||
rows, e := db.Many(r.Context(), database(r),
|
rows, e := db.Many(r.Context(), database(r),
|
||||||
`SELECT to_jsonb(t) FROM "McpConnection" t WHERE "ownerId"=$1 ORDER BY "createdAt"`, user(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 {
|
for _, row := range rows {
|
||||||
out = append(out, mcpProjection(row))
|
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) {
|
func cleanMcpFields(b object, create bool) (object, error) {
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"errors"
|
"errors"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/signals"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/signals"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/caldav"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/caldav"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/carddav"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/carddav"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/webdav"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/webdav"
|
||||||
)
|
)
|
||||||
|
|
||||||
const nextcloudVerifyTimeout = 25 * time.Second
|
const nextcloudVerifyTimeout = 25 * time.Second
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/notify"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
)
|
)
|
||||||
|
|
||||||
// errPlanGate answers 403 for features the tenant's plan does not include.
|
// errPlanGate answers 403 for features the tenant's plan does not include.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Connected pages (Notion-like upgrades phase 3).
|
// Connected pages (Notion-like upgrades phase 3).
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Page revision history (trust phase). Every committed content version gets
|
// Page revision history (trust phase). Every committed content version gets
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package handlers
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/markdown"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/markdown"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// profileTextFields maps the allowlisted column names to their rune caps.
|
// profileTextFields maps the allowlisted column names to their rune caps.
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package handlers
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/signals"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/signals"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Recoverable deletions (trust phase).
|
// Recoverable deletions (trust phase).
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/webdav"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/webdav"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// machineReq calls the API with an API-key Bearer header and no cookies —
|
// machineReq calls the API with an API-key Bearer header and no cookies —
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/scripts"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/scripts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AUTH_MODE=oidc (core/federated shape): Authelia exclusively. Password
|
// AUTH_MODE=oidc (core/federated shape): Authelia exclusively. Password
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fakeCaldav is a mutable RFC 4791 server for integration tests: a home at
|
// fakeCaldav is a mutable RFC 4791 server for integration tests: a home at
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/signals"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/signals"
|
||||||
"github.com/emersion/go-imap/backend/memory"
|
"github.com/emersion/go-imap/backend/memory"
|
||||||
imapserver "github.com/emersion/go-imap/server"
|
imapserver "github.com/emersion/go-imap/server"
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package http
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/cookiejar"
|
"net/http/cookiejar"
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package http
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/signals"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/signals"
|
||||||
"github.com/emersion/go-imap/backend/memory"
|
"github.com/emersion/go-imap/backend/memory"
|
||||||
imapserver "github.com/emersion/go-imap/server"
|
imapserver "github.com/emersion/go-imap/server"
|
||||||
"io"
|
"io"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/http/cookiejar"
|
"net/http/cookiejar"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp"
|
mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp"
|
||||||
@@ -135,3 +136,34 @@ func TestMcpConnections(t *testing.T) {
|
|||||||
|
|
||||||
// maxTestMcpConns mirrors handlers.maxMcpConns.
|
// maxTestMcpConns mirrors handlers.maxMcpConns.
|
||||||
const maxTestMcpConns = 10
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fakeNextcloud serves all three DAV protocols on ONE origin with the
|
// fakeNextcloud serves all three DAV protocols on ONE origin with the
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/notify"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fakeWebhook captures one Slack-style POST for the delivery tests.
|
// fakeWebhook captures one Slack-style POST for the delivery tests.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/notify"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fakeSignalBridge mimics a signal-cli REST bridge: POST /v2/send?account=...
|
// fakeSignalBridge mimics a signal-cli REST bridge: POST /v2/send?account=...
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fakeSMTP is a minimal loopback SMTP relay: it speaks just enough of the
|
// fakeSMTP is a minimal loopback SMTP relay: it speaks just enough of the
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/scripts"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/scripts"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/cookiejar"
|
"net/http/cookiejar"
|
||||||
"os"
|
"os"
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/auth"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/authguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/authguard"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/handlers"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/handlers"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/oidc"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/oidc"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewServer builds the HTTP server with all routes registered.
|
// NewServer builds the HTTP server with all routes registered.
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Tenancy phase 1: every account-creation path lands the user in the
|
// Tenancy phase 1: every account-creation path lands the user in the
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/notify"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
|
||||||
)
|
)
|
||||||
|
|
||||||
var unsubTokenRx = regexp.MustCompile(`/unsubscribe\?token=([0-9a-f.]+)`)
|
var unsubTokenRx = regexp.MustCompile(`/unsubscribe\?token=([0-9a-f.]+)`)
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/webdav"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/webdav"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fakeShare is a mutable minimal RFC 4918 server (Basic-auth erwin/s3cret)
|
// fakeShare is a mutable minimal RFC 4918 server (Basic-auth erwin/s3cret)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package kanban
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
var DefaultColumns = []struct{ Label, Color, Key string }{{"Inbox", "#64748b", "INBOX"}, {"To Do", "#3b82f6", "TODO"}, {"In Progress", "#f59e0b", "IN_PROGRESS"}, {"Done", "#22c55e", "DONE"}}
|
var DefaultColumns = []struct{ Label, Color, Key string }{{"Inbox", "#64748b", "INBOX"}, {"To Do", "#3b82f6", "TODO"}, {"In Progress", "#f59e0b", "IN_PROGRESS"}, {"Done", "#22c55e", "DONE"}}
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrNotConfigured means SMTP_HOST/SMTP_FROM are unset; callers surface a
|
// ErrNotConfigured means SMTP_HOST/SMTP_FROM are unset; callers surface a
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package markdown
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Review L-11: link destinations are wrapped and escaped so parentheses or
|
// Review L-11: link destinations are wrapped and escaped so parentheses or
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import (
|
|||||||
|
|
||||||
mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp"
|
mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Conn is the dial-relevant projection of a stored McpConnection row plus
|
// Conn is the dial-relevant projection of a stored McpConnection row plus
|
||||||
@@ -91,7 +91,7 @@ func httpClient(conn Conn) *http.Client {
|
|||||||
// ListTools connects, initializes and lists the server's tools, then closes
|
// ListTools connects, initializes and lists the server's tools, then closes
|
||||||
// the session. The context bounds the whole exchange.
|
// the session. The context bounds the whole exchange.
|
||||||
func ListTools(ctx context.Context, conn Conn) ([]Tool, error) {
|
func ListTools(ctx context.Context, conn Conn) ([]Tool, error) {
|
||||||
client := mcpsdk.NewClient(&mcpsdk.Implementation{Name: "superbrain", Version: "0.3.6"}, nil)
|
client := mcpsdk.NewClient(&mcpsdk.Implementation{Name: "superbrain", Version: "0.3.8"}, nil)
|
||||||
var transport mcpsdk.Transport
|
var transport mcpsdk.Transport
|
||||||
hc := httpClient(conn)
|
hc := httpClient(conn)
|
||||||
switch conn.Transport {
|
switch conn.Transport {
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/mailer"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/mailer"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Kinds is the phase-1 channel set (mirrors the NotificationChannel CHECK).
|
// Kinds is the phase-1 channel set (mirrors the NotificationChannel CHECK).
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/mailer"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/mailer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// unsubscribeDomain separates these MACs from every other use of the
|
// unsubscribeDomain separates these MACs from every other use of the
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
var placeholderPatterns = []*regexp.Regexp{
|
var placeholderPatterns = []*regexp.Regexp{
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package preview
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
"golang.org/x/net/html"
|
"golang.org/x/net/html"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package signals
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"log"
|
"log"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
"github.com/emersion/go-imap"
|
"github.com/emersion/go-imap"
|
||||||
"github.com/emersion/go-imap/client"
|
"github.com/emersion/go-imap/client"
|
||||||
"log"
|
"log"
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/netguard"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Conn is the dial-relevant projection of a stored WebDavConnection row plus
|
// Conn is the dial-relevant projection of a stored WebDavConnection row plus
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto"
|
crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/outbound"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/agent"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/agent"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/caldav"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/caldav"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/carddav"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/carddav"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/config"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/config"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/db"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/db"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/http"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/http"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/notify"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/scripts"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/scripts"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/signals"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/signals"
|
||||||
"gitea.federated.computer/Federated_Computer/brain/internal/webdav"
|
"gitea.federated.computer/Federated_Computer/superbrain/internal/webdav"
|
||||||
"log"
|
"log"
|
||||||
stdhttp "net/http"
|
stdhttp "net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ name = "superbrain-mcp"
|
|||||||
# Versioned in lockstep with the Superbrain release it speaks to (house
|
# Versioned in lockstep with the Superbrain release it speaks to (house
|
||||||
# tooling tracks one version per app); the federated mcpserver gateway
|
# tooling tracks one version per app); the federated mcpserver gateway
|
||||||
# installs this package and spawns `superbrain-mcp` per linked instance.
|
# installs this package and spawns `superbrain-mcp` per linked instance.
|
||||||
version = "0.3.6"
|
version = "0.3.8"
|
||||||
description = "MCP server for Superbrain — bookmarks, tags and pages over the Superbrain REST API"
|
description = "MCP server for Superbrain — bookmarks, tags and pages over the Superbrain REST API"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
"""Superbrain MCP server — bookmarks, tags and pages for AI tooling."""
|
"""Superbrain MCP server — bookmarks, tags and pages for AI tooling."""
|
||||||
|
|
||||||
__version__ = "0.3.6"
|
__version__ = "0.3.8"
|
||||||
|
|||||||
@@ -73,6 +73,11 @@ const carddavSuggestions = [{ kind: 'nextcloud', name: 'Nextcloud contacts', url
|
|||||||
// Unified Nextcloud connect fixture: mirrors handlers/nextcloud.go — the
|
// Unified Nextcloud connect fixture: mirrors handlers/nextcloud.go — the
|
||||||
// origin is normalized, per-user DAV roots composed server-side, repeat
|
// origin is normalized, per-user DAV roots composed server-side, repeat
|
||||||
// connects report "exists", and a wrong password stores nothing.
|
// 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
|
let lastNextcloudConnect = null
|
||||||
// Automations fixture: the sidebar dropdown and the /automations workspace
|
// Automations fixture: the sidebar dropdown and the /automations workspace
|
||||||
// exercise against the same projection handlers/agent.go returns.
|
// 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 }
|
results[key] = { status: 'created', id: conn.id, name: conn.name, url: u }
|
||||||
}
|
}
|
||||||
result = { results }
|
result = { results }
|
||||||
|
} else if (url.pathname === '/api/mcp/connections') {
|
||||||
|
result = { connections: [], suggestions: mcpSuggestions }
|
||||||
} else if (url.pathname === '/api/agent/tasks') {
|
} else if (url.pathname === '/api/agent/tasks') {
|
||||||
result = agentTasks
|
result = agentTasks
|
||||||
} else if (url.pathname === '/api/agent/runs') {
|
} else if (url.pathname === '/api/agent/runs') {
|
||||||
@@ -915,6 +922,21 @@ try {
|
|||||||
await page.getByPlaceholder('https://cloud.example.com').waitFor()
|
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')
|
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,
|
// Mobile pass (390x844): the shell becomes a drawer, tables become cards,
|
||||||
// rail screens become master-detail, and NO screen may overflow the
|
// rail screens become master-detail, and NO screen may overflow the
|
||||||
// viewport horizontally. A separate context keeps the desktop session and
|
// 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
|
id: string; name: string; url: string; transport: string; authKind: string
|
||||||
headerName: string; secret: string; enabled: boolean; version: number
|
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 TestResult = { ok: boolean; count?: number; tools?: { name: string; description: string }[]; error?: string }
|
||||||
|
|
||||||
type FormState = {
|
type FormState = {
|
||||||
id: string | null; version: number
|
id: string | null; version: number
|
||||||
name: string; url: string; transport: string; authKind: string; headerName: string
|
name: string; url: string; transport: string; authKind: string; headerName: string
|
||||||
secret: string; hasStoredSecret: boolean
|
secret: string; hasStoredSecret: boolean; secretHint?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const emptyForm: FormState = {
|
const emptyForm: FormState = {
|
||||||
@@ -42,6 +46,7 @@ async function api(path: string, init?: RequestInit): Promise<Response> {
|
|||||||
|
|
||||||
export function McpSettings() {
|
export function McpSettings() {
|
||||||
const [connections, setConnections] = useState<McpConnection[]>([])
|
const [connections, setConnections] = useState<McpConnection[]>([])
|
||||||
|
const [suggestions, setSuggestions] = useState<Suggestion[]>([])
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [form, setForm] = useState<FormState | null>(null)
|
const [form, setForm] = useState<FormState | null>(null)
|
||||||
const [saving, setSaving] = useState(false)
|
const [saving, setSaving] = useState(false)
|
||||||
@@ -51,13 +56,22 @@ export function McpSettings() {
|
|||||||
const reload = useCallback(() =>
|
const reload = useCallback(() =>
|
||||||
api('/api/mcp/connections')
|
api('/api/mcp/connections')
|
||||||
.then(r => r.json())
|
.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'))
|
.catch(() => toast.error('Could not load MCP connections'))
|
||||||
.finally(() => setLoading(false)), [])
|
.finally(() => setLoading(false)), [])
|
||||||
|
|
||||||
useEffect(() => { reload() }, [reload])
|
useEffect(() => { reload() }, [reload])
|
||||||
|
|
||||||
const openCreate = () => setForm({ ...emptyForm })
|
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({
|
const openEdit = (c: McpConnection) => setForm({
|
||||||
id: c.id, version: c.version, name: c.name, url: c.url, transport: c.transport,
|
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,
|
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>
|
<Button size="sm" onClick={openCreate}><Plus className="h-4 w-4 mr-1" /> Add connection</Button>
|
||||||
</div>
|
</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 ? (
|
{connections.length === 0 ? (
|
||||||
<p className="text-sm text-muted-foreground">No MCP connections yet.</p>
|
<p className="text-sm text-muted-foreground">No MCP connections yet.</p>
|
||||||
) : (
|
) : (
|
||||||
@@ -231,7 +269,7 @@ export function McpSettings() {
|
|||||||
type="password"
|
type="password"
|
||||||
value={form.secret}
|
value={form.secret}
|
||||||
onChange={e => setForm({ ...form, secret: e.target.value })}
|
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}
|
maxLength={2000}
|
||||||
/>
|
/>
|
||||||
{form.hasStoredSecret && <p className="mt-1 text-xs text-muted-foreground">Stored credentials are never shown; blank keeps the current one.</p>}
|
{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