Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .claude/skills/sdk/notes/2026-11-24-ai-3676.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
`createConnector` (`POST /v1/agents/connectors`) takes an HTTP API in place of an MCP server (AI-3676). `CustomConnectorRequest` has a new optional `http`, a `CustomHTTPAPI` `{base_url, tools}`. Each tool is a `CustomHTTPTool` `{name, description, method, path, parameters, read_only}`: `method` is one of `GET`, `HEAD`, `POST`, `PUT`, `PATCH` and `DELETE`, and `parameters` maps a name to a `CustomHTTPParameter` `{type, description, required}`, whose `type` is one of `string`, `number`, `integer` and `boolean`. `endpoint` is no longer required: a request sends a non-empty `endpoint` or `http`, not both. This breaks existing callers in four SDKs. In Go, `CustomConnectorRequest.Endpoint` is now a `*string` (`sdks/go/acceleration/generated.go`), and a caller that set it as a string now sets a pointer. In Rust, `CustomConnectorRequest.endpoint` is now an `Option<String>` (`sdks/rust/src/types.rs`), so a struct literal or a read of a `String` no longer compiles. In PHP (`sdks/php/src/Generated/CustomConnectorRequest.php`) and Python (`plugins/stream`, `_generated/models/custom_connector_request.py`), `endpoint` moves from the first constructor argument to after `schemes`, so a positional call no longer matches; named and keyword arguments still work. The `Connector` the router answers is unchanged, so it shows neither `base_url` nor the tools. Go, JavaScript, Python (`plugins/stream`), .NET, Ruby, Rust and PHP have the regenerated clients. Other SDKs need to update: a `connectors.create` resource method, where an SDK has one, takes `http` beside `endpoint`. Swift, Kotlin and Dart need nothing, since `createConnector` is not client-accessible.

The `Connector` the router answers now has `sources` (AI-3871), a list of `ConnectorSource` `{kind}` whose `kind` is `mcp` or `http`: a custom connector made from an `endpoint` reads `mcp`, one made from `http` reads `http`, and a built-in names its own. It never carries a URL, a path or a tool. This adds a required field to a response, so a client that builds a `Connector` itself, or compares one whole, must give it `sources`. In Go it is `[]ConnectorSource`, and the constants are `ConnectorSourceKindMCP` and `ConnectorSourceKindHTTP`. Go, JavaScript, Python (`plugins/stream`), .NET, Ruby, Rust and PHP have the regenerated clients; Swift, Kotlin and Dart generate nothing new. Other SDKs need to update: a resource method that returns a connector (`connectors.get`, `connectors.list`), where an SDK has one, exposes `sources`, so a caller can tell an http connector from an MCP one.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Nit] R1.1 This paragraph is another change (AI-3871) appended to AI-3676's note, but notes/README.md asks for one file per change, and the first paragraph above still says "The Connector the router answers is unchanged". Move it to its own file, e.g. 2026-11-25-ai-3871.md. An SDK update picks up either (it diffs the notes tree), so this does not block.

24 changes: 24 additions & 0 deletions acceleration/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3552,6 +3552,11 @@ components:
setup:
$ref: '#/components/schemas/ConnectorSetup'
description: What a person does at the provider before the first consent, such as registering an OAuth client. Absent when the manifest says nothing.
sources:
description: 'How the connector''s tools are reached, one entry per source, by kind only: never a URL, a path or a credential. A custom connector made from an endpoint is mcp, one made from http is http.'
items:
$ref: '#/components/schemas/ConnectorSource'
type: array
sync_hash:
description: The fingerprint of the file the CLI last synced onto this connector. Absent on a built-in, and on a connector that was never synced or was written since by anything that is not a sync.
readOnly: true
Expand All @@ -3564,6 +3569,7 @@ components:
- schemes
- inputs
- scopes
- sources
- client
- channel
- created_at
Expand Down Expand Up @@ -4055,6 +4061,24 @@ components:
- title
- description
type: object
ConnectorSource:
additionalProperties: false
description: One way a connector's tools are reached. Only its kind is shown.
properties:
kind:
$ref: '#/components/schemas/ConnectorSourceKind'
required:
- kind
type: object
ConnectorSourceKind:
description: mcp is an MCP server that lists the tools, http an HTTP API whose tools the manifest lists.
enum:
- mcp
- http
type: string
x-enum-varnames:
- ConnectorSourceKindMCP
- ConnectorSourceKindHTTP
ConnectorToolGrant:
description: One tool a binding allows.
properties:
Expand Down
42 changes: 38 additions & 4 deletions acceleration/internal/api/connectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ const usesNamed = 10
// Connector is one connector as the catalog shows it and a connection is created from: the
// revision of its definition (store.ConnectorDefinition) the request read. It is the
// non-secret part of the manifest: what a caller chooses between (schemes, inputs, scopes,
// who owns the OAuth client). Everything the router reads to connect is left out: a built-in's
// endpoints, vars, authorize and token parameters, capture and identity rules, refresh and
// rate limits, sources, hooks and the operator's client variables. A custom connector's
// endpoint is left out too: an MCP URL can carry a secret in its path (AI-837).
// who owns the OAuth client, how it is reached). Everything the router reads to connect is left
// out: a built-in's endpoints, vars, authorize and token parameters, capture and identity rules,
// refresh and rate limits, the sources' endpoints, headers and tools, hooks and the operator's
// client variables. A custom connector's endpoint is left out too: an MCP URL can carry a
// secret in its path (AI-837), and an http API's base URL can.
type Connector struct {
ID string `json:"id" doc:"Unique among the built-ins and the app's own. A custom definition's starts with custom_, and a built-in's never does."`
Revision int `json:"revision" readOnly:"true" doc:"The manifest's revision. A connection is created from the newest one and keeps reading it until it is reconnected."`
Expand All @@ -46,6 +47,7 @@ type Connector struct {
Schemes []string `json:"schemes" doc:"How a connection may authenticate, such as oauth2_code."`
Inputs []ConnectorInput `json:"inputs" doc:"What a connection is created with, such as a region or a shop."`
Scopes []string `json:"scopes" doc:"The scopes a consent asks for."`
Sources []ConnectorSource `json:"sources" nullable:"false" doc:"How the connector's tools are reached, one entry per source, by kind only: never a URL, a path or a credential. A custom connector made from an endpoint is mcp, one made from http is http."`
Client ConnectorClient `json:"client"`
Setup *ConnectorSetup `json:"setup,omitempty" doc:"What a person does at the provider before the first consent, such as registering an OAuth client. Absent when the manifest says nothing."`
RedirectURI string `json:"redirect_uri,omitempty" readOnly:"true" format:"uri" doc:"The redirect URI an OAuth client registered for this connector has to list: where every consent of this deployment sends the browser back to, ROUTER_PUBLIC_URL followed by /v1/agents/connectors/oauth/callback. Only on a connector that connects with oauth2_code, and absent when ROUTER_PUBLIC_URL is not set, since no consent can start then."`
Expand All @@ -55,6 +57,33 @@ type Connector struct {
CreatedAt time.Time `json:"created_at" readOnly:"true" doc:"When this revision was stored."`
}

// ConnectorSource is one source of a connector's tools, as the catalog shows it.
type ConnectorSource struct {
Kind ConnectorSourceKind `json:"kind"`
}

func (*ConnectorSource) TransformSchema(_ huma.Registry, schema *huma.Schema) *huma.Schema {
schema.Description = "One way a connector's tools are reached. Only its kind is shown."
schema.AdditionalProperties = false
return schema
}

// ConnectorSourceKind is how a source reaches a connector's tools (core.SourceKindMCP and
// core.SourceKindHTTP).
type ConnectorSourceKind string

func (ConnectorSourceKind) Schema(registry huma.Registry) *huma.Schema {
ref := namedEnum(registry, "ConnectorSourceKind",
"mcp is an MCP server that lists the tools, http an HTTP API whose tools the manifest lists.",
core.SourceKindMCP, core.SourceKindHTTP)
// Named, so a later enum with mcp or http in it renames nothing in the Go SDK, as
// ConnectionOwnerType's constants are.
registry.Map()["ConnectorSourceKind"].Extensions = map[string]any{
"x-enum-varnames": []string{"ConnectorSourceKindMCP", "ConnectorSourceKindHTTP"},
}
return ref
}

// ConnectorSandbox is the manifest's sandbox block as the catalog shows it.
type ConnectorSandbox struct {
Env string `json:"env" doc:"The env var code in the sandbox reads, such as GITHUB_TOKEN. Its value is a placeholder: the sandbox's egress puts the connection's credential in its place, only in a request header and only to one of hosts."`
Expand Down Expand Up @@ -563,6 +592,10 @@ func connectorOf(definition store.ConnectorDefinition, publicURL string) Connect
if slices.Contains(manifest.Schemes, oauth2code.Name) {
redirectURI = connectorCallbackURL(publicURL)
}
sources := make([]ConnectorSource, 0, len(manifest.Sources))
for _, source := range manifest.Sources {
sources = append(sources, ConnectorSource{Kind: ConnectorSourceKind(source.Kind)})
}
var sandbox *ConnectorSandbox
if manifest.Sandbox != nil {
sandbox = &ConnectorSandbox{Env: manifest.Sandbox.Env, Hosts: slices.Clone(manifest.Sandbox.Hosts)}
Expand All @@ -581,6 +614,7 @@ func connectorOf(definition store.ConnectorDefinition, publicURL string) Connect
Schemes: append([]string{}, manifest.Schemes...),
Inputs: inputs,
Scopes: append([]string{}, manifest.Scopes.List...),
Sources: sources,
Client: ConnectorClient{
Registration: registrations,
AuthMethod: ConnectorClientAuthMethod(manifest.Client.AuthMethod),
Expand Down
56 changes: 56 additions & 0 deletions acceleration/internal/api/connectors_sources_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package api

import (
"encoding/json"
"testing"

"github.com/stretchr/testify/suite"

"github.com/GetStream/Vision-Agents/acceleration/internal/connectors/core"
"github.com/GetStream/Vision-Agents/acceleration/internal/store"
)

// ConnectorSourcesSuite covers the sources a Connector shows, without a store.
type ConnectorSourcesSuite struct {
suite.Suite
}

func TestConnectorSourcesSuite(t *testing.T) {
suite.Run(t, new(ConnectorSourcesSuite))
}

// sourcesJSON is what a caller reads of the sources of a manifest with these source rules.
func (s *ConnectorSourcesSuite) sourcesJSON(rules ...core.SourceRule) string {
shown := connectorOf(store.ConnectorDefinition{Manifest: core.Manifest{Sources: rules}}, "")
raw, err := json.Marshal(shown)
s.Require().NoError(err)
var decoded struct {
Sources json.RawMessage `json:"sources"`
}
s.Require().NoError(json.Unmarshal(raw, &decoded))
return string(decoded.Sources)
}

// Defect: one entry per kind rather than per source, or the order lost, so a connector with an
// http source beside its mcp one reads as only one of them.
func (s *ConnectorSourcesSuite) TestEverySourceIsShownByItsKindInTheManifestsOrder() {
s.JSONEq(`[{"kind":"mcp"},{"kind":"http"}]`, s.sourcesJSON(
core.SourceRule{Kind: core.SourceKindMCP, Endpoint: "mcp"}, core.SourceRule{Kind: core.SourceKindHTTP, Endpoint: "http"}))
s.JSONEq(`[{"kind":"http"},{"kind":"mcp"}]`, s.sourcesJSON(
core.SourceRule{Kind: core.SourceKindHTTP, Endpoint: "http"}, core.SourceRule{Kind: core.SourceKindMCP, Endpoint: "mcp"}))
}

// Defect: a connector with no source answering null, which a client reads as absent.
func (s *ConnectorSourcesSuite) TestAConnectorWithNoSourceShowsAnEmptyList() {
s.Equal(`[]`, s.sourcesJSON())
}

// Defect: a source's endpoint, headers or tools copied into the answer with its kind.
func (s *ConnectorSourcesSuite) TestASourceShowsNothingButItsKind() {
rule := core.SourceRule{
Kind: core.SourceKindHTTP, Endpoint: "http", Headers: map[string]string{"X-Team": "secret-team"},
Tools: []core.ToolRule{{Name: "scoped", NeedsScopes: []string{"s"}}},
HTTPTools: []core.HTTPTool{{Name: "get_forecast", Method: "GET", Path: "/v1/forecast"}},
}
s.JSONEq(`[{"kind":"http"}]`, s.sourcesJSON(rule))
}
61 changes: 53 additions & 8 deletions acceleration/internal/api/connectors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,12 @@ func (s *ConnectorsSuite) TestWhatTheRouterReadsToConnectIsNeverShown() {
s.Require().NoError(json.Unmarshal(raw, &shown))
for _, withheld := range []string{
"endpoints", "vars", "authorize_params", "token_params", "identity", "capture",
"refresh", "rate_limit", "sources", "hooks", "manifest",
"refresh", "rate_limit", "hooks", "manifest",
} {
s.NotContains(shown, withheld)
}
// The sources are shown by kind alone (TestAConnectorShowsItsSourceKindAndNoAddress).
s.Equal([]any{map[string]any{"kind": "mcp"}}, shown["sources"])
// The manifest's channel block stays withheld; AI-1053 shows only whether there is one.
s.IsType(false, shown["channel"])
client, ok := shown["client"].(map[string]any)
Expand All @@ -212,16 +214,16 @@ func (s *ConnectorsSuite) TestACustomConnectorsEndpointIsNeverShown() {

// TestABuiltInReadsAsBeforeOnARouterWithoutAPublicURL is the control for AI-1046 and AI-1047:
// the keys a built-in is answered with are the ones accelerate at 26051062 answered with,
// probed there with this suite (pr-w7/author-1.md), plus channel (AI-1053). Without ROUTER_PUBLIC_URL there is no
// redirect URI.
// probed there with this suite (pr-w7/author-1.md), plus channel (AI-1053) and sources
// (AI-3871). Without ROUTER_PUBLIC_URL there is no redirect URI.
func (s *ConnectorsSuite) TestABuiltInReadsAsBeforeOnARouterWithoutAPublicURL() {
for _, id := range []string{"slack", "linear", "telnyx"} {
status, raw := s.serverClient.call(http.MethodGet, "/v1/agents/connectors/"+id, nil)
s.Require().Equal(http.StatusOK, status)
var shown map[string]any
s.Require().NoError(json.Unmarshal(raw, &shown))
s.Equal([]string{"category", "channel", "client", "created_at", "custom", "description", "duration", "id", "inputs",
"name", "revision", "schemes", "scopes"}, slices.Sorted(maps.Keys(shown)), id)
"name", "revision", "schemes", "scopes", "sources"}, slices.Sorted(maps.Keys(shown)), id)
}
}

Expand Down Expand Up @@ -892,21 +894,23 @@ WHERE datname = current_database() AND wait_event_type = 'Lock'

// TestAnMCPConnectorIsAnsweredAsBefore is the control for AI-3676: a custom MCP connector's
// create, and the refusals of its endpoint, answer as on 5a798ad5d, probed there with this
// request (AI-3676/base-probe.txt): the same keys and values, and the same messages.
// request (AI-3676/base-probe.txt): the same keys and values, and the same messages. The one
// change is AI-3871's sources.
func (s *ConnectorsSuite) TestAnMCPConnectorIsAnsweredAsBefore() {
id := s.customID()
status, raw := s.serverClient.call(http.MethodPost, "/v1/agents/connectors", s.customConnector(id))

s.Require().Equal(http.StatusOK, status)
var shown map[string]any
s.Require().NoError(json.Unmarshal(raw, &shown))
s.Equal([]string{"channel", "client", "created_at", "custom", "duration", "id", "inputs", "name", "revision", "schemes", "scopes"},
s.Equal([]string{"channel", "client", "created_at", "custom", "duration", "id", "inputs", "name", "revision", "schemes", "scopes", "sources"},
slices.Sorted(maps.Keys(shown)))
for _, key := range []string{"created_at", "duration"} {
delete(shown, key)
}
s.Equal(map[string]any{"channel": false, "client": map[string]any{"registration": []any{"dcr"}}, "custom": true, "id": id,
"inputs": []any{}, "name": "Our CRM", "revision": float64(1), "schemes": []any{"oauth2_code"}, "scopes": []any{}}, shown)
"inputs": []any{}, "name": "Our CRM", "revision": float64(1), "schemes": []any{"oauth2_code"}, "scopes": []any{},
"sources": []any{map[string]any{"kind": "mcp"}}}, shown)

for endpoint, message := range map[string]string{
"https://10.0.0.7/mcp": "endpoint must be a public https URL without userinfo, query or fragment",
Expand Down Expand Up @@ -950,7 +954,7 @@ func (s *ConnectorsSuite) TestACustomHTTPConnectorIsStoredAndItsAPIIsNeverShown(
status, raw := s.serverClient.call(http.MethodGet, path, nil)
s.Require().Equal(http.StatusOK, status)
s.Contains(string(raw), id, path)
for _, hidden := range []string{"8.8.8.8", "base_url", `"http"`, "/v1/forecast", "get_forecast"} {
for _, hidden := range []string{"8.8.8.8", "base_url", `"http":`, "/v1/forecast", "get_forecast"} {
s.NotContains(string(raw), hidden, path)
}
}
Expand Down Expand Up @@ -1175,6 +1179,47 @@ func (s *ConnectorsSuite) httpConnector(id string) map[string]any {
}
}

// TestAConnectorShowsItsSourceKindAndNoAddress is AC of AI-3871: an http custom connector reads
// sources [{kind: http}] and an MCP one [{kind: mcp}], in the create's answer, the read and
// the list, and none of them shows a URL, a path or a tool. A built-in shows its kind too.
func (s *ConnectorsSuite) TestAConnectorShowsItsSourceKindAndNoAddress() {
httpID, mcpID := s.customID(), s.customID()
created := map[string]string{}
for id, sent := range map[string]map[string]any{httpID: s.httpConnector(httpID), mcpID: s.customConnector(mcpID)} {
status, raw := s.serverClient.call(http.MethodPost, "/v1/agents/connectors", sent)
s.Require().Equal(http.StatusOK, status, string(raw))
created[id] = string(raw)
}
read := func(id string) string {
status, raw := s.serverClient.call(http.MethodGet, "/v1/agents/connectors/"+id, nil)
s.Require().Equal(http.StatusOK, status, string(raw))
return string(raw)
}
sourcesOf := func(raw string) any {
var shown map[string]any
s.Require().NoError(json.Unmarshal([]byte(raw), &shown), raw)
return shown["sources"]
}
httpKind, mcpKind := []any{map[string]any{"kind": "http"}}, []any{map[string]any{"kind": "mcp"}}

for id, want := range map[string][]any{httpID: httpKind, mcpID: mcpKind} {
s.Equal(want, sourcesOf(created[id]), "created "+id)
s.Equal(want, sourcesOf(read(id)), "read "+id)
for _, raw := range []string{created[id], read(id)} {
for _, address := range []string{"base_url", "endpoint", "8.8.8.8", "/v1/forecast", "get_forecast", "http_tools"} {
s.NotContains(raw, address, id)
}
}
}
listed := map[string][]ConnectorSource{}
for _, item := range s.list("").Items {
listed[item.ID] = item.Sources
}
s.Equal([]ConnectorSource{{Kind: "http"}}, listed[httpID])
s.Equal([]ConnectorSource{{Kind: "mcp"}}, listed[mcpID])
s.Equal([]ConnectorSource{{Kind: "mcp"}}, listed["slack"])
}

// customConnector is a custom MCP connector the router accepts. Its endpoint is a public IP
// literal, so checking it resolves nothing.
func (s *ConnectorsSuite) customConnector(id string) map[string]any {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@
from .connector_sandbox import ConnectorSandbox
from .connector_setup import ConnectorSetup
from .connector_setup_step import ConnectorSetupStep
from .connector_source import ConnectorSource
from .connector_source_kind import ConnectorSourceKind
from .connector_tool_grant import ConnectorToolGrant
from .contact import Contact
from .contact_attempt import ContactAttempt
Expand Down Expand Up @@ -891,6 +893,8 @@
"ConnectorSandbox",
"ConnectorSetup",
"ConnectorSetupStep",
"ConnectorSource",
"ConnectorSourceKind",
"ConnectorToolGrant",
"Contact",
"ContactAttempt",
Expand Down
Loading
Loading