@calypsohq/elephant-mcp-server 1.4.0 → 1.5.0
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 +15 -0
- package/dist/ElephantMcpServer.d.ts +45 -0
- package/dist/ElephantMcpServer.js +3 -26
- package/dist/auth/ApiKeyStrategy.d.ts +14 -0
- package/dist/auth/AuthChallenge.d.ts +27 -0
- package/dist/auth/AuthStrategy.d.ts +14 -0
- package/dist/auth/BearerAuthenticator.d.ts +17 -0
- package/dist/auth/Credential.d.ts +23 -0
- package/dist/auth/GrantScopes.d.ts +16 -0
- package/dist/auth/JwtGrantStrategy.d.ts +30 -0
- package/dist/auth/ProtectedResource.d.ts +21 -0
- package/dist/auth/ProtectedResource.js +1 -0
- package/dist/auth/TokenCipher.d.ts +13 -0
- package/dist/calypso/AgentCatalog.d.ts +41 -0
- package/dist/calypso/AgentCatalogLoader.d.ts +12 -0
- package/dist/calypso/AgentChoice.d.ts +25 -0
- package/dist/calypso/AgentResponses.d.ts +47 -0
- package/dist/calypso/AnswerDepth.d.ts +30 -0
- package/dist/calypso/AnswerDiagnostics.d.ts +23 -0
- package/dist/calypso/AnswerSources.d.ts +36 -0
- package/dist/calypso/BatchManifest.d.ts +29 -0
- package/dist/calypso/BucketDestination.d.ts +17 -0
- package/dist/calypso/BucketEdits.d.ts +41 -0
- package/dist/calypso/BucketSources.d.ts +28 -0
- package/dist/calypso/CalypsoApi.d.ts +28 -0
- package/dist/calypso/CalypsoApiClient.d.ts +29 -0
- package/dist/calypso/CalypsoApiConfig.d.ts +15 -0
- package/dist/calypso/KnowledgeBatches.d.ts +25 -0
- package/dist/calypso/KnowledgeBuckets.d.ts +18 -0
- package/dist/calypso/KnowledgeFiles.d.ts +45 -0
- package/dist/calypso/KnowledgeInventory.d.ts +36 -0
- package/dist/calypso/KnowledgeSearch.d.ts +52 -0
- package/dist/calypso/KnowledgeWebsites.d.ts +39 -0
- package/dist/calypso/UploadContent.d.ts +22 -0
- package/dist/calypso/apiErrors.d.ts +14 -0
- package/dist/calypso/bucketList.d.ts +48 -0
- package/dist/calypso/coerce.d.ts +14 -0
- package/dist/calypso/knowledgeTypes.d.ts +64 -0
- package/dist/calypso/polling.d.ts +14 -0
- package/dist/calypso/uploadBytes.d.ts +8 -0
- package/dist/hatching/HatchingCopy.d.ts +11 -0
- package/dist/http/HostedServer.d.ts +8 -0
- package/dist/http/HttpConfig.d.ts +40 -0
- package/dist/http/HttpConfig.js +11 -2
- package/dist/http/HttpServer.d.ts +36 -0
- package/dist/http/KnowledgeInventoryCache.d.ts +21 -0
- package/dist/http/McpEndpoint.d.ts +39 -0
- package/dist/http/McpEndpoint.js +9 -56
- package/dist/http/ModelCatalogCache.d.ts +20 -0
- package/dist/http/ProtectedResourceMetadata.d.ts +19 -0
- package/dist/http/ProtectedResourceMetadata.js +1 -1
- package/dist/http/RateLimiter.d.ts +25 -0
- package/dist/http/StatelessMcpEndpoint.d.ts +40 -0
- package/dist/http/StatelessMcpEndpoint.js +69 -0
- package/dist/index.d.ts +2 -0
- package/dist/kit.d.ts +35 -0
- package/dist/kit.js +31 -0
- package/dist/notices/PostBudget.d.ts +15 -0
- package/dist/notices/SlackUsageNotices.d.ts +22 -0
- package/dist/notices/UsageMessage.d.ts +22 -0
- package/dist/notices/UsageNotices.d.ts +25 -0
- package/dist/presets/PresetInstructions.d.ts +20 -0
- package/dist/presets/ToolGroup.d.ts +30 -0
- package/dist/presets/ToolGroup.js +4 -0
- package/dist/presets/ToolPreset.d.ts +80 -0
- package/dist/presets/ToolPreset.js +6 -1
- package/dist/presets/ToolPresetRegistry.d.ts +18 -0
- package/dist/stdio/LocalPresets.d.ts +3 -0
- package/dist/stdio/StdioOptions.d.ts +16 -0
- package/dist/stdio.d.ts +2 -0
- package/dist/tools/AddFileTool.d.ts +91 -0
- package/dist/tools/AddFilesTool.d.ts +110 -0
- package/dist/tools/AddWebsiteTool.d.ts +42 -0
- package/dist/tools/AskTool.d.ts +57 -0
- package/dist/tools/CreateBucketTool.d.ts +44 -0
- package/dist/tools/ElephantTool.d.ts +12 -0
- package/dist/tools/ElephantTool.js +6 -36
- package/dist/tools/ListBucketsTool.d.ts +34 -0
- package/dist/tools/McpTool.d.ts +56 -0
- package/dist/tools/McpTool.js +40 -0
- package/dist/tools/MoveSourcesTool.d.ts +30 -0
- package/dist/tools/OpenSourceTool.d.ts +28 -0
- package/dist/tools/RenameBucketTool.d.ts +30 -0
- package/dist/tools/SearchTool.d.ts +36 -0
- package/dist/tools/ToolContext.d.ts +20 -0
- package/dist/tools/ToolLogger.d.ts +17 -0
- package/dist/tools/ToolRegistrar.d.ts +22 -0
- package/dist/tools/ToolRegistrar.js +33 -0
- package/dist/tools/schemaParts.d.ts +38 -0
- package/dist/views/BatchView.d.ts +35 -0
- package/dist/views/BucketView.d.ts +34 -0
- package/dist/views/ErrorView.d.ts +6 -0
- package/dist/views/MoveView.d.ts +20 -0
- package/dist/views/SearchView.d.ts +36 -0
- package/dist/views/SourceView.d.ts +47 -0
- package/dist/views/WebsiteView.d.ts +20 -0
- package/dist/views/viewFields.d.ts +11 -0
- package/package.json +9 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ToolGroup } from "../presets/ToolGroup.js";
|
|
3
|
+
import { ElephantTool, type ToolArgs, type ToolOutput } from "./ElephantTool.js";
|
|
4
|
+
import type { ToolContext } from "./ToolContext.js";
|
|
5
|
+
declare const inputSchema: {
|
|
6
|
+
bucket: z.ZodString;
|
|
7
|
+
name: z.ZodOptional<z.ZodString>;
|
|
8
|
+
description: z.ZodOptional<z.ZodString>;
|
|
9
|
+
};
|
|
10
|
+
/** `elephant-rename-bucket`: a bucket's name and note, nothing in it. */
|
|
11
|
+
export declare class RenameBucketTool extends ElephantTool<typeof inputSchema> {
|
|
12
|
+
readonly name = "elephant-rename-bucket";
|
|
13
|
+
readonly title = "Rename a bucket";
|
|
14
|
+
readonly description: string;
|
|
15
|
+
readonly inputSchema: {
|
|
16
|
+
bucket: z.ZodString;
|
|
17
|
+
name: z.ZodOptional<z.ZodString>;
|
|
18
|
+
description: z.ZodOptional<z.ZodString>;
|
|
19
|
+
};
|
|
20
|
+
readonly group: ToolGroup;
|
|
21
|
+
readonly annotations: {
|
|
22
|
+
readOnlyHint: boolean;
|
|
23
|
+
destructiveHint: boolean;
|
|
24
|
+
idempotentHint: boolean;
|
|
25
|
+
openWorldHint: boolean;
|
|
26
|
+
};
|
|
27
|
+
protected readonly failure = "Renaming the bucket failed.";
|
|
28
|
+
protected run(args: ToolArgs<typeof inputSchema>, { api, log }: ToolContext): Promise<ToolOutput>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ToolGroup } from "../presets/ToolGroup.js";
|
|
3
|
+
import { ElephantTool, type ToolArgs, type ToolOutput } from "./ElephantTool.js";
|
|
4
|
+
import type { ToolContext } from "./ToolContext.js";
|
|
5
|
+
declare const inputSchema: {
|
|
6
|
+
query: z.ZodString;
|
|
7
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
8
|
+
buckets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
maxResults: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
depth: z.ZodOptional<z.ZodEnum<["fast", "thorough"]>>;
|
|
11
|
+
alsoSearchFor: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
12
|
+
};
|
|
13
|
+
/** `elephant-search`: matching passages and their sources, no answer. */
|
|
14
|
+
export declare class SearchTool extends ElephantTool<typeof inputSchema> {
|
|
15
|
+
readonly name = "elephant-search";
|
|
16
|
+
readonly title = "Search Elephant";
|
|
17
|
+
readonly description: string;
|
|
18
|
+
readonly inputSchema: {
|
|
19
|
+
query: z.ZodString;
|
|
20
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
21
|
+
buckets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
22
|
+
maxResults: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
depth: z.ZodOptional<z.ZodEnum<["fast", "thorough"]>>;
|
|
24
|
+
alsoSearchFor: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
25
|
+
};
|
|
26
|
+
readonly group: ToolGroup;
|
|
27
|
+
readonly annotations: {
|
|
28
|
+
readOnlyHint: boolean;
|
|
29
|
+
destructiveHint: boolean;
|
|
30
|
+
idempotentHint: boolean;
|
|
31
|
+
openWorldHint: boolean;
|
|
32
|
+
};
|
|
33
|
+
protected readonly failure = "Searching Elephant failed.";
|
|
34
|
+
protected run(args: ToolArgs<typeof inputSchema>, { api, inventory, log }: ToolContext): Promise<ToolOutput>;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AgentCatalog } from "../calypso/AgentCatalog.js";
|
|
2
|
+
import type { CalypsoApi } from "../calypso/CalypsoApi.js";
|
|
3
|
+
import type { KnowledgeInventory } from "../calypso/KnowledgeInventory.js";
|
|
4
|
+
import type { UsageNotices } from "../notices/UsageNotices.js";
|
|
5
|
+
import type { ToolLogger } from "./ToolLogger.js";
|
|
6
|
+
/**
|
|
7
|
+
* Everything a tool needs for one request: the Calypso API as the caller,
|
|
8
|
+
* the caller's agents, what the team has in Elephant, a logger, and the
|
|
9
|
+
* operator notices told after each call.
|
|
10
|
+
*
|
|
11
|
+
* Built per request from the caller's credential, so a tool can never reach
|
|
12
|
+
* another caller's key or data.
|
|
13
|
+
*/
|
|
14
|
+
export type ToolContext = {
|
|
15
|
+
readonly api: CalypsoApi;
|
|
16
|
+
readonly agents: AgentCatalog;
|
|
17
|
+
readonly inventory: KnowledgeInventory;
|
|
18
|
+
readonly log: ToolLogger;
|
|
19
|
+
readonly notices: UsageNotices;
|
|
20
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
export type LogLevel = "debug" | "info" | "notice" | "warning" | "error";
|
|
3
|
+
/**
|
|
4
|
+
* Structured logs for one tool call: sent to the MCP client, and errors to
|
|
5
|
+
* the server's own log with the caller's principal.
|
|
6
|
+
*
|
|
7
|
+
* Callers log identifiers, counts and statuses only. Prompts, file bytes and
|
|
8
|
+
* API keys never reach a log line.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ToolLogger {
|
|
11
|
+
private readonly server;
|
|
12
|
+
private readonly principal;
|
|
13
|
+
constructor(server: McpServer | null, principal: string);
|
|
14
|
+
event(level: LogLevel, message: string, data?: Record<string, unknown>,
|
|
15
|
+
/** Kept in the server's log only: what a client is not shown. */
|
|
16
|
+
serverOnly?: Record<string, unknown>): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { InputShape, McpTool, ToolRuntime } from "./McpTool.js";
|
|
3
|
+
/** How one tool call went, for whoever wants to hear about it. */
|
|
4
|
+
export type ToolCallReport = {
|
|
5
|
+
readonly tool: string;
|
|
6
|
+
/** The caller's own input, as the tool received it. */
|
|
7
|
+
readonly args: unknown;
|
|
8
|
+
readonly outcome: "ok" | "error";
|
|
9
|
+
readonly durationMs: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Publishes a tool on an MCP server exactly as the tool describes itself.
|
|
13
|
+
*
|
|
14
|
+
* The one place a tool's name, wording, schemas, annotations and file inputs
|
|
15
|
+
* are handed to the SDK, so every Calypso server lists its tools the same way.
|
|
16
|
+
* `observe` hears how each call went once it has its result: the tool's own
|
|
17
|
+
* error handling has already turned a failure into an `isError` result, so
|
|
18
|
+
* the outcome is read from that.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ToolRegistrar: {
|
|
21
|
+
register<Context extends ToolRuntime>(server: McpServer, tool: McpTool<Context, InputShape>, context: Context, observe?: (report: ToolCallReport) => void): void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publishes a tool on an MCP server exactly as the tool describes itself.
|
|
3
|
+
*
|
|
4
|
+
* The one place a tool's name, wording, schemas, annotations and file inputs
|
|
5
|
+
* are handed to the SDK, so every Calypso server lists its tools the same way.
|
|
6
|
+
* `observe` hears how each call went once it has its result: the tool's own
|
|
7
|
+
* error handling has already turned a failure into an `isError` result, so
|
|
8
|
+
* the outcome is read from that.
|
|
9
|
+
*/
|
|
10
|
+
export const ToolRegistrar = {
|
|
11
|
+
register(server, tool, context, observe) {
|
|
12
|
+
server.registerTool(tool.name, {
|
|
13
|
+
title: tool.title,
|
|
14
|
+
description: tool.description,
|
|
15
|
+
inputSchema: tool.inputSchema,
|
|
16
|
+
...(tool.outputSchema ? { outputSchema: tool.outputSchema } : {}),
|
|
17
|
+
annotations: tool.annotations,
|
|
18
|
+
...(tool.fileParams?.length
|
|
19
|
+
? { _meta: { "openai/fileParams": [...tool.fileParams] } }
|
|
20
|
+
: {}),
|
|
21
|
+
}, async (args) => {
|
|
22
|
+
const startedAt = performance.now();
|
|
23
|
+
const result = await tool.call(args, context);
|
|
24
|
+
observe?.({
|
|
25
|
+
tool: tool.name,
|
|
26
|
+
args,
|
|
27
|
+
outcome: result.isError ? "error" : "ok",
|
|
28
|
+
durationMs: performance.now() - startedAt,
|
|
29
|
+
});
|
|
30
|
+
return result;
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Input fields several write tools share, worded once.
|
|
4
|
+
*
|
|
5
|
+
* Every add and create tool names a destination the same way, so the model
|
|
6
|
+
* learns one convention instead of four.
|
|
7
|
+
*/
|
|
8
|
+
export declare const bucketDestinationInputs: {
|
|
9
|
+
bucketIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
bucketSlugs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
11
|
+
bucket: z.ZodOptional<z.ZodString>;
|
|
12
|
+
createMissingBuckets: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
};
|
|
14
|
+
export declare const idempotencyKeyInput: z.ZodOptional<z.ZodString>;
|
|
15
|
+
/**
|
|
16
|
+
* A file the user attached in ChatGPT, as ChatGPT passes it.
|
|
17
|
+
*
|
|
18
|
+
* OpenAI's Apps SDK requires all four properties to be declared, with
|
|
19
|
+
* `download_url` and `file_id` required; ChatGPT sends the rest when it has
|
|
20
|
+
* them.
|
|
21
|
+
*/
|
|
22
|
+
export declare const chatGptFileInput: z.ZodObject<{
|
|
23
|
+
download_url: z.ZodString;
|
|
24
|
+
file_id: z.ZodString;
|
|
25
|
+
mime_type: z.ZodOptional<z.ZodString>;
|
|
26
|
+
file_name: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
file_id: string;
|
|
29
|
+
download_url: string;
|
|
30
|
+
mime_type?: string | undefined;
|
|
31
|
+
file_name?: string | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
file_id: string;
|
|
34
|
+
download_url: string;
|
|
35
|
+
mime_type?: string | undefined;
|
|
36
|
+
file_name?: string | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
export type ChatGptFile = z.infer<typeof chatGptFileInput>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type PublicBatchFile = {
|
|
2
|
+
/** The id the caller gave the item, to tell the files apart. */
|
|
3
|
+
client_file_id?: string;
|
|
4
|
+
/** The source's file id, once the file was accepted. */
|
|
5
|
+
file_id?: string;
|
|
6
|
+
filename?: string;
|
|
7
|
+
status?: string;
|
|
8
|
+
ready?: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
};
|
|
11
|
+
/** A batch of files, as the person who sent it may read it. */
|
|
12
|
+
export type PublicBatch = {
|
|
13
|
+
id?: string;
|
|
14
|
+
status?: string;
|
|
15
|
+
message?: string;
|
|
16
|
+
total?: number;
|
|
17
|
+
accepted?: number;
|
|
18
|
+
rejected?: number;
|
|
19
|
+
queued?: number;
|
|
20
|
+
indexing?: number;
|
|
21
|
+
active?: number;
|
|
22
|
+
failed?: number;
|
|
23
|
+
files: PublicBatchFile[];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* How a batch upload went, file by file. The API's answer also carries the
|
|
27
|
+
* upload sessions, task ids and index sync records; a view carries none.
|
|
28
|
+
*/
|
|
29
|
+
export declare class BatchView {
|
|
30
|
+
private readonly batch;
|
|
31
|
+
private constructor();
|
|
32
|
+
static of(value: unknown): PublicBatch;
|
|
33
|
+
private fields;
|
|
34
|
+
private static file;
|
|
35
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { BucketSource } from "../calypso/BucketSources.js";
|
|
2
|
+
import type { KnowledgeBucketDescriptor } from "../calypso/bucketList.js";
|
|
3
|
+
/** A bucket, as its owner may read it. */
|
|
4
|
+
export type PublicBucket = {
|
|
5
|
+
id: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
status?: string;
|
|
10
|
+
};
|
|
11
|
+
/** A bucket in a listing, with what it holds. */
|
|
12
|
+
export type PublicListedBucket = PublicBucket & {
|
|
13
|
+
file_count?: number;
|
|
14
|
+
source_count?: number;
|
|
15
|
+
sources?: BucketSource[];
|
|
16
|
+
/** The bucket holds more sources than the ones named. */
|
|
17
|
+
moreSources?: boolean;
|
|
18
|
+
/** The sources' ids, when their names were not asked for or did not load. */
|
|
19
|
+
source_ids?: string[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A bucket's name, slug and note. The API's record also names the workspace,
|
|
23
|
+
* who made the bucket and the index store behind it; a view carries none.
|
|
24
|
+
*/
|
|
25
|
+
export declare class BucketView {
|
|
26
|
+
private readonly bucket;
|
|
27
|
+
private constructor();
|
|
28
|
+
static of(value: unknown): PublicBucket;
|
|
29
|
+
private fields;
|
|
30
|
+
static listed(bucket: KnowledgeBucketDescriptor, named?: {
|
|
31
|
+
sources: BucketSource[];
|
|
32
|
+
moreSources?: boolean;
|
|
33
|
+
}): PublicListedBucket;
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** How a move went, source by source. */
|
|
2
|
+
export type PublicMove = {
|
|
3
|
+
/** The bucket the sources went into. */
|
|
4
|
+
bucket_id?: string;
|
|
5
|
+
from_bucket_id?: string;
|
|
6
|
+
moved?: number;
|
|
7
|
+
requested?: number;
|
|
8
|
+
/** One entry per source: `moved`, or why it was not. */
|
|
9
|
+
sources: Array<{
|
|
10
|
+
id?: string;
|
|
11
|
+
status?: string;
|
|
12
|
+
detail?: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
export declare class MoveView {
|
|
16
|
+
private readonly move;
|
|
17
|
+
private constructor();
|
|
18
|
+
static of(value: unknown): PublicMove;
|
|
19
|
+
private fields;
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type PublicSearchResult = {
|
|
2
|
+
source_index?: number;
|
|
3
|
+
type?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
/** The whole matching passage, as the document has it. */
|
|
6
|
+
text?: string;
|
|
7
|
+
/** The line in the passage that matched most closely. */
|
|
8
|
+
quote?: string;
|
|
9
|
+
/** The source's file id, usable with `elephant-open-source`. */
|
|
10
|
+
file_id?: string;
|
|
11
|
+
filename?: string;
|
|
12
|
+
url?: string;
|
|
13
|
+
page?: number;
|
|
14
|
+
/** Where in the source, as the document labels it ("p. 4"). */
|
|
15
|
+
location?: string;
|
|
16
|
+
};
|
|
17
|
+
export type PublicSearch = {
|
|
18
|
+
query?: string;
|
|
19
|
+
/** The depth the search ran at: `fast` or `thorough`. */
|
|
20
|
+
depth?: string;
|
|
21
|
+
results: PublicSearchResult[];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The passages a search found and where each is from. The API's answer also
|
|
25
|
+
* says which agent and retrieval strategy ran, what it cost in tokens, and
|
|
26
|
+
* for each passage its index and storage references; a view carries none.
|
|
27
|
+
*/
|
|
28
|
+
export declare class SearchView {
|
|
29
|
+
private readonly search;
|
|
30
|
+
private constructor();
|
|
31
|
+
static of(value: unknown): PublicSearch;
|
|
32
|
+
private fields;
|
|
33
|
+
private static result;
|
|
34
|
+
/** An id, never a path into the index. */
|
|
35
|
+
private static plainId;
|
|
36
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** One source, as its owner may read it. */
|
|
2
|
+
export type PublicSource = {
|
|
3
|
+
id: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
filename?: string;
|
|
6
|
+
content_type?: string;
|
|
7
|
+
size_bytes?: number;
|
|
8
|
+
/** Where the source is on its way to being answerable. */
|
|
9
|
+
status?: string;
|
|
10
|
+
/** Indexed and answerable right now. */
|
|
11
|
+
ready: boolean;
|
|
12
|
+
/** The buckets the source is filed in. */
|
|
13
|
+
bucket_ids?: string[];
|
|
14
|
+
created_at?: string;
|
|
15
|
+
updated_at?: string;
|
|
16
|
+
/** Why the source could not be indexed, when it could not. */
|
|
17
|
+
failure?: string;
|
|
18
|
+
/** Present when the index itself was asked (`verify`). */
|
|
19
|
+
index_check?: {
|
|
20
|
+
in_index: boolean;
|
|
21
|
+
checked_at?: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/** A source just added, with how far its indexing has come. */
|
|
25
|
+
export type PublicAddedSource = {
|
|
26
|
+
file: PublicSource;
|
|
27
|
+
indexing_status?: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A file's details and readiness (`GET /knowledge/files/{id}` and what an
|
|
31
|
+
* upload answers). The API's record also says which key added the file and
|
|
32
|
+
* where it sits in the index; a view carries neither.
|
|
33
|
+
*/
|
|
34
|
+
export declare class SourceView {
|
|
35
|
+
private readonly file;
|
|
36
|
+
private constructor();
|
|
37
|
+
static of(value: unknown): PublicSource;
|
|
38
|
+
private fields;
|
|
39
|
+
/** What `elephant-add-file` answers: the file, and its indexing status. */
|
|
40
|
+
static added(value: {
|
|
41
|
+
file?: unknown;
|
|
42
|
+
task?: unknown;
|
|
43
|
+
}): PublicAddedSource;
|
|
44
|
+
private static failure;
|
|
45
|
+
/** Whether the index holds the source in every bucket it is filed in. */
|
|
46
|
+
private static indexCheck;
|
|
47
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** A saved web page, as its owner may read it. */
|
|
2
|
+
export type PublicWebsite = {
|
|
3
|
+
/** The page's file id, usable with `elephant-open-source`. */
|
|
4
|
+
id?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
summary?: string;
|
|
8
|
+
tags?: string[];
|
|
9
|
+
status?: string;
|
|
10
|
+
bucket_ids?: string[];
|
|
11
|
+
/** Buckets made for this page because they did not exist yet. */
|
|
12
|
+
created_bucket_ids?: string[];
|
|
13
|
+
};
|
|
14
|
+
/** What saving a web page answers, without the workspace or request ids. */
|
|
15
|
+
export declare class WebsiteView {
|
|
16
|
+
private readonly website;
|
|
17
|
+
private constructor();
|
|
18
|
+
static of(value: unknown): PublicWebsite;
|
|
19
|
+
private fields;
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { asRecord, numberOrUndefined, trimmedString } from "../calypso/coerce.js";
|
|
2
|
+
/** The fields that are present, in the order given. */
|
|
3
|
+
export declare function present<T extends Record<string, unknown>>(fields: T): Partial<T>;
|
|
4
|
+
/**
|
|
5
|
+
* A short explanation the API wrote for a person (why a file failed, why a
|
|
6
|
+
* source did not move). Dropped when it names an internal path.
|
|
7
|
+
*/
|
|
8
|
+
export declare function plainText(value: unknown): string | undefined;
|
|
9
|
+
/** Bucket ids out of an assignment list, whose entries are ids or records. */
|
|
10
|
+
export declare function bucketIds(value: unknown): string[] | undefined;
|
|
11
|
+
export { asRecord, numberOrUndefined, trimmedString };
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calypsohq/elephant-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"mcpName": "io.github.calypso-so/elephant-mcp-server",
|
|
5
5
|
"description": "Elephant: PDF AI and docs Q&A as an MCP server. Chat with your PDFs, documents and web pages from Claude, ChatGPT and Cursor, with every answer cited.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js",
|
|
10
|
+
"./kit": {
|
|
11
|
+
"types": "./dist/kit.d.ts",
|
|
12
|
+
"default": "./dist/kit.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
8
16
|
"bin": {
|
|
9
17
|
"elephant-mcp": "dist/stdio.js"
|
|
10
18
|
},
|