Documentation
¶
Index ¶
- Variables
- func NewServer() *sdkmcp.Server
- func NewServerWithIndexer(indexer indexing.ProjectIndexer) *sdkmcp.Server
- func NewServerWithMetrics(registry *metrics.Registry) *sdkmcp.Server
- func NewServerWithMetricsAndSnapshotStore(registry *metrics.Registry, snapshotStore *hotsnapshot.SnapshotStore) *sdkmcp.Server
- func NewServerWithMetricsAndSnapshotStoreAndIndexer(registry *metrics.Registry, snapshotStore *hotsnapshot.SnapshotStore, ...) *sdkmcp.Server
- func NewServerWithObserver(observer tools.Observer) *sdkmcp.Server
- func NewServerWithObserverAndMetrics(observer tools.Observer, registry *metrics.Registry) *sdkmcp.Server
- func NewServerWithObserverAndMetricsAndSnapshotStore(observer tools.Observer, registry *metrics.Registry, ...) *sdkmcp.Server
- func NewServerWithObserverAndSnapshotStore(observer tools.Observer, snapshotStore *hotsnapshot.SnapshotStore) *sdkmcp.Server
- func NewServerWithSnapshotStore(snapshotStore *hotsnapshot.SnapshotStore) *sdkmcp.Server
- func NewServerWithSnapshotStoreAndIndexer(snapshotStore *hotsnapshot.SnapshotStore, indexer indexing.ProjectIndexer) *sdkmcp.Server
- func Run(ctx context.Context) error
- func RunWithMetrics(ctx context.Context, registry *metrics.Registry) error
- func RunWithMetricsAndSnapshotStore(ctx context.Context, registry *metrics.Registry, ...) error
- func RunWithMetricsAndSnapshotStoreAndIndexer(ctx context.Context, registry *metrics.Registry, ...) error
- func RunWithSnapshotStore(ctx context.Context, snapshotStore *hotsnapshot.SnapshotStore) error
- func RunWithSnapshotStoreAndIndexer(ctx context.Context, snapshotStore *hotsnapshot.SnapshotStore, ...) error
- type StreamTransport
Constants ¶
This section is empty.
Variables ¶
var ErrNoStream = errors.New("mcp: transport has no stream")
ErrNoStream is returned by a StreamTransport with nothing to talk over.
Functions ¶
func NewServerWithIndexer ¶
func NewServerWithIndexer(indexer indexing.ProjectIndexer) *sdkmcp.Server
NewServerWithIndexer creates a server that also exposes the explicit permission-gated index_project mutation.
func NewServerWithMetrics ¶
NewServerWithMetrics creates the server without a graph source and records query metrics in registry.
func NewServerWithMetricsAndSnapshotStore ¶
func NewServerWithMetricsAndSnapshotStore(registry *metrics.Registry, snapshotStore *hotsnapshot.SnapshotStore) *sdkmcp.Server
NewServerWithMetricsAndSnapshotStore creates the snapshot-backed server and records query metrics in registry.
func NewServerWithMetricsAndSnapshotStoreAndIndexer ¶
func NewServerWithMetricsAndSnapshotStoreAndIndexer( registry *metrics.Registry, snapshotStore *hotsnapshot.SnapshotStore, indexer indexing.ProjectIndexer, ) *sdkmcp.Server
NewServerWithMetricsAndSnapshotStoreAndIndexer combines query metrics with the configured project indexer.
func NewServerWithObserver ¶
NewServerWithObserver creates the server without a graph source and observes tool-handler latency.
func NewServerWithObserverAndMetrics ¶
func NewServerWithObserverAndMetrics(observer tools.Observer, registry *metrics.Registry) *sdkmcp.Server
NewServerWithObserverAndMetrics creates the server without a graph source, observing latency and recording query metrics in registry.
func NewServerWithObserverAndMetricsAndSnapshotStore ¶
func NewServerWithObserverAndMetricsAndSnapshotStore( observer tools.Observer, registry *metrics.Registry, snapshotStore *hotsnapshot.SnapshotStore, ) *sdkmcp.Server
NewServerWithObserverAndMetricsAndSnapshotStore combines the legacy latency observer with the process-local metrics registry.
func NewServerWithObserverAndSnapshotStore ¶
func NewServerWithObserverAndSnapshotStore(observer tools.Observer, snapshotStore *hotsnapshot.SnapshotStore) *sdkmcp.Server
NewServerWithObserverAndSnapshotStore creates the snapshot-backed server and observes tool-handler latency.
func NewServerWithSnapshotStore ¶
func NewServerWithSnapshotStore(snapshotStore *hotsnapshot.SnapshotStore) *sdkmcp.Server
NewServerWithSnapshotStore creates the server backed by the published immutable HotSnapshot.
func NewServerWithSnapshotStoreAndIndexer ¶
func NewServerWithSnapshotStoreAndIndexer( snapshotStore *hotsnapshot.SnapshotStore, indexer indexing.ProjectIndexer, ) *sdkmcp.Server
NewServerWithSnapshotStoreAndIndexer creates the configured server backed by the published snapshot and an authorized project indexer.
func Run ¶
Run serves one MCP session over the process stdin/stdout transport with a process-local metrics registry available to graph_status.
func RunWithMetrics ¶
RunWithMetrics serves one MCP session with the caller-owned metrics registry.
func RunWithMetricsAndSnapshotStore ¶
func RunWithMetricsAndSnapshotStore( ctx context.Context, registry *metrics.Registry, snapshotStore *hotsnapshot.SnapshotStore, ) error
RunWithMetricsAndSnapshotStore serves one MCP session with caller-owned metrics and the immutable graph source.
func RunWithMetricsAndSnapshotStoreAndIndexer ¶
func RunWithMetricsAndSnapshotStoreAndIndexer( ctx context.Context, registry *metrics.Registry, snapshotStore *hotsnapshot.SnapshotStore, indexer indexing.ProjectIndexer, ) error
RunWithMetricsAndSnapshotStoreAndIndexer serves one MCP session with caller-owned metrics, the immutable graph source, and an authorized project indexer.
func RunWithSnapshotStore ¶
func RunWithSnapshotStore(ctx context.Context, snapshotStore *hotsnapshot.SnapshotStore) error
RunWithSnapshotStore serves one MCP session using snapshotStore as the immutable graph source for query tools and a fresh metrics registry.
func RunWithSnapshotStoreAndIndexer ¶
func RunWithSnapshotStoreAndIndexer( ctx context.Context, snapshotStore *hotsnapshot.SnapshotStore, indexer indexing.ProjectIndexer, ) error
RunWithSnapshotStoreAndIndexer serves the configured MCP surface, including the permission-gated index_project tool.
Types ¶
type StreamTransport ¶ added in v0.6.0
type StreamTransport struct {
Stream io.ReadWriteCloser
}
StreamTransport serves one MCP session over a byte stream.
The SDK ships a transport for stdin/stdout and one for an in-memory pipe, and the stdio one hardcodes the process's own handles. A daemon accepting connections needs neither: it has a net.Conn per client and one server behind them, which is the whole point -- one mapped snapshot instead of one per client. The wire is the same newline-delimited JSON either way, so what is new here is only where the bytes come from.
The stream must unblock a pending Read when it is closed, because that is how the SDK cancels a session. A net.Conn does; os.Stdin does not, which is why the SDK's own stdio connection carries a reader goroutine and a channel that this one does not need.
func (*StreamTransport) Connect ¶ added in v0.6.0
func (transport *StreamTransport) Connect(context.Context) (sdkmcp.Connection, error)
Connect implements the sdkmcp.Transport interface.