Help us shape the future of Go! Take the 2026 Go Developer Survey

mcp

package
v0.91.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

README

mcp

Connector driver for external MCP (Model Context Protocol) servers. It lets Rill's AI agents discover and call tools on a remote server over streamable HTTP.

Files

  • mcp.go: driver registration, config validation, the handle with its per-credential session and tool caches, the OAuth configuration hash, and result flattening.
  • transport.go: the HTTP transport, including the dialer that refuses private addresses in hosted deployments and the round tripper that injects credentials and records authorization failures.

How it fits together

  • The parser (runtime/parser/parse_connector.go) validates the connector, lifts its security block into security rules on the connector spec, and leaves header templates unresolved because they may reference the requesting user.
  • The connector reconciler pings the server. Which tools a server exposes depends on the user, so the tool catalog is always listed per user by the AI layer.
  • The AI layer (runtime/ai/external_tools.go) discovers servers per session, applies the security policy through the security engine, compiles the tools for the agents, and resolves per-user OAuth tokens through the admin service.
  • The admin service (admin/server/connector_oauth.go) runs the browser-based authorization flow with runtime/pkg/oauthclient and stores each user's token. Per-user OAuth is therefore only available in Rill Cloud; Rill Developer lists such servers but cannot connect them.

Per-user data always travels in drivers.MCPCallOptions; the handle is shared by all users of an instance, holds no OAuth state, and keys its caches by the resolved credentials.

Documentation

Overview

Package mcp implements a connector driver for external MCP (Model Context Protocol) servers. It lets Rill's AI agents discover and call tools on a remote server over streamable HTTP.

The connector's transport properties (url, headers, timeouts) configure how to reach the server. Its presentation properties (display_name, ai_instructions) configure how agents are told about it. Who may use the server and which of its tools is decided by the connector's "security" block, which the parser turns into security rules on the connector spec and the AI layer evaluates per user.

Credentials are either project-scoped (static headers that may use {{ .env.* }} templating) or user-scoped (auth: oauth, where each user authorizes the server in their browser through Rill Cloud, which then supplies the user's access token on every request). Per-user data always travels in drivers.MCPCallOptions; the handle itself is shared by all users of an instance and holds no OAuth state.

Index

Constants

View Source
const AuthOAuth = "oauth"

AuthOAuth is the value of the "auth" property for servers that require a per-user OAuth authorization.

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL