refactor: use canonical implementations and types directly
Remove forwarding wrappers and shadow aliases, migrate callers and verification scripts to their owners, and share one exhaustive semantic resource-bound projection.
This commit is contained in:
@@ -14,15 +14,12 @@ import {
|
||||
MCP_CONNECTION_START_FAILED,
|
||||
} from "./messages.js";
|
||||
|
||||
/** Optional adapters whose absence must not prevent the core MCP server. */
|
||||
export type OptionalProviders = OptionalProviderLoadResult;
|
||||
|
||||
interface ServerContext {
|
||||
readonly environment: Readonly<NodeJS.ProcessEnv>;
|
||||
readonly delivery: ToolResultDelivery;
|
||||
readonly logger: Logger;
|
||||
readonly serverLogger: Logger;
|
||||
readonly loadOptionalProviders: () => Promise<OptionalProviders>;
|
||||
readonly loadOptionalProviders: () => Promise<OptionalProviderLoadResult>;
|
||||
}
|
||||
|
||||
export const startMcpTransport = async (
|
||||
@@ -38,7 +35,7 @@ export const startMcpTransport = async (
|
||||
| { readonly ok: false }
|
||||
> => {
|
||||
const { serverLogger } = serverContext;
|
||||
let optionalProviders: OptionalProviders = {};
|
||||
let optionalProviders: OptionalProviderLoadResult = {};
|
||||
try {
|
||||
optionalProviders = await serverContext.loadOptionalProviders();
|
||||
} catch (cause: unknown) {
|
||||
|
||||
+3
-3
@@ -1,3 +1,5 @@
|
||||
import type { OptionalProviderLoadResult } from "../application/OptionalObservationProviders.js";
|
||||
|
||||
export interface RuntimeDependencies {
|
||||
readonly env: NodeJS.ProcessEnv;
|
||||
readonly serve: typeof import("@modelcontextprotocol/server/stdio").serveStdio;
|
||||
@@ -5,7 +7,5 @@ export interface RuntimeDependencies {
|
||||
readonly setExitCode: (code: number) => void;
|
||||
readonly registerShutdown: (handler: () => void) => () => void;
|
||||
readonly createServer?: typeof import("../server/createServer.js").createServer;
|
||||
readonly loadOptionalProviders?: () => Promise<
|
||||
import("./transport.js").OptionalProviders
|
||||
>;
|
||||
readonly loadOptionalProviders?: () => Promise<OptionalProviderLoadResult>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user