@jrmc/adonis-mcp 1.0.0-alpha.3 → 1.0.0-alpha.8
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 +282 -0
- package/build/commands/commands.json +1 -1
- package/build/commands/make/tool.d.ts +2 -0
- package/build/commands/make/tool.d.ts.map +1 -1
- package/build/commands/make/tool.js +6 -1
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -0
- package/build/providers/mcp_provider.d.ts +2 -4
- package/build/providers/mcp_provider.d.ts.map +1 -1
- package/build/providers/mcp_provider.js +18 -34
- package/build/src/Transport/http_transport.d.ts +16 -0
- package/build/src/Transport/http_transport.d.ts.map +1 -0
- package/build/src/Transport/http_transport.js +24 -0
- package/build/src/context.d.ts +27 -0
- package/build/src/context.d.ts.map +1 -0
- package/build/src/context.js +32 -0
- package/build/src/controllers/mcp_controller.d.ts +1 -3
- package/build/src/controllers/mcp_controller.d.ts.map +1 -1
- package/build/src/controllers/mcp_controller.js +6 -59
- package/build/src/define_config.d.ts +1 -1
- package/build/src/define_config.d.ts.map +1 -1
- package/build/src/enums/error.d.ts +16 -0
- package/build/src/enums/error.d.ts.map +1 -0
- package/build/src/enums/error.js +18 -0
- package/build/src/enums/role.d.ts +12 -0
- package/build/src/enums/role.d.ts.map +1 -0
- package/build/src/enums/role.js +12 -0
- package/build/src/request.d.ts +9 -0
- package/build/src/request.d.ts.map +1 -0
- package/build/src/request.js +8 -0
- package/build/src/response.d.ts +32 -0
- package/build/src/response.d.ts.map +1 -0
- package/build/src/response.js +33 -0
- package/build/src/server/methods/call_tool.d.ts +12 -0
- package/build/src/server/methods/call_tool.d.ts.map +1 -0
- package/build/src/server/methods/call_tool.js +39 -0
- package/build/src/server/methods/get_prompt.d.ts +12 -0
- package/build/src/server/methods/get_prompt.d.ts.map +1 -0
- package/build/src/server/methods/get_prompt.js +12 -0
- package/build/src/server/methods/initialize.d.ts +12 -0
- package/build/src/server/methods/initialize.d.ts.map +1 -0
- package/build/src/server/methods/initialize.js +30 -0
- package/build/src/server/methods/list_prompts.d.ts +12 -0
- package/build/src/server/methods/list_prompts.d.ts.map +1 -0
- package/build/src/server/methods/list_prompts.js +12 -0
- package/build/src/server/methods/list_resources.d.ts +12 -0
- package/build/src/server/methods/list_resources.d.ts.map +1 -0
- package/build/src/server/methods/list_resources.js +12 -0
- package/build/src/server/methods/list_tools.d.ts +12 -0
- package/build/src/server/methods/list_tools.d.ts.map +1 -0
- package/build/src/server/methods/list_tools.js +54 -0
- package/build/src/server/methods/ping.d.ts +12 -0
- package/build/src/server/methods/ping.d.ts.map +1 -0
- package/build/src/server/methods/ping.js +12 -0
- package/build/src/server/methods/read_resource.d.ts +12 -0
- package/build/src/server/methods/read_resource.d.ts.map +1 -0
- package/build/src/server/methods/read_resource.js +12 -0
- package/build/src/server/pagination/cursor_paginator.d.ts +12 -0
- package/build/src/server/pagination/cursor_paginator.d.ts.map +1 -0
- package/build/src/server/pagination/cursor_paginator.js +48 -0
- package/build/src/server/tool.d.ts +18 -0
- package/build/src/server/tool.d.ts.map +1 -0
- package/build/src/server/tool.js +8 -0
- package/build/src/server.d.ts +43 -0
- package/build/src/server.d.ts.map +1 -0
- package/build/src/server.js +115 -0
- package/build/src/types/config.d.ts +15 -0
- package/build/src/types/config.d.ts.map +1 -0
- package/build/src/types/config.js +7 -0
- package/build/src/types/context.d.ts +26 -0
- package/build/src/types/context.d.ts.map +1 -0
- package/build/src/types/context.js +7 -0
- package/build/src/types/method.d.ts +37 -0
- package/build/src/types/method.d.ts.map +1 -0
- package/build/src/types/method.js +7 -0
- package/build/src/types/notification.d.ts +14 -0
- package/build/src/types/notification.d.ts.map +1 -0
- package/build/src/types/notification.js +7 -0
- package/build/src/types/request.d.ts +44 -0
- package/build/src/types/request.d.ts.map +1 -0
- package/build/src/types/request.js +7 -0
- package/build/src/types/response.d.ts +46 -0
- package/build/src/types/response.d.ts.map +1 -0
- package/build/src/types/response.js +7 -0
- package/build/src/types/transport.d.ts +12 -0
- package/build/src/types/transport.d.ts.map +1 -0
- package/build/src/types/transport.js +7 -0
- package/build/stubs/config.ts.stub +3 -1
- package/build/stubs/make/mcp/tools/main.ts.stub +31 -9
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -6
- package/build/commands/make/prompt.d.ts +0 -14
- package/build/commands/make/prompt.d.ts.map +0 -1
- package/build/commands/make/prompt.js +0 -30
- package/build/commands/make/resource.d.ts +0 -14
- package/build/commands/make/resource.d.ts.map +0 -1
- package/build/commands/make/resource.js +0 -30
- package/build/src/mcp.d.ts +0 -22
- package/build/src/mcp.d.ts.map +0 -1
- package/build/src/mcp.js +0 -32
- package/build/src/types.d.ts +0 -49
- package/build/src/types.d.ts.map +0 -1
- package/build/src/types.js +0 -8
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-mcp
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
import type { McpConfig } from './types/config.js';
|
|
8
|
+
import type { McpRequest } from './types/request.js';
|
|
9
|
+
import type { ToolList, ResourceList, PromptList } from './types/method.js';
|
|
10
|
+
import type { Transport } from './types/transport.js';
|
|
11
|
+
import ServerContext from './context.js';
|
|
12
|
+
export default class Server {
|
|
13
|
+
config: McpConfig;
|
|
14
|
+
name: string;
|
|
15
|
+
version: string;
|
|
16
|
+
instructions: string;
|
|
17
|
+
supportedProtocolVersion: string[];
|
|
18
|
+
capabilities: Record<string, any>;
|
|
19
|
+
tools: ToolList;
|
|
20
|
+
resources: ResourceList;
|
|
21
|
+
prompts: PromptList;
|
|
22
|
+
maxPaginationLength: number;
|
|
23
|
+
defaultPaginationLength: number;
|
|
24
|
+
methods: {
|
|
25
|
+
initialize: () => Promise<typeof import("./server/methods/initialize.js")>;
|
|
26
|
+
'tools/list': () => Promise<typeof import("./server/methods/list_tools.js")>;
|
|
27
|
+
'tools/call': () => Promise<typeof import("./server/methods/call_tool.js")>;
|
|
28
|
+
'resources/list': () => Promise<typeof import("./server/methods/list_resources.js")>;
|
|
29
|
+
'resources/read': () => Promise<typeof import("./server/methods/read_resource.js")>;
|
|
30
|
+
'prompts/list': () => Promise<typeof import("./server/methods/list_prompts.js")>;
|
|
31
|
+
'prompts/get': () => Promise<typeof import("./server/methods/get_prompt.js")>;
|
|
32
|
+
ping: () => Promise<typeof import("./server/methods/ping.js")>;
|
|
33
|
+
};
|
|
34
|
+
constructor(config: McpConfig);
|
|
35
|
+
addCapability(key: string, value?: boolean): void;
|
|
36
|
+
addTool(item: ToolList): void;
|
|
37
|
+
addResource(item: ResourceList): void;
|
|
38
|
+
addPrompt(item: PromptList): void;
|
|
39
|
+
handle(jsonRequest: McpRequest, transport: Transport): Promise<import("./types/response.js").JsonRpcResponse | undefined>;
|
|
40
|
+
createContext(request: McpRequest): ServerContext;
|
|
41
|
+
generateSessionId(): `${string}-${string}-${string}-${string}-${string}`;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAGrD,OAAO,aAAa,MAAM,cAAc,CAAA;AAExC,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,MAAM,CAAwB;IACpC,OAAO,EAAE,MAAM,CAAU;IACzB,YAAY,EAAE,MAAM,CAA2E;IAE/F,wBAAwB,EAAE,MAAM,EAAE,CAAiB;IAEnD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAUhC;IAED,KAAK,EAAE,QAAQ,CAAK;IACpB,SAAS,EAAE,YAAY,CAAK;IAC5B,OAAO,EAAE,UAAU,CAAK;IAExB,mBAAmB,EAAE,MAAM,CAAK;IAChC,uBAAuB,EAAE,MAAM,CAAK;IAEpC,OAAO;;;;;;;;;MASN;gBAEW,MAAM,EAAE,SAAS;IAwB7B,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,OAAc;IAUhD,OAAO,CAAC,IAAI,EAAE,QAAQ;IAGtB,WAAW,CAAC,IAAI,EAAE,YAAY;IAG9B,SAAS,CAAC,IAAI,EAAE,UAAU;IAIpB,MAAM,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS;IA2B1D,aAAa,CAAC,OAAO,EAAE,UAAU;IAgBjC,iBAAiB;CAGlB"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-mcp
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
import { createError } from '@adonisjs/core/exceptions';
|
|
8
|
+
import ServerContext from './context.js';
|
|
9
|
+
export default class Server {
|
|
10
|
+
config;
|
|
11
|
+
name = 'AdonisJS MCP Server';
|
|
12
|
+
version = '1.0.0';
|
|
13
|
+
instructions = 'This MCP server lets AI agents interact with our AdonisJS application.';
|
|
14
|
+
supportedProtocolVersion = ['2025-06-18'];
|
|
15
|
+
capabilities = {
|
|
16
|
+
tools: {
|
|
17
|
+
listChanged: false,
|
|
18
|
+
},
|
|
19
|
+
resources: {
|
|
20
|
+
listChanged: false,
|
|
21
|
+
},
|
|
22
|
+
prompts: {
|
|
23
|
+
listChanged: false,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
tools = {};
|
|
27
|
+
resources = {};
|
|
28
|
+
prompts = {};
|
|
29
|
+
maxPaginationLength = 50;
|
|
30
|
+
defaultPaginationLength = 15;
|
|
31
|
+
methods = {
|
|
32
|
+
'initialize': () => import('./server/methods/initialize.js'),
|
|
33
|
+
'tools/list': () => import('./server/methods/list_tools.js'),
|
|
34
|
+
'tools/call': () => import('./server/methods/call_tool.js'),
|
|
35
|
+
'resources/list': () => import('./server/methods/list_resources.js'),
|
|
36
|
+
'resources/read': () => import('./server/methods/read_resource.js'),
|
|
37
|
+
'prompts/list': () => import('./server/methods/list_prompts.js'),
|
|
38
|
+
'prompts/get': () => import('./server/methods/get_prompt.js'),
|
|
39
|
+
'ping': () => import('./server/methods/ping.js'),
|
|
40
|
+
};
|
|
41
|
+
constructor(config) {
|
|
42
|
+
this.config = config;
|
|
43
|
+
if (config.name) {
|
|
44
|
+
this.name = config.name;
|
|
45
|
+
}
|
|
46
|
+
if (config.version) {
|
|
47
|
+
this.version = config.version;
|
|
48
|
+
}
|
|
49
|
+
if (config.instructions) {
|
|
50
|
+
this.instructions = config.instructions;
|
|
51
|
+
}
|
|
52
|
+
if (config.maxPaginationLength) {
|
|
53
|
+
this.maxPaginationLength = config.maxPaginationLength;
|
|
54
|
+
}
|
|
55
|
+
if (config.defaultPaginationLength) {
|
|
56
|
+
this.defaultPaginationLength = config.defaultPaginationLength;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
addCapability(key, value = true) {
|
|
60
|
+
if (key.includes('.')) {
|
|
61
|
+
const [root, child] = key.split('.');
|
|
62
|
+
let existing = this.capabilities[root] ?? {};
|
|
63
|
+
existing[child] = value;
|
|
64
|
+
this.capabilities[root] = existing;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
addTool(item) {
|
|
68
|
+
this.tools = { ...this.tools, ...item };
|
|
69
|
+
}
|
|
70
|
+
addResource(item) {
|
|
71
|
+
this.resources = { ...this.resources, ...item };
|
|
72
|
+
}
|
|
73
|
+
addPrompt(item) {
|
|
74
|
+
this.prompts = { ...this.prompts, ...item };
|
|
75
|
+
}
|
|
76
|
+
async handle(jsonRequest, transport) {
|
|
77
|
+
const mcpContext = this.createContext(jsonRequest);
|
|
78
|
+
if (transport) {
|
|
79
|
+
transport.bindBouncer(mcpContext);
|
|
80
|
+
transport.bindAuth(mcpContext);
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
if (Object.keys(this.methods).includes(jsonRequest.method)) {
|
|
84
|
+
const lazyMethod = this.methods[jsonRequest.method];
|
|
85
|
+
const { default: method } = await lazyMethod();
|
|
86
|
+
const instance = new method();
|
|
87
|
+
return instance.handle(mcpContext);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
throw createError(`The method ${jsonRequest.method} was not found.`, 'E_METHOD_NOT_FOUND', -32601);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
// TODO
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
createContext(request) {
|
|
98
|
+
return new ServerContext({
|
|
99
|
+
supportedProtocolVersions: this.supportedProtocolVersion,
|
|
100
|
+
serverCapabilities: this.capabilities,
|
|
101
|
+
serverName: this.name,
|
|
102
|
+
serverVersion: this.version,
|
|
103
|
+
instructions: this.instructions,
|
|
104
|
+
maxPaginationLength: this.maxPaginationLength,
|
|
105
|
+
defaultPaginationLength: this.defaultPaginationLength,
|
|
106
|
+
tools: this.tools,
|
|
107
|
+
resources: this.resources,
|
|
108
|
+
prompts: this.prompts,
|
|
109
|
+
request,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
generateSessionId() {
|
|
113
|
+
return crypto.randomUUID();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-mcp
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
export type McpConfig = {
|
|
8
|
+
name?: string;
|
|
9
|
+
version?: string;
|
|
10
|
+
instructions?: string;
|
|
11
|
+
path?: string;
|
|
12
|
+
maxPaginationLength?: number;
|
|
13
|
+
defaultPaginationLength?: number;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,uBAAuB,CAAC,EAAE,MAAM,CAAA;CACjC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-mcp
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolList, ResourceList, PromptList } from './method.js';
|
|
8
|
+
import type { McpRequest } from './request.js';
|
|
9
|
+
import type { McpResponse } from './response.js';
|
|
10
|
+
export interface McpContext {
|
|
11
|
+
supportedProtocolVersions: string[];
|
|
12
|
+
serverCapabilities: Record<string, any>;
|
|
13
|
+
serverName: string;
|
|
14
|
+
serverVersion: string;
|
|
15
|
+
instructions: string;
|
|
16
|
+
maxPaginationLength: number;
|
|
17
|
+
defaultPaginationLength: number;
|
|
18
|
+
tools: ToolList;
|
|
19
|
+
resources: ResourceList;
|
|
20
|
+
prompts: PromptList;
|
|
21
|
+
request: McpRequest;
|
|
22
|
+
response: McpResponse;
|
|
23
|
+
getPerPage(requestedPerPage?: number): number;
|
|
24
|
+
}
|
|
25
|
+
export type ServerContextOptions = Omit<McpContext, 'response' | 'getPerPage'>;
|
|
26
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/types/context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,MAAM,WAAW,UAAU;IACzB,yBAAyB,EAAE,MAAM,EAAE,CAAA;IACnC,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACvC,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,uBAAuB,EAAE,MAAM,CAAA;IAC/B,KAAK,EAAE,QAAQ,CAAA;IACf,SAAS,EAAE,YAAY,CAAA;IACvB,OAAO,EAAE,UAAU,CAAA;IACnB,OAAO,EAAE,UAAU,CAAA;IACnB,QAAQ,EAAE,WAAW,CAAA;IAErB,UAAU,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC9C;AAED,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-mcp
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
import type { McpContext } from './context.js';
|
|
8
|
+
export interface Method {
|
|
9
|
+
handle(ctx: McpContext): Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
export type ToolList = Record<string, string>;
|
|
12
|
+
export type ResourceList = Record<string, string>;
|
|
13
|
+
export type PromptList = Record<string, string>;
|
|
14
|
+
export type JSONSchema = {
|
|
15
|
+
type: 'string';
|
|
16
|
+
} | {
|
|
17
|
+
type: 'number';
|
|
18
|
+
} | {
|
|
19
|
+
type: 'boolean';
|
|
20
|
+
} | {
|
|
21
|
+
type: 'object';
|
|
22
|
+
properties: Record<string, JSONSchema>;
|
|
23
|
+
required?: string[];
|
|
24
|
+
};
|
|
25
|
+
type ObjectSchema = Extract<JSONSchema, {
|
|
26
|
+
type: 'object';
|
|
27
|
+
}>;
|
|
28
|
+
export type InferJSONSchema<S extends JSONSchema> = S['type'] extends 'string' ? string : S['type'] extends 'number' ? number : S['type'] extends 'boolean' ? boolean : S extends ObjectSchema ? {
|
|
29
|
+
[K in keyof S['properties'] as K extends string ? K : never]: K extends (S['required'] extends readonly string[] ? S['required'][number] : never) ? InferJSONSchema<S['properties'][K]> : InferJSONSchema<S['properties'][K]> | undefined;
|
|
30
|
+
} : never;
|
|
31
|
+
export type BaseSchema<P extends Record<string, any> = {}> = {
|
|
32
|
+
type: 'object';
|
|
33
|
+
properties: P;
|
|
34
|
+
required?: (keyof P)[];
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=method.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../src/types/method.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,WAAW,MAAM;IACrB,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC7C;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC7C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACjD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE/C,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;AAEnF,KAAK,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAA;AAE3D,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,QAAQ,GAC1E,MAAM,GACN,CAAC,CAAC,MAAM,CAAC,SAAS,QAAQ,GACxB,MAAM,GACN,CAAC,CAAC,MAAM,CAAC,SAAS,SAAS,GACzB,OAAO,GACP,CAAC,SAAS,YAAY,GACpB;KACG,CAAC,IAAI,MAAM,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,SAAS,CACtE,CAAC,CAAC,UAAU,CAAC,SAAS,SAAS,MAAM,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,CACxE,GACG,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,GACnC,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CACpD,GACD,KAAK,CAAA;AAEf,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI;IAC3D,IAAI,EAAE,QAAQ,CAAA;IACd,UAAU,EAAE,CAAC,CAAA;IACb,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAA;CACvB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-mcp
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
export type JsonRpcNotification = {
|
|
8
|
+
jsonrpc: '2.0';
|
|
9
|
+
method: string;
|
|
10
|
+
params?: {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/types/notification.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,KAAK,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,CAAA;CACF,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-mcp
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
export type JsonRpcRequest = {
|
|
8
|
+
jsonrpc: '2.0';
|
|
9
|
+
id: string | number;
|
|
10
|
+
method: string;
|
|
11
|
+
params?: {
|
|
12
|
+
cursor?: string;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
type InitializeRequest = JsonRpcRequest & {
|
|
17
|
+
method: 'initialize';
|
|
18
|
+
params: {
|
|
19
|
+
protocolVersion: string;
|
|
20
|
+
capabilities: {
|
|
21
|
+
tools: boolean;
|
|
22
|
+
prompts: boolean;
|
|
23
|
+
resources: boolean;
|
|
24
|
+
logging: boolean;
|
|
25
|
+
elicitation: Record<string, unknown>;
|
|
26
|
+
roots: unknown;
|
|
27
|
+
};
|
|
28
|
+
clientInfo: {
|
|
29
|
+
name: string;
|
|
30
|
+
version: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
type ToolsCallRequest = JsonRpcRequest & {
|
|
35
|
+
method: 'tools/call';
|
|
36
|
+
params: {
|
|
37
|
+
name: string;
|
|
38
|
+
arguments?: Record<string, unknown>;
|
|
39
|
+
_meta?: Record<string, unknown>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type McpRequest = InitializeRequest | ToolsCallRequest;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/types/request.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,KAAK,CAAA;IACd,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,CAAA;CACF,CAAA;AAED,KAAK,iBAAiB,GAAG,cAAc,GAAG;IACxC,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE;QACN,eAAe,EAAE,MAAM,CAAA;QACvB,YAAY,EAAE;YACZ,KAAK,EAAE,OAAO,CAAA;YACd,OAAO,EAAE,OAAO,CAAA;YAChB,SAAS,EAAE,OAAO,CAAA;YAClB,OAAO,EAAE,OAAO,CAAA;YAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YACpC,KAAK,EAAE,OAAO,CAAA;SACf,CAAA;QACD,UAAU,EAAE;YACV,IAAI,EAAE,MAAM,CAAA;YACZ,OAAO,EAAE,MAAM,CAAA;SAChB,CAAA;KACF,CAAA;CACF,CAAA;AAED,KAAK,gBAAgB,GAAG,cAAc,GAAG;IACvC,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QACnC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAChC,CAAA;CACF,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-mcp
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
export type JsonRpcResponse = {
|
|
8
|
+
jsonrpc: "2.0";
|
|
9
|
+
id: string | number;
|
|
10
|
+
result?: {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
};
|
|
13
|
+
error?: {
|
|
14
|
+
code: number;
|
|
15
|
+
message: string;
|
|
16
|
+
data?: unknown;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type ErrorResponse = {
|
|
20
|
+
code: number;
|
|
21
|
+
message: string;
|
|
22
|
+
data?: unknown;
|
|
23
|
+
};
|
|
24
|
+
export type TextResponse = {
|
|
25
|
+
type: 'text';
|
|
26
|
+
text: string;
|
|
27
|
+
};
|
|
28
|
+
export type ImageResponse = {
|
|
29
|
+
type: 'image';
|
|
30
|
+
data: string;
|
|
31
|
+
mimeType: string;
|
|
32
|
+
_meta?: Record<string, unknown>;
|
|
33
|
+
};
|
|
34
|
+
export type AudioResponse = {
|
|
35
|
+
type: 'audio';
|
|
36
|
+
data: string;
|
|
37
|
+
mimeType: string;
|
|
38
|
+
_meta?: Record<string, unknown>;
|
|
39
|
+
};
|
|
40
|
+
export interface McpResponse {
|
|
41
|
+
text(text: string): TextResponse;
|
|
42
|
+
image(data: string, mimeType: string, _meta?: Record<string, unknown>): ImageResponse;
|
|
43
|
+
audio(data: string, mimeType: string, _meta?: Record<string, unknown>): AudioResponse;
|
|
44
|
+
error(message: string, code?: number, data?: Record<string, unknown>): ErrorResponse;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/types/response.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAA;IACD,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAA;IAChC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,CAAA;IACrF,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,CAAA;IACrF,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,CAAA;CACrF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-mcp
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
import type { McpContext } from './context.js';
|
|
8
|
+
export interface Transport {
|
|
9
|
+
bindBouncer(mcpContext: McpContext): void;
|
|
10
|
+
bindAuth(mcpContext: McpContext): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/types/transport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAA;IACzC,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAA;CACvC"}
|
|
@@ -1,19 +1,41 @@
|
|
|
1
|
+
{{#var className = `${name}Tool`}}
|
|
1
2
|
{{#var resourceFileName = string(className).snakeCase().ext('.ts').toString()}}
|
|
2
3
|
{{{
|
|
3
4
|
exports({
|
|
4
|
-
to: app.makePath(app.rcFile.directories['mcp'] ||
|
|
5
|
+
to: app.makePath(app.rcFile.directories['mcp'] || basePath, resourceFileName)
|
|
5
6
|
})
|
|
6
7
|
}}}
|
|
7
|
-
import type {
|
|
8
|
+
import type { McpContext } from '@jrmc/adonis-mcp/types/context'
|
|
9
|
+
import type { BaseSchema, InferJSONSchema } from '@jrmc/adonis-mcp/types/method'
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
import { Tool } from '@jrmc/adonis-mcp'
|
|
12
|
+
|
|
13
|
+
type Schema = BaseSchema<{
|
|
14
|
+
text: { type: "string" }
|
|
15
|
+
}>
|
|
16
|
+
|
|
17
|
+
type Context = McpContext & { args: InferJSONSchema<Schema> }
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
export default class {{ className }} implements Tool<Schema> {
|
|
20
|
+
name = '{{ name }}'
|
|
21
|
+
title = 'Tool title'
|
|
22
|
+
description = 'Tool description'
|
|
23
|
+
|
|
24
|
+
async handle({ args, response }: Context) {
|
|
25
|
+
console.log(args.text)
|
|
26
|
+
return response.text(JSON.stringify({ text: 'Hello, world!' }))
|
|
27
|
+
}
|
|
17
28
|
|
|
29
|
+
schema() {
|
|
30
|
+
return {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
text: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "Description text argument"
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
required: ["text"]
|
|
39
|
+
} as Schema
|
|
18
40
|
}
|
|
19
41
|
}
|