@githits/mcp 0.10.1 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,17 +4,97 @@ Reusable MCP server APIs and tool registrations for GitHits.
4
4
 
5
5
  This package exposes transport-neutral helpers for servers that want the GitHits MCP tool surface without the local `githits` CLI startup, auth storage, or Commander wiring.
6
6
 
7
+ > **Browser boundary:** only the selected `@githits/mcp/tools` resolved runtime
8
+ > graph is browser-safe. Installing `@githits/mcp` still installs its MCP SDK
9
+ > and other Node-oriented dependencies; the package root and
10
+ > `@githits/mcp/client` remain Node entries. The `/tools` entry does not provide
11
+ > filesystem access, authentication implementation or storage, configuration
12
+ > discovery, or any other host behavior.
13
+
7
14
  ## API
8
15
 
9
16
  - `createMcpServer(options)` creates an MCP server with GitHits tools registered.
10
17
  - `registerMcpTools(server, options)` registers GitHits tools on an existing MCP server.
11
18
  - `getMcpToolDescriptors()` returns static tool metadata without requiring concrete services.
12
- - `buildMcpInstructions(options?)` builds the GitHits MCP instruction block.
13
- - `@githits/mcp/client` exports concrete GitHits service implementations, static token providers, URL/config helpers, request-header helpers, telemetry helpers, and registry helpers for remote MCP servers.
19
+ - `buildMcpQuickStart(options?)` builds the guide returned by the read-only `quick_start` tool.
20
+ - `buildMcpInstructions(options?)` is a deprecated compatibility alias for `buildMcpQuickStart()`.
21
+ - `@githits/mcp/client` exports concrete GitHits service implementations, static token providers, URL/config helpers, request-header helpers, the `ServiceDiagnostics` type, and registry helpers for remote MCP servers. Service clients are silent by default; hosts that need operation spans or debug events inject a `ServiceDiagnostics` implementation through their runtime options. Hosts must explicitly opt into sensitive diagnostic areas and own the resulting privacy and retention policy.
22
+ - The former module-global telemetry lifecycle helpers (`startTelemetrySpan`, `endTelemetrySpan`, `flushTelemetry`, and `withTelemetrySpan`) are not exported from `@githits/mcp/client`. Remote hosts own diagnostics lifecycle and destinations through injection.
14
23
  - `@githits/mcp/smoke-test` exports reusable smoke assertions and `runMcpSmoke()` for remote MCP server validation.
24
+ - `@githits/mcp/tools` exports the browser-callable `get_example` factory and
25
+ its structural service contract, plus `toCallableTool()` and the stable
26
+ callable result/schema types. It also exports the neutral
27
+ `AuthenticationError`, `ApiRateLimitError`, `FetchTimeoutError`, and
28
+ `TermsAcceptanceRequiredError` constructors used by the callable error
29
+ boundary.
30
+
31
+ ## Browser-callable `@githits/mcp/tools`
32
+
33
+ The `/tools` entry is a small frontend-facing surface. Inject a service with
34
+ only the `search(params, options?)` method, create the existing `get_example`
35
+ definition, and adapt it to a plain callable object:
36
+
37
+ ```ts
38
+ import {
39
+ createGetExampleTool,
40
+ toCallableTool,
41
+ type GetExampleRequestOptions,
42
+ type GetExampleSearchParams,
43
+ type GetExampleService,
44
+ } from "@githits/mcp/tools";
45
+
46
+ // Supplied by the application; it owns transport, authentication, and CORS.
47
+ declare function searchExamples(
48
+ params: GetExampleSearchParams,
49
+ options?: GetExampleRequestOptions,
50
+ ): Promise<string>;
51
+
52
+ const service: GetExampleService = {
53
+ search: (params, options) => searchExamples(params, options),
54
+ };
55
+
56
+ const tool = toCallableTool(createGetExampleTool(service));
57
+ ```
58
+
59
+ `toCallableTool()` wraps the tool's Zod object schema, emits input-mode JSON
60
+ Schema, and validates/defaults input before calling the service. The omitted
61
+ `format` field remains optional in the schema and defaults to `"text-v1"`.
62
+ Unknown object properties follow the normal Zod object behavior. Successful
63
+ and structured error results are returned as the serializable `ToolResult`
64
+ shape. If the caller supplies an `AbortSignal`, it is forwarded unchanged to
65
+ the service; caller cancellation rejects the execution rather than becoming an
66
+ error result.
67
+
68
+ An injected browser service should throw one of the exported neutral error
69
+ constructors when it wants `get_example` to return a structured
70
+ `AUTH_REQUIRED`, `RATE_LIMITED`, `TIMEOUT`, or `TERMS_ACCEPTANCE_REQUIRED`
71
+ `ToolResult`. This is an explicit thrown-error contract, not automatic HTTP
72
+ response classification. Callable authentication remediation is host-neutral:
73
+ `Authenticate with GitHits, then retry.` Terms errors use the canonical
74
+ `acceptanceUrl` action. Other errors remain `UNKNOWN`.
75
+
76
+ A frontend can add a small registration adapter for its WebMCP host API. The
77
+ adapter owns the host-specific registration call and passes its signal through;
78
+ the callable surface is not a generic protocol-conversion layer:
79
+
80
+ ```ts
81
+ document.modelContext.registerTool({
82
+ name: tool.name,
83
+ description: tool.description,
84
+ inputSchema: tool.inputSchema,
85
+ annotations: tool.annotations,
86
+ execute: (input, options) =>
87
+ tool.execute(input, { signal: options?.signal }),
88
+ });
89
+ ```
90
+
91
+ The frontend owns `document.modelContext`, authentication and login UI, its
92
+ response-to-error conversion, request transport, CORS policy, and any
93
+ user-facing recovery. The injected service decides how the app-owned backend
94
+ boundary is authenticated and reached.
15
95
 
16
- The package expects callers to provide service implementations through `McpToolServices` or a request-scoped `McpToolServicesProvider`. Servers can pass `traceTool` to `createMcpServer()` or `registerMcpTools()` to wrap public tool execution for instrumentation without receiving arguments or auth data.
96
+ The package expects callers to provide service implementations through `McpToolServices` or a request-scoped `McpToolServicesProvider`. GitHits does not populate MCP initialize instructions because hosts expose them inconsistently; `quick_start` owns shared guidance instead. Callers may still pass their own `instructions` explicitly. Use `quickStartOptions` to configure the guide. Servers can pass `traceTool` to `createMcpServer()` or `registerMcpTools()` to wrap public tool execution for instrumentation without receiving arguments or auth data.
17
97
 
18
- Only imports from `@githits/mcp`, `@githits/mcp/client`, `@githits/mcp/smoke-test`, and `@githits/mcp/package.json` are public. The workspace alias `@githits/mcp/internal` is not exported, is not supported for external consumers, and must not be used by remote MCP server implementations.
98
+ Only imports from `@githits/mcp`, `@githits/mcp/client`, `@githits/mcp/smoke-test`, `@githits/mcp/tools`, and `@githits/mcp/package.json` are public. The workspace alias `@githits/mcp/internal` is not exported, is not supported for external consumers, and must not be used by remote MCP server implementations.
19
99
 
20
100
  Remote MCP servers should provide request-scoped services through `createMcpServer()` and keep transport, auth/session handling, deployment config, and observability outside this package.
package/dist/client.d.ts CHANGED
@@ -61,6 +61,28 @@ interface CreateClientHeaderBuilderOptions {
61
61
  * relying on module-level CLI state.
62
62
  */
63
63
  declare function createClientHeaderBuilder(options: CreateClientHeaderBuilderOptions): ClientHeaderBuilder;
64
+ /**
65
+ * Host-supplied diagnostics for transport-neutral service clients.
66
+ *
67
+ * Implementations may record operation timings or debug events in whatever
68
+ * way is appropriate for their host. Core does not provide a default and
69
+ * remains silent when diagnostics are omitted. Core callers gate every debug
70
+ * event through `isEnabled(area)`; when it returns `false`, the corresponding
71
+ * debug call is suppressed entirely. Returning `true` is therefore both a log
72
+ * filter and a content-disclosure decision for the host.
73
+ *
74
+ * In particular, the `code-nav-wire` area may carry the exact GraphQL document
75
+ * and request variables, including caller query text, so it requires separate
76
+ * explicit opt-in. The `code-nav` and `pkg-graphql` schema-mismatch paths may
77
+ * carry raw backend error text, and an enabled area may select that raw error
78
+ * content instead of the sanitized message. These areas are not PII-safe;
79
+ * hosts own their privacy and retention policy for any enabled diagnostics.
80
+ */
81
+ interface ServiceDiagnostics {
82
+ withOperation<T>(name: string, operation: () => Promise<T>): Promise<T>;
83
+ isEnabled(area: string): boolean;
84
+ debug(area: string, event: Record<string, unknown>): void;
85
+ }
64
86
  interface TokenProvider {
65
87
  /** Get a valid token, refreshing proactively or reactively as needed. */
66
88
  getToken(): Promise<string | undefined>;
@@ -637,6 +659,7 @@ declare class CodeNavigationServiceImpl implements CodeNavigationService, CodeDi
637
659
  clientHeaders?: ClientHeaderBuilder;
638
660
  userAgent?: string;
639
661
  clientVersion?: string;
662
+ diagnostics?: ServiceDiagnostics;
640
663
  });
641
664
  private postGraphqlWithTargetResolutionFallback;
642
665
  search(params: UnifiedSearchParams): Promise<UnifiedSearchOutcome>;
@@ -717,6 +740,10 @@ interface SearchParams {
717
740
  licenseMode?: "strict" | "yolo" | "custom";
718
741
  includeExplanation?: boolean;
719
742
  }
743
+ /** Optional browser-standard controls for a GitHits service request. */
744
+ interface GitHitsServiceRequestOptions {
745
+ signal?: AbortSignal;
746
+ }
720
747
  /**
721
748
  * Parameters for feedback API call.
722
749
  *
@@ -743,13 +770,14 @@ interface GitHitsServiceRuntimeOptions {
743
770
  clientHeaders?: ClientHeaderBuilder;
744
771
  userAgent?: string;
745
772
  exampleRequestTimeoutMs?: number;
773
+ diagnostics?: ServiceDiagnostics;
746
774
  }
747
775
  /**
748
776
  * Service interface for GitHits REST API.
749
777
  */
750
778
  interface GitHitsService {
751
779
  /** Search for code examples. Returns markdown-formatted result. */
752
- search(params: SearchParams): Promise<string>;
780
+ search(params: SearchParams, options?: GitHitsServiceRequestOptions): Promise<string>;
753
781
  /** Get all supported languages. */
754
782
  getLanguages(): Promise<Language[]>;
755
783
  /** Search supported languages using backend-ranked matching. */
@@ -767,7 +795,7 @@ declare class GitHitsServiceImpl implements GitHitsService {
767
795
  private readonly fetchTimeoutMs;
768
796
  private readonly runtime;
769
797
  constructor(apiUrl: string, token: string, fetchFn?: typeof fetch | undefined, fetchTimeoutMs?: number | undefined, runtime?: GitHitsServiceRuntimeOptions);
770
- search(params: SearchParams): Promise<string>;
798
+ search(params: SearchParams, options?: GitHitsServiceRequestOptions): Promise<string>;
771
799
  getLanguages(): Promise<Language[]>;
772
800
  searchLanguages(query: string, limit?: number): Promise<Language[]>;
773
801
  submitFeedback(params: FeedbackParams): Promise<FeedbackResult>;
@@ -1285,8 +1313,8 @@ interface PackageChangelogParams {
1285
1313
  /** Branch or tag for CHANGELOG.md fetching. Ignored for GH Releases. */
1286
1314
  gitRef?: string;
1287
1315
  /**
1288
- * Start of version range. When set, the backend returns every entry
1289
- * between `fromVersion` and `toVersion` (or latest); `limit` is
1316
+ * Exclusive start of version range. When set, the backend returns every
1317
+ * entry after `fromVersion` through `toVersion` (or latest); `limit` is
1290
1318
  * rejected client-side in this mode.
1291
1319
  */
1292
1320
  fromVersion?: string;
@@ -1323,7 +1351,7 @@ interface ChangelogReport {
1323
1351
  package?: ChangelogPackageInfo;
1324
1352
  /** `"releases"` | `"changelog_file"` | `"hexdocs"` when resolved; absent for package versions with no changelog entry. */
1325
1353
  source?: string;
1326
- /** Entries, newest-first. Empty array = resolved source but nothing in range. */
1354
+ /** Entries in backend/source order. Empty array = resolved source but nothing in range. */
1327
1355
  entries: ChangelogEntryDetail[];
1328
1356
  }
1329
1357
  type PackageDocSourceKind = "CRAWLED" | "REPOSITORY";
@@ -1410,6 +1438,7 @@ declare class PackageIntelligenceServiceImpl implements PackageIntelligenceServi
1410
1438
  clientHeaders?: ClientHeaderBuilder;
1411
1439
  userAgent?: string;
1412
1440
  clientVersion?: string;
1441
+ diagnostics?: ServiceDiagnostics;
1413
1442
  });
1414
1443
  packageSummary(params: PackageSummaryParams): Promise<PackageSummary>;
1415
1444
  private executePackageSummary;
@@ -1456,7 +1485,7 @@ declare class RefreshingGitHitsService implements GitHitsService {
1456
1485
  private readonly serviceFactory;
1457
1486
  private readonly runtime;
1458
1487
  constructor(apiUrl: string, tokenProvider: TokenProvider, serviceFactory?: ServiceFactory | undefined, runtime?: GitHitsServiceRuntimeOptions);
1459
- search(params: SearchParams): Promise<string>;
1488
+ search(params: SearchParams, options?: GitHitsServiceRequestOptions): Promise<string>;
1460
1489
  getLanguages(): Promise<Language[]>;
1461
1490
  searchLanguages(query: string, limit?: number): Promise<Language[]>;
1462
1491
  submitFeedback(params: FeedbackParams): Promise<FeedbackResult>;
@@ -1466,15 +1495,4 @@ declare class RefreshingGitHitsService implements GitHitsService {
1466
1495
  */
1467
1496
  private withTokenRefresh;
1468
1497
  }
1469
- type TelemetryAttributeValue = string | number | boolean;
1470
- interface TelemetryAttributes {
1471
- [key: string]: TelemetryAttributeValue | undefined;
1472
- }
1473
- interface TelemetrySpanHandle {
1474
- id: number;
1475
- }
1476
- declare function withTelemetrySpan<T>(name: string, operation: () => Promise<T>, attributes?: TelemetryAttributes): Promise<T>;
1477
- declare function startTelemetrySpan(name: string, attributes?: TelemetryAttributes): TelemetrySpanHandle | undefined;
1478
- declare function endTelemetrySpan(handle: TelemetrySpanHandle | undefined, attributes?: TelemetryAttributes): void;
1479
- declare function flushTelemetry(exitCode?: number): void;
1480
- export { AgentInfo, CodeDiffError, CodeDiffErrorDetails, CodeDiffErrorRef, CodeDiffMode, CodeDiffOptions, CodeDiffPackageInfo, CodeDiffPackageTarget, CodeDiffParams, CodeDiffPartialResult, CodeDiffRefKind, CodeDiffRefResolution, CodeDiffRepositoryTarget, CodeDiffResult, CodeDiffService, CodeDiffTarget, CodeDiffVersionSource, CodeNavigationService, CodeNavigationServiceImpl, ContentModification, ContentSafety, DEFAULT_API_URL, DEFAULT_CODE_NAV_URL, DEFAULT_MCP_URL, GitHitsService, GitHitsServiceImpl, PKGSEER_REGISTRY_LIST, PackageIntelligenceService, PackageIntelligenceServiceImpl, RawCodeDiff, RawCodeDiffContentCoverage, RawCodeDiffContentFailure, RawCodeDiffFile, RawCodeDiffFileContentStatus, RawCodeDiffFileStatus, RawCodeDiffPathEncoding, RawCodeDiffScope, RawCodeDiffScopeStatus, RawCodeDiffSummary, RefreshingGitHitsService, TokenProvider, createClientHeaderBuilder, createStaticTokenProvider, endTelemetrySpan, flushTelemetry, getApiUrl, getCodeNavigationUrl, getEnvApiToken, getMcpUrl, startTelemetrySpan, toPkgseerRegistry, toPkgseerRegistryLowercase, withTelemetrySpan };
1498
+ export { AgentInfo, CodeDiffError, CodeDiffErrorDetails, CodeDiffErrorRef, CodeDiffMode, CodeDiffOptions, CodeDiffPackageInfo, CodeDiffPackageTarget, CodeDiffParams, CodeDiffPartialResult, CodeDiffRefKind, CodeDiffRefResolution, CodeDiffRepositoryTarget, CodeDiffResult, CodeDiffService, CodeDiffTarget, CodeDiffVersionSource, CodeNavigationService, CodeNavigationServiceImpl, ContentModification, ContentSafety, DEFAULT_API_URL, DEFAULT_CODE_NAV_URL, DEFAULT_MCP_URL, GitHitsService, GitHitsServiceImpl, PKGSEER_REGISTRY_LIST, PackageIntelligenceService, PackageIntelligenceServiceImpl, RawCodeDiff, RawCodeDiffContentCoverage, RawCodeDiffContentFailure, RawCodeDiffFile, RawCodeDiffFileContentStatus, RawCodeDiffFileStatus, RawCodeDiffPathEncoding, RawCodeDiffScope, RawCodeDiffScopeStatus, RawCodeDiffSummary, RefreshingGitHitsService, ServiceDiagnostics, TokenProvider, createClientHeaderBuilder, createStaticTokenProvider, getApiUrl, getCodeNavigationUrl, getEnvApiToken, getMcpUrl, toPkgseerRegistry, toPkgseerRegistryLowercase };
package/dist/client.js CHANGED
@@ -1 +1 @@
1
- import{CodeDiffError,CodeNavigationServiceImpl,DEFAULT_API_URL,DEFAULT_CODE_NAV_URL,DEFAULT_MCP_URL,GitHitsServiceImpl,PKGSEER_REGISTRY_LIST,PackageIntelligenceServiceImpl,RefreshingGitHitsService,createClientHeaderBuilder,createStaticTokenProvider,endTelemetrySpan,flushTelemetry,getApiUrl,getCodeNavigationUrl,getEnvApiToken,getMcpUrl,startTelemetrySpan,toPkgseerRegistry,toPkgseerRegistryLowercase,withTelemetrySpan}from"./shared/chunk-nxdqknc9.js";export{CodeDiffError,CodeNavigationServiceImpl,DEFAULT_API_URL,DEFAULT_CODE_NAV_URL,DEFAULT_MCP_URL,GitHitsServiceImpl,PKGSEER_REGISTRY_LIST,PackageIntelligenceServiceImpl,RefreshingGitHitsService,createClientHeaderBuilder,createStaticTokenProvider,endTelemetrySpan,flushTelemetry,getApiUrl,getCodeNavigationUrl,getEnvApiToken,getMcpUrl,startTelemetrySpan,toPkgseerRegistry,toPkgseerRegistryLowercase,withTelemetrySpan};
1
+ import{CodeDiffError,CodeNavigationServiceImpl,DEFAULT_API_URL,DEFAULT_CODE_NAV_URL,DEFAULT_MCP_URL,GitHitsServiceImpl,PKGSEER_REGISTRY_LIST,PackageIntelligenceServiceImpl,RefreshingGitHitsService,createClientHeaderBuilder,createStaticTokenProvider,getApiUrl,getCodeNavigationUrl,getEnvApiToken,getMcpUrl,toPkgseerRegistry,toPkgseerRegistryLowercase}from"./shared/chunk-mjxp4hpz.js";import"./shared/chunk-51x6tx02.js";export{CodeDiffError,CodeNavigationServiceImpl,DEFAULT_API_URL,DEFAULT_CODE_NAV_URL,DEFAULT_MCP_URL,GitHitsServiceImpl,PKGSEER_REGISTRY_LIST,PackageIntelligenceServiceImpl,RefreshingGitHitsService,createClientHeaderBuilder,createStaticTokenProvider,getApiUrl,getCodeNavigationUrl,getEnvApiToken,getMcpUrl,toPkgseerRegistry,toPkgseerRegistryLowercase};
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * Build the server-level instructions string for the current session.
2
+ * Build the detailed guide returned by `quick_start`.
3
3
  *
4
4
  * Emits the core block plus the package/code-tools section.
5
5
  * Mirrors `getMcpToolDefinitions` so the instructions stay aligned
6
6
  * with the registered tool surface.
7
7
  */
8
- interface BuildMcpInstructionsOptions {
8
+ interface BuildMcpQuickStartOptions {
9
9
  /**
10
10
  * Include the external-content posture (shared guardrail block).
11
11
  * Defaults to `true` — production always wants it. The eval mock
@@ -14,6 +14,13 @@ interface BuildMcpInstructionsOptions {
14
14
  */
15
15
  includeExternalContentPosture?: boolean;
16
16
  }
17
+ /** @deprecated Use `BuildMcpQuickStartOptions`; retained for API compatibility. */
18
+ type BuildMcpInstructionsOptions = BuildMcpQuickStartOptions;
19
+ declare function buildMcpQuickStart(options?: BuildMcpQuickStartOptions): string;
20
+ /**
21
+ * @deprecated Use `buildMcpQuickStart`. GitHits no longer publishes MCP
22
+ * initialize instructions because clients expose them inconsistently.
23
+ */
17
24
  declare function buildMcpInstructions(options?: BuildMcpInstructionsOptions): string;
18
25
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
19
26
  declare const registryMap: {
@@ -444,6 +451,10 @@ interface SearchParams {
444
451
  licenseMode?: "strict" | "yolo" | "custom";
445
452
  includeExplanation?: boolean;
446
453
  }
454
+ /** Optional browser-standard controls for a GitHits service request. */
455
+ interface GitHitsServiceRequestOptions {
456
+ signal?: AbortSignal;
457
+ }
447
458
  /**
448
459
  * Parameters for feedback API call.
449
460
  *
@@ -471,7 +482,7 @@ interface FeedbackResult {
471
482
  */
472
483
  interface GitHitsService {
473
484
  /** Search for code examples. Returns markdown-formatted result. */
474
- search(params: SearchParams): Promise<string>;
485
+ search(params: SearchParams, options?: GitHitsServiceRequestOptions): Promise<string>;
475
486
  /** Get all supported languages. */
476
487
  getLanguages(): Promise<Language[]>;
477
488
  /** Search supported languages using backend-ranked matching. */
@@ -987,8 +998,8 @@ interface PackageChangelogParams {
987
998
  /** Branch or tag for CHANGELOG.md fetching. Ignored for GH Releases. */
988
999
  gitRef?: string;
989
1000
  /**
990
- * Start of version range. When set, the backend returns every entry
991
- * between `fromVersion` and `toVersion` (or latest); `limit` is
1001
+ * Exclusive start of version range. When set, the backend returns every
1002
+ * entry after `fromVersion` through `toVersion` (or latest); `limit` is
992
1003
  * rejected client-side in this mode.
993
1004
  */
994
1005
  fromVersion?: string;
@@ -1025,7 +1036,7 @@ interface ChangelogReport {
1025
1036
  package?: ChangelogPackageInfo;
1026
1037
  /** `"releases"` | `"changelog_file"` | `"hexdocs"` when resolved; absent for package versions with no changelog entry. */
1027
1038
  source?: string;
1028
- /** Entries, newest-first. Empty array = resolved source but nothing in range. */
1039
+ /** Entries in backend/source order. Empty array = resolved source but nothing in range. */
1029
1040
  entries: ChangelogEntryDetail[];
1030
1041
  }
1031
1042
  type PackageDocSourceKind = "CRAWLED" | "REPOSITORY";
@@ -1103,14 +1114,31 @@ interface PackageIntelligenceService {
1103
1114
  listPackageDocs(params: ListPackageDocsParams): Promise<PackageDocsList>;
1104
1115
  readPackageDoc(params: ReadPackageDocParams): Promise<PackageDocResult>;
1105
1116
  }
1106
- import { ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
1107
1117
  import { z } from "zod";
1108
1118
  /** Annotation fields required by OpenAI's MCP marketplace validation. */
1109
- interface CompleteToolAnnotations extends ToolAnnotations {
1119
+ interface CompleteToolAnnotations {
1120
+ title?: string;
1110
1121
  readOnlyHint: boolean;
1122
+ idempotentHint?: boolean;
1111
1123
  openWorldHint: boolean;
1112
1124
  destructiveHint: boolean;
1113
1125
  }
1126
+ interface McpAuthActionContext {
1127
+ authSource: unknown;
1128
+ defaultAction: string;
1129
+ }
1130
+ type McpAuthAction = string | ((context: McpAuthActionContext) => string);
1131
+ /** Host-selected message and action for terms-acceptance failures. */
1132
+ interface ToolTermsRemediation {
1133
+ message: string;
1134
+ action: string;
1135
+ }
1136
+ /** Host-provided execution state shared by MCP and direct tool callers. */
1137
+ interface ToolExecutionContext {
1138
+ authAction?: McpAuthAction;
1139
+ termsRemediation?: ToolTermsRemediation;
1140
+ signal?: AbortSignal;
1141
+ }
1114
1142
  /**
1115
1143
  * Standard result type for all MCP tools
1116
1144
  */
@@ -1127,11 +1155,6 @@ type ToolResult = {
1127
1155
  type ZodRawShape2 = {
1128
1156
  [k: string]: z.ZodTypeAny;
1129
1157
  };
1130
- interface McpAuthActionContext {
1131
- authSource: unknown;
1132
- defaultAction: string;
1133
- }
1134
- type McpAuthAction = string | ((context: McpAuthActionContext) => string);
1135
1158
  /**
1136
1159
  * Services required to construct the MCP tool surface.
1137
1160
  *
@@ -1161,8 +1184,13 @@ interface CreateMcpServerOptions<TExtra = unknown> {
1161
1184
  metadata: McpServerMetadata;
1162
1185
  services: McpToolServicesProvider<TExtra>;
1163
1186
  authAction?: McpAuthAction;
1187
+ termsRemediation?: ToolTermsRemediation;
1188
+ /** Optional caller-owned MCP instructions. GitHits does not provide defaults. */
1164
1189
  instructions?: string;
1165
- instructionOptions?: Parameters<typeof buildMcpInstructions>[0];
1190
+ /** Controls the guide returned by `quick_start`. */
1191
+ quickStartOptions?: Parameters<typeof buildMcpQuickStart>[0];
1192
+ /** @deprecated Use `quickStartOptions`. */
1193
+ instructionOptions?: Parameters<typeof buildMcpQuickStart>[0];
1166
1194
  traceTool?: McpToolExecutionHook;
1167
1195
  }
1168
1196
  interface McpToolDescriptor<TSchema extends ZodRawShape2 = ZodRawShape2> {
@@ -1174,6 +1202,7 @@ interface McpToolDescriptor<TSchema extends ZodRawShape2 = ZodRawShape2> {
1174
1202
  declare function getMcpToolDescriptors(): McpToolDescriptor[];
1175
1203
  declare function registerMcpTools<TExtra = unknown>(server: McpServer, options: {
1176
1204
  authAction?: McpAuthAction;
1205
+ termsRemediation?: ToolTermsRemediation;
1177
1206
  services: McpToolServicesProvider<TExtra>;
1178
1207
  traceTool?: McpToolExecutionHook;
1179
1208
  }): void;
@@ -1181,4 +1210,4 @@ declare function registerMcpTools<TExtra = unknown>(server: McpServer, options:
1181
1210
  * Creates the transport-neutral MCP server with injected services.
1182
1211
  */
1183
1212
  declare function createMcpServer<TExtra = unknown>(options: CreateMcpServerOptions<TExtra>): McpServer;
1184
- export { BuildMcpInstructionsOptions, CreateMcpServerOptions, McpAuthAction, McpAuthActionContext, McpRequestContext, McpServerMetadata, McpToolDescriptor, McpToolExecutionHook, McpToolServices, McpToolServicesProvider, buildMcpInstructions, createMcpServer, getMcpToolDescriptors, registerMcpTools };
1213
+ export { BuildMcpInstructionsOptions, BuildMcpQuickStartOptions, CreateMcpServerOptions, McpAuthAction, McpAuthActionContext, McpRequestContext, McpServerMetadata, McpToolDescriptor, McpToolExecutionHook, McpToolServices, McpToolServicesProvider, ToolExecutionContext, ToolTermsRemediation, buildMcpInstructions, buildMcpQuickStart, createMcpServer, getMcpToolDescriptors, registerMcpTools };