ApolloMcpServer class final

An MCP server exposing ApolloVM as agent tools over a StreamChannel.

Built on the official dart_mcp SDK: it speaks MCP (initialize / tools/list / tools/call) over any newline-delimited StreamChannel — a stdio channel for local use, or the HTTP/SSE channel adapter for networked use. Each tool runs either in-process or (per McpLimits.isolateTools) inside a killable isolate for a hard timeout.

When a RepositoryAdapter is supplied, the server additionally exposes the workspace/repository tools (apollovm.fs.*, apollovm.search.*, apollovm.code.*, apollovm.git.*), letting an agent read, search, navigate and version-control real files instead of shelling out to POSIX. Wrap the adapter in a PermissionGuard to enforce a RepoConfig (read-only by default). With no adapter, the server stays inline-source-only.

Constructors

ApolloMcpServer(StreamChannel<String> channel, {McpLimits limits = const McpLimits(), bool nullSafetyChecks = false, RepositoryAdapter? repository, RepoConfig repoConfig = const RepoConfig()})

Properties

clientCapabilities ↔ ClientCapabilities
The capabilities of the client.
getter/setter pairinherited
clientInfo ↔ Implementation
The client implementation information provided during initialization.
getter/setter pairinherited
done → Future<void>
Completes after shutdown is called.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
implementation → Implementation
The name, current version, and other info to give to the client.
finalinherited
initialized → Future<InitializedNotification?>
Completes when this server has finished initialization and gotten the final ack from the client.
no setterinherited
instructions → String?
Instructions for how to use this server, which are given to the client.
finalinherited
isActive → bool
Whether the connection with the peer is active.
no setterinherited
limits → McpLimits
final
name → String
The name of the associated server.
no setterinherited
nullSafetyChecks → bool
Server-wide default for the tools' nullSafety argument (the --null-safety flag). A per-call argument always overrides it.
final
protocolVersion ↔ ProtocolVersion
The negotiated protocol version.
getter/setter pairinherited
ready → bool
Whether this server is still active and has completed initialization.
no setterinherited
rootsListChanged → Stream<RootsListChangedNotification?>?
Emits an event any time the client notifies us of a change to the list of roots it supports.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

callTool(CallToolRequest request) → Future<CallToolResult>
Invoked when one of the registered tools is called.
inherited
createMessage(CreateMessageRequest request) → Future<CreateMessageResult>
A request to prompt the LLM owned by the client with a message.
inherited
handleInitialized([InitializedNotification? notification]) → void
Called by the client after accepting our InitializeResult.
inherited
initialize(InitializeRequest request) → FutureOr<InitializeResult>
Invoked by the client as a part of initialization.
inherited
listRoots([ListRootsRequest? request]) → Future<ListRootsResult>
Lists all the root URIs from the client.
inherited
listTools([ListToolsRequest? request]) → FutureOr<ListToolsResult>
Returns the list of supported tools for this server.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyProgress(ProgressNotification notification) → void
Notifies the peer of progress towards completing some request.
inherited
onProgress(Request request) → Stream<ProgressNotification>
A stream of progress notifications for a given request.
inherited
ping({Duration timeout = const Duration(seconds: 1), PingRequest? request}) → Future<bool>
Pings the peer, and returns whether or not it responded within timeout.
inherited
registerNotificationHandler<T extends Notification?>(String name, void impl(T)) → void
Registers a notification handler named name on this server.
inherited
registerRequestHandler<T extends Request?, R extends Result?>(String name, FutureOr<R> impl(T)) → void
Registers a handler for the method name on this server.
inherited
registerTool(Tool tool, FutureOr<CallToolResult> impl(CallToolRequest), {bool validateArguments = true}) → void
Register tool to call impl when invoked.
inherited
sendNotification(String method, [Notification? notification]) → void
Sends a notification to the peer.
inherited
sendRequest<T extends Result?>(String methodName, [Request? request]) → Future<T>
Sends request to the peer, and handles coercing the response to the type T.
inherited
shutdown() → Future<void>
Handles cleanup of all streams and other resources on shutdown.
inherited
toString() → String
A string representation of this object.
inherited
unregisterTool(String name) → void
Un-registers a Tool by name.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited