mirror of
https://github.com/coder/coder.git
synced 2026-06-05 22:18:20 +00:00
e00e85765b
This PR merges code from `coder/aibridge` repository into `coder/coder`. It was split into 4 PRs for easier review but stacked PRs will need to be merged into this PR so all checks pass. * https://github.com/coder/coder/pull/24190 -> raw code copy (this PR, before merging PRs on top of it, it was just 1 commit: https://github.com/coder/coder/commit/70d33f33200c7e77df910957595715f81f9bec24) * https://github.com/coder/coder/pull/24570 -> update imports in `coder/coder` to use copied code * https://github.com/coder/coder/pull/24586 -> linter fixes and CI integration (also added README.md) * https://github.com/coder/coder/pull/24571 -> added exclude to scripts/check_emdash.sh check Original PR message (before PR squash): Moves coder/aibridge code into coder/coder repository. Omitted files: - `go.mod`, `go.sum`, `.gitignore`, `.github/workflows/ci.yml,` `Makefile`, `LICENSE`, `README.md` (modified README.md is added later) - `.github`, `example`, `buildinfo,` `scripts` directories Simple verification script (will list omitted files) ``` tmp=$(mktemp -d) echo "$tmp" git clone --depth=1 https://github.com/coder/aibridge "$tmp/aibridge" git clone --depth=1 --branch pb/aibridge-code-move https://github.com/coder/coder "$tmp/coder" diff -rq --exclude=.git "$tmp/aibridge" "$tmp/coder/aibridge" # rm -rf "$tmp" ```
27 lines
1003 B
Go
27 lines
1003 B
Go
package mcp
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/mark3labs/mcp-go/mcp"
|
|
)
|
|
|
|
// ServerProxier provides an abstraction to communicate with MCP Servers regardless of their transport.
|
|
// The ServerProxier is expected to, at least, fetch any available MCP tools.
|
|
type ServerProxier interface {
|
|
// Init initializes the proxier, establishing a connection with the upstream server and fetching resources.
|
|
Init(context.Context) error
|
|
// Gracefully shut down connections to the MCP server. Session management will vary per transport.
|
|
// See https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#session-management.
|
|
Shutdown(ctx context.Context) error
|
|
|
|
// ListTools lists all known tools. These MUST be sorted in a stable order.
|
|
ListTools() []*Tool
|
|
// GetTool returns a given tool, if known, or returns nil.
|
|
GetTool(id string) *Tool
|
|
// CallTool invokes an injected MCP tool
|
|
CallTool(ctx context.Context, name string, input any) (*mcp.CallToolResult, error)
|
|
}
|
|
|
|
// TODO: support HTTP+SSE.
|