kleanmcp 1.0.2 → 1.0.3

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/dist/index.cjs CHANGED
@@ -431,7 +431,7 @@ function InputSchemaFromParameters(params) {
431
431
  return {
432
432
  type: "object",
433
433
  properties: Object.fromEntries(Object.entries(params).map(([k2, v2]) => [
434
- k2,
434
+ v2.name,
435
435
  {
436
436
  description: v2.description,
437
437
  type: v2.type,
@@ -0,0 +1,24 @@
1
+ import { type ToolDefinitionGeneric, type ToolSet } from "./types";
2
+ import { type InitializeParams, type InitializeResult, type MCPServerInterface, type PingParams, type PingResult, type PromptsGetParams, type PromptsGetResult, type PromptsListParams, type PromptsListResult, type ResourcesListParams, type ResourcesListResult, type ResourcesReadParams, type ResourcesReadResult, type ResourcesSubscribeParams, type ResourcesSubscribeResult, type ResourcesTemplatesListParams, type ResourcesTemplatesListResult, type ToolsCallParams, type ToolsCallResult, type ToolsListParams, type ToolsListResult } from "elysia-jsonrpc/mcp";
3
+ import elysiaJsonRPC from "elysia-jsonrpc";
4
+ export { elysiaJsonRPC };
5
+ export type ReferenceForToolCallFunction = (toolName: string) => any;
6
+ export declare class MCPServerService implements MCPServerInterface {
7
+ readonly serverTitle: string;
8
+ readonly serverVersion: string;
9
+ readonly serverInstructions: string;
10
+ readonly getReferenceInstanceForToolCall: ReferenceForToolCallFunction;
11
+ readonly toolsets: ToolSet[];
12
+ constructor(serverTitle: string, serverVersion: string, serverInstructions: string, getReferenceInstanceForToolCall: ReferenceForToolCallFunction, toolsets: ToolSet[]);
13
+ initialize(params: InitializeParams): Promise<InitializeResult>;
14
+ ping(params: PingParams): Promise<PingResult>;
15
+ "tools/list"(params: ToolsListParams): Promise<ToolsListResult>;
16
+ getTool(toolName: string): ToolDefinitionGeneric | null;
17
+ "tools/call"(params: ToolsCallParams): Promise<ToolsCallResult>;
18
+ "prompts/list"(params: PromptsListParams): Promise<PromptsListResult>;
19
+ "prompts/get"(params: PromptsGetParams): Promise<PromptsGetResult>;
20
+ "resources/list"(params: ResourcesListParams): Promise<ResourcesListResult>;
21
+ "resources/read"(params: ResourcesReadParams): Promise<ResourcesReadResult>;
22
+ "resources/subscribe"(params: ResourcesSubscribeParams): Promise<ResourcesSubscribeResult>;
23
+ "resources/templates/list"(params: ResourcesTemplatesListParams): Promise<ResourcesTemplatesListResult>;
24
+ }
package/dist/index.mjs CHANGED
@@ -325,7 +325,7 @@ function InputSchemaFromParameters(params) {
325
325
  return {
326
326
  type: "object",
327
327
  properties: Object.fromEntries(Object.entries(params).map(([k2, v2]) => [
328
- k2,
328
+ v2.name,
329
329
  {
330
330
  description: v2.description,
331
331
  type: v2.type,
package/dist/types.cjs CHANGED
@@ -431,7 +431,7 @@ function InputSchemaFromParameters(params) {
431
431
  return {
432
432
  type: "object",
433
433
  properties: Object.fromEntries(Object.entries(params).map(([k2, v2]) => [
434
- k2,
434
+ v2.name,
435
435
  {
436
436
  description: v2.description,
437
437
  type: v2.type,
@@ -0,0 +1,71 @@
1
+ export * from "elysia-jsonrpc/mcp";
2
+ export * from "elysia-jsonrpc/rpc";
3
+ export * from "elysia-jsonrpc";
4
+ export type ParamType = "string" | "number" | "boolean" | "object" | "Record<string, any>";
5
+ export type ParamDef = {
6
+ type: ParamType;
7
+ required?: boolean;
8
+ default?: ParamDef["type"];
9
+ name: string;
10
+ description: string;
11
+ };
12
+ export type ExtractType<T extends ParamDef["type"]> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "object" ? object : T extends "Record<string, any>" ? Record<string, any> : never;
13
+ export type MethodResult<TResult, TParams extends readonly ParamDef[], TExtra = any> = {
14
+ name: string;
15
+ params: TParams;
16
+ callback: (...args: [...ParamsToTuple<TParams>, TExtra]) => Promise<TResult>;
17
+ };
18
+ export type NamedParam<N extends string, T extends ParamDef> = T & {
19
+ name: N;
20
+ };
21
+ export type ParamsToTuple<T extends readonly ParamDef[]> = {
22
+ [K in keyof T]: T[K] extends ParamDef ? ExtractType<T[K]["type"]> : never;
23
+ };
24
+ export type NamedParamsToTuple<T extends readonly NamedParam<string, ParamDef>[]> = {
25
+ [K in keyof T]: T[K] extends NamedParam<string, infer P> ? P extends ParamDef ? ExtractType<P["type"]> : never : never;
26
+ };
27
+ export interface PropertyDescription {
28
+ type: string;
29
+ description: string;
30
+ }
31
+ export interface InputSchemaType {
32
+ [x: string]: unknown;
33
+ type: "object";
34
+ properties?: Record<string, PropertyDescription>;
35
+ required?: string[];
36
+ }
37
+ export type ToolParameterDefinition = {
38
+ required: boolean;
39
+ type: string;
40
+ description: string;
41
+ default?: object;
42
+ };
43
+ export type NamedToolParameterDefinition = ToolParameterDefinition & {
44
+ name: string;
45
+ };
46
+ export interface CallToolResult {
47
+ content: any[];
48
+ isError?: boolean;
49
+ }
50
+ export declare function InputSchemaFromParameters(params: NamedToolParameterDefinition[]): InputSchemaType;
51
+ export declare function ToolArgsToParameterList<TParams extends readonly NamedParam<string, ParamDef>[] = []>(toolArgs: Record<string, any>, params: TParams): (any | undefined)[];
52
+ export type ToolDefinitionCreator<ReferencedServerType, TParams extends readonly NamedParam<string, ParamDef>[] = []> = <UserRef extends ReferencedServerType, TExtra = any>(callback: (...args: [UserRef, ...NamedParamsToTuple<TParams>, TExtra?]) => Promise<CallToolResult>) => any;
53
+ export declare function ToolDefinition<ReferencedServerType = any, TParams extends readonly NamedParam<string, ParamDef>[] = []>(methodName: string, methodDescription: string, params: TParams): ToolDefinitionCreator<ReferencedServerType, TParams>;
54
+ export type ToolDefinitionGeneric<ReferencedServerType = any, TParams = any> = {
55
+ name: string;
56
+ description: string;
57
+ params: TParams;
58
+ callback: (argfirst: ReferencedServerType, ...args: any[]) => Promise<CallToolResult>;
59
+ };
60
+ export interface ToolResult {
61
+ content: PropertyDescription[];
62
+ }
63
+ export interface Tool {
64
+ name: string;
65
+ description: string;
66
+ inputSchema: InputSchemaType;
67
+ }
68
+ export interface ToolSet {
69
+ getTools(): ToolDefinitionGeneric[];
70
+ getTool(toolName: string): ToolDefinitionGeneric | undefined;
71
+ }
package/dist/types.mjs CHANGED
@@ -325,7 +325,7 @@ function InputSchemaFromParameters(params) {
325
325
  return {
326
326
  type: "object",
327
327
  properties: Object.fromEntries(Object.entries(params).map(([k2, v2]) => [
328
- k2,
328
+ v2.name,
329
329
  {
330
330
  description: v2.description,
331
331
  type: v2.type,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/zeilenschubser/kleanmcp.git"
7
7
  },
8
- "version": "1.0.2",
8
+ "version": "1.0.3",
9
9
  "license": "SEE LICENSE IN ./LICENSE",
10
10
  "main": "./dist/index.cjs",
11
11
  "module": "./dist/index.mjs",