tuiuiu.js 1.0.10 → 1.0.12
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/mcp/completions.d.ts +37 -0
- package/dist/mcp/completions.d.ts.map +1 -0
- package/dist/mcp/completions.js +190 -0
- package/dist/mcp/completions.js.map +1 -0
- package/dist/mcp/index.d.ts +17 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +18 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/logging.d.ts +94 -0
- package/dist/mcp/logging.d.ts.map +1 -0
- package/dist/mcp/logging.js +144 -0
- package/dist/mcp/logging.js.map +1 -0
- package/dist/mcp/prompts.d.ts +30 -0
- package/dist/mcp/prompts.d.ts.map +1 -0
- package/dist/mcp/prompts.js +1110 -0
- package/dist/mcp/prompts.js.map +1 -0
- package/dist/mcp/resources.d.ts +31 -0
- package/dist/mcp/resources.d.ts.map +1 -0
- package/dist/mcp/resources.js +1502 -0
- package/dist/mcp/resources.js.map +1 -0
- package/dist/mcp/server.d.ts +16 -4
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +164 -28
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/types.d.ts +73 -3
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/mcp/types.js +1 -0
- package/dist/mcp/types.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tuiuiu MCP Completions
|
|
3
|
+
*
|
|
4
|
+
* Provides argument completions for MCP tools to help AI assistants
|
|
5
|
+
* provide better suggestions when calling tools.
|
|
6
|
+
*/
|
|
7
|
+
export interface MCPCompletionRef {
|
|
8
|
+
type: 'ref/prompt' | 'ref/resource';
|
|
9
|
+
name?: string;
|
|
10
|
+
uri?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MCPCompletionArgument {
|
|
13
|
+
name: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
export interface MCPCompletionRequest {
|
|
17
|
+
ref: MCPCompletionRef;
|
|
18
|
+
argument: MCPCompletionArgument;
|
|
19
|
+
}
|
|
20
|
+
export interface MCPCompletionResult {
|
|
21
|
+
values: string[];
|
|
22
|
+
total?: number;
|
|
23
|
+
hasMore?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get completions for a prompt argument
|
|
27
|
+
*/
|
|
28
|
+
export declare function getPromptCompletions(promptName: string, argName: string, argValue: string): MCPCompletionResult;
|
|
29
|
+
/**
|
|
30
|
+
* Get completions for a resource URI
|
|
31
|
+
*/
|
|
32
|
+
export declare function getResourceCompletions(uriTemplate: string, argName: string, argValue: string): MCPCompletionResult;
|
|
33
|
+
/**
|
|
34
|
+
* Get completions for tool arguments
|
|
35
|
+
*/
|
|
36
|
+
export declare function getToolCompletions(toolName: string, argName: string, argValue: string): MCPCompletionResult;
|
|
37
|
+
//# sourceMappingURL=completions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completions.d.ts","sourceRoot":"","sources":["../../src/mcp/completions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,YAAY,GAAG,cAAc,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,gBAAgB,CAAC;IACtB,QAAQ,EAAE,qBAAqB,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,mBAAmB,CAgGrB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,mBAAmB,CAkDrB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,mBAAmB,CAuCrB"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tuiuiu MCP Completions
|
|
3
|
+
*
|
|
4
|
+
* Provides argument completions for MCP tools to help AI assistants
|
|
5
|
+
* provide better suggestions when calling tools.
|
|
6
|
+
*/
|
|
7
|
+
import { allComponents, allHooks, allThemes, categories, } from './docs-data.js';
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Completion Handlers
|
|
10
|
+
// =============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Get completions for a prompt argument
|
|
13
|
+
*/
|
|
14
|
+
export function getPromptCompletions(promptName, argName, argValue) {
|
|
15
|
+
const lowerValue = argValue.toLowerCase();
|
|
16
|
+
switch (promptName) {
|
|
17
|
+
case 'create_dashboard':
|
|
18
|
+
if (argName === 'style') {
|
|
19
|
+
return filterCompletions(['minimal', 'detailed', 'gaming'], lowerValue);
|
|
20
|
+
}
|
|
21
|
+
if (argName === 'metrics') {
|
|
22
|
+
return filterCompletions([
|
|
23
|
+
'cpu', 'memory', 'disk', 'network',
|
|
24
|
+
'requests', 'errors', 'latency', 'throughput',
|
|
25
|
+
'users', 'sessions', 'events', 'revenue',
|
|
26
|
+
], lowerValue);
|
|
27
|
+
}
|
|
28
|
+
break;
|
|
29
|
+
case 'create_form':
|
|
30
|
+
if (argName === 'fields') {
|
|
31
|
+
return filterCompletions([
|
|
32
|
+
'name:text', 'email:email', 'password:password',
|
|
33
|
+
'role:select', 'active:checkbox', 'bio:textarea',
|
|
34
|
+
'phone:text', 'age:number', 'website:url',
|
|
35
|
+
], lowerValue);
|
|
36
|
+
}
|
|
37
|
+
if (argName === 'validation') {
|
|
38
|
+
return filterCompletions(['yes', 'no'], lowerValue);
|
|
39
|
+
}
|
|
40
|
+
break;
|
|
41
|
+
case 'create_cli_app':
|
|
42
|
+
if (argName === 'commands') {
|
|
43
|
+
return filterCompletions([
|
|
44
|
+
'init', 'build', 'deploy', 'status', 'logs',
|
|
45
|
+
'config', 'version', 'help', 'update', 'clean',
|
|
46
|
+
'test', 'lint', 'format', 'publish', 'install',
|
|
47
|
+
], lowerValue);
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
case 'create_file_browser':
|
|
51
|
+
if (argName === 'features') {
|
|
52
|
+
return filterCompletions([
|
|
53
|
+
'preview', 'search', 'delete', 'rename',
|
|
54
|
+
'hidden', 'permissions', 'size', 'modified',
|
|
55
|
+
], lowerValue);
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
case 'create_data_table':
|
|
59
|
+
if (argName === 'features') {
|
|
60
|
+
return filterCompletions([
|
|
61
|
+
'sort', 'filter', 'paginate', 'select',
|
|
62
|
+
'edit', 'delete', 'export', 'resize',
|
|
63
|
+
], lowerValue);
|
|
64
|
+
}
|
|
65
|
+
break;
|
|
66
|
+
case 'explain_component':
|
|
67
|
+
if (argName === 'component') {
|
|
68
|
+
return filterCompletions(allComponents.map(c => c.name), lowerValue);
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
case 'compare_patterns':
|
|
72
|
+
if (argName === 'pattern') {
|
|
73
|
+
return filterCompletions([
|
|
74
|
+
'state management', 'form handling', 'routing',
|
|
75
|
+
'data fetching', 'error handling', 'layout',
|
|
76
|
+
'theming', 'animations', 'input handling',
|
|
77
|
+
], lowerValue);
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
case 'create_theme':
|
|
81
|
+
if (argName === 'style') {
|
|
82
|
+
return filterCompletions([
|
|
83
|
+
'dark', 'light', 'high-contrast', 'monochrome',
|
|
84
|
+
], lowerValue);
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
case 'create_game':
|
|
88
|
+
if (argName === 'type') {
|
|
89
|
+
return filterCompletions([
|
|
90
|
+
'snake', 'tetris', 'pong', 'roguelike',
|
|
91
|
+
'breakout', 'asteroids', 'minesweeper', 'custom',
|
|
92
|
+
], lowerValue);
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
return { values: [] };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get completions for a resource URI
|
|
100
|
+
*/
|
|
101
|
+
export function getResourceCompletions(uriTemplate, argName, argValue) {
|
|
102
|
+
const lowerValue = argValue.toLowerCase();
|
|
103
|
+
// Component names
|
|
104
|
+
if (uriTemplate.includes('{name}') && uriTemplate.includes('component')) {
|
|
105
|
+
return filterCompletions(allComponents.map(c => c.name), lowerValue);
|
|
106
|
+
}
|
|
107
|
+
// Hook names
|
|
108
|
+
if (uriTemplate.includes('{name}') && uriTemplate.includes('hook')) {
|
|
109
|
+
return filterCompletions(allHooks.map(h => h.name), lowerValue);
|
|
110
|
+
}
|
|
111
|
+
// Theme names
|
|
112
|
+
if (uriTemplate.includes('{name}') && uriTemplate.includes('theme')) {
|
|
113
|
+
return filterCompletions(allThemes.map(t => t.name), lowerValue);
|
|
114
|
+
}
|
|
115
|
+
// Categories
|
|
116
|
+
if (uriTemplate.includes('{category}')) {
|
|
117
|
+
return filterCompletions(Object.keys(categories), lowerValue);
|
|
118
|
+
}
|
|
119
|
+
// Examples
|
|
120
|
+
if (uriTemplate.includes('{id}') && uriTemplate.includes('example')) {
|
|
121
|
+
return filterCompletions([
|
|
122
|
+
'counter', 'dashboard', 'form', 'file-browser',
|
|
123
|
+
'data-table', 'command-palette', 'wizard', 'game-snake',
|
|
124
|
+
], lowerValue);
|
|
125
|
+
}
|
|
126
|
+
// Guides
|
|
127
|
+
if (uriTemplate.includes('{topic}')) {
|
|
128
|
+
return filterCompletions([
|
|
129
|
+
'getting-started', 'custom-themes', 'migration-ink',
|
|
130
|
+
'migration-blessed', 'signals', 'layout',
|
|
131
|
+
'input-handling', 'animations',
|
|
132
|
+
], lowerValue);
|
|
133
|
+
}
|
|
134
|
+
return { values: [] };
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Get completions for tool arguments
|
|
138
|
+
*/
|
|
139
|
+
export function getToolCompletions(toolName, argName, argValue) {
|
|
140
|
+
const lowerValue = argValue.toLowerCase();
|
|
141
|
+
switch (toolName) {
|
|
142
|
+
case 'tuiuiu_list_components':
|
|
143
|
+
if (argName === 'category') {
|
|
144
|
+
return filterCompletions(Object.keys(categories), lowerValue);
|
|
145
|
+
}
|
|
146
|
+
break;
|
|
147
|
+
case 'tuiuiu_get_component':
|
|
148
|
+
if (argName === 'name') {
|
|
149
|
+
return filterCompletions(allComponents.map(c => c.name), lowerValue);
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
case 'tuiuiu_get_hook':
|
|
153
|
+
if (argName === 'name') {
|
|
154
|
+
return filterCompletions(allHooks.map(h => h.name), lowerValue);
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
case 'tuiuiu_quickstart':
|
|
158
|
+
if (argName === 'pattern') {
|
|
159
|
+
return filterCompletions([
|
|
160
|
+
'header', 'status', 'dashboard', 'form',
|
|
161
|
+
'game', 'theme', 'navigation', 'modal',
|
|
162
|
+
], lowerValue);
|
|
163
|
+
}
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
return { values: [] };
|
|
167
|
+
}
|
|
168
|
+
// =============================================================================
|
|
169
|
+
// Helpers
|
|
170
|
+
// =============================================================================
|
|
171
|
+
function filterCompletions(options, prefix, limit = 10) {
|
|
172
|
+
const filtered = options.filter(opt => opt.toLowerCase().startsWith(prefix) ||
|
|
173
|
+
opt.toLowerCase().includes(prefix));
|
|
174
|
+
// Sort: exact prefix matches first, then contains matches
|
|
175
|
+
filtered.sort((a, b) => {
|
|
176
|
+
const aStarts = a.toLowerCase().startsWith(prefix);
|
|
177
|
+
const bStarts = b.toLowerCase().startsWith(prefix);
|
|
178
|
+
if (aStarts && !bStarts)
|
|
179
|
+
return -1;
|
|
180
|
+
if (!aStarts && bStarts)
|
|
181
|
+
return 1;
|
|
182
|
+
return a.localeCompare(b);
|
|
183
|
+
});
|
|
184
|
+
return {
|
|
185
|
+
values: filtered.slice(0, limit),
|
|
186
|
+
total: filtered.length,
|
|
187
|
+
hasMore: filtered.length > limit,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=completions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completions.js","sourceRoot":"","sources":["../../src/mcp/completions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,aAAa,EACb,QAAQ,EACR,SAAS,EACT,UAAU,GACX,MAAM,gBAAgB,CAAC;AA4BxB,gFAAgF;AAChF,sBAAsB;AACtB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAkB,EAClB,OAAe,EACf,QAAgB;IAEhB,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAE1C,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,kBAAkB;YACrB,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;gBACxB,OAAO,iBAAiB,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC;YAC1E,CAAC;YACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,OAAO,iBAAiB,CAAC;oBACvB,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS;oBAClC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY;o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ation tools
|
|
8
|
+
* - Resources: Component, hook, theme, and guide resources
|
|
9
|
+
* - Resource Templates: Dynamic URIs for flexible access
|
|
10
|
+
* - Prompts: 15+ pre-defined prompts for common tasks
|
|
11
|
+
* - Completions: Argument autocompletion for tools and prompts
|
|
12
|
+
* - Logging: Structured logging to clients
|
|
13
|
+
*
|
|
6
14
|
* Usage:
|
|
7
15
|
* npx tuiuiu.js@latest mcp # Start stdio server (for Claude Code)
|
|
8
16
|
* npx tuiuiu.js@latest mcp --http # Start HTTP server
|
|
@@ -10,5 +18,13 @@
|
|
|
10
18
|
export { MCPServer, runMcpServer } from './server.js';
|
|
11
19
|
export type { MCPServerOptions } from './server.js';
|
|
12
20
|
export { allComponents, allHooks, allThemes, categories, } from './docs-data.js';
|
|
13
|
-
export
|
|
21
|
+
export { prompts, getPromptResult } from './prompts.js';
|
|
22
|
+
export type { MCPPrompt, MCPPromptResult, MCPPromptMessage } from './prompts.js';
|
|
23
|
+
export { getStaticResources, getResourceTemplates, readResource, } from './resources.js';
|
|
24
|
+
export type { MCPResourceTemplate, MCPResourceContents } from './resources.js';
|
|
25
|
+
export { getPromptCompletions, getResourceCompletions, getToolCompletions, } from './completions.js';
|
|
26
|
+
export type { MCPCompletionRequest, MCPCompletionResult } from './completions.js';
|
|
27
|
+
export { createMCPLogger, nullLogger, createProgressReporter, createResourceNotifier, } from './logging.js';
|
|
28
|
+
export type { MCPLogLevel, MCPLogMessage, LogSender, } from './logging.js';
|
|
29
|
+
export type { JsonRpcRequest, JsonRpcResponse, JsonRpcNotification, MCPTool, MCPToolResult, MCPResource, MCPCapabilities, MCPInitializeResult, ComponentDoc, HookDoc, ThemeDoc, } from './types.js';
|
|
14
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/mcp/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EACL,aAAa,EACb,QAAQ,EACR,SAAS,EACT,UAAU,GACX,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGjF,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG/E,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGlF,OAAO,EACL,eAAe,EACf,UAAU,EACV,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,OAAO,EACP,aAAa,EACb,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,OAAO,EACP,QAAQ,GACT,MAAM,YAAY,CAAC"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -3,10 +3,28 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides AI assistants with access to Tuiuiu documentation.
|
|
5
5
|
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - Tools: 9 documentation tools
|
|
8
|
+
* - Resources: Component, hook, theme, and guide resources
|
|
9
|
+
* - Resource Templates: Dynamic URIs for flexible access
|
|
10
|
+
* - Prompts: 15+ pre-defined prompts for common tasks
|
|
11
|
+
* - Completions: Argument autocompletion for tools and prompts
|
|
12
|
+
* - Logging: Structured logging to clients
|
|
13
|
+
*
|
|
6
14
|
* Usage:
|
|
7
15
|
* npx tuiuiu.js@latest mcp # Start stdio server (for Claude Code)
|
|
8
16
|
* npx tuiuiu.js@latest mcp --http # Start HTTP server
|
|
9
17
|
*/
|
|
18
|
+
// Server
|
|
10
19
|
export { MCPServer, runMcpServer } from './server.js';
|
|
20
|
+
// Documentation data
|
|
11
21
|
export { allComponents, allHooks, allThemes, categories, } from './docs-data.js';
|
|
22
|
+
// Prompts
|
|
23
|
+
export { prompts, getPromptResult } from './prompts.js';
|
|
24
|
+
// Resources
|
|
25
|
+
export { getStaticResources, getResourceTemplates, readResource, } from './resources.js';
|
|
26
|
+
// Completions
|
|
27
|
+
export { getPromptCompletions, getResourceCompletions, getToolCompletions, } from './completions.js';
|
|
28
|
+
// Logging
|
|
29
|
+
export { createMCPLogger, nullLogger, createProgressReporter, createResourceNotifier, } from './logging.js';
|
|
12
30
|
//# sourceMappingURL=index.js.map
|
package/dist/mcp/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,SAAS;AACT,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGtD,qBAAqB;AACrB,OAAO,EACL,aAAa,EACb,QAAQ,EACR,SAAS,EACT,UAAU,GACX,MAAM,gBAAgB,CAAC;AAExB,UAAU;AACV,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGxD,YAAY;AACZ,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,GACb,MAAM,gBAAgB,CAAC;AAGxB,cAAc;AACd,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAG1B,UAAU;AACV,OAAO,EACL,eAAe,EACf,UAAU,EACV,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tuiuiu MCP Logging
|
|
3
|
+
*
|
|
4
|
+
* Structured logging system for MCP server that sends log messages
|
|
5
|
+
* to connected clients via notifications.
|
|
6
|
+
*/
|
|
7
|
+
export type MCPLogLevel = 'debug' | 'info' | 'notice' | 'warning' | 'error' | 'critical' | 'alert' | 'emergency';
|
|
8
|
+
export interface MCPLogMessage {
|
|
9
|
+
level: MCPLogLevel;
|
|
10
|
+
logger?: string;
|
|
11
|
+
data?: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface MCPLogNotification {
|
|
14
|
+
jsonrpc: '2.0';
|
|
15
|
+
method: 'notifications/message';
|
|
16
|
+
params: MCPLogMessage;
|
|
17
|
+
}
|
|
18
|
+
export type LogSender = (notification: MCPLogNotification) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Create a structured logger for MCP
|
|
21
|
+
*/
|
|
22
|
+
export declare function createMCPLogger(sender: LogSender | null, options?: {
|
|
23
|
+
name?: string;
|
|
24
|
+
minLevel?: MCPLogLevel;
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
}): {
|
|
27
|
+
debug: (message: string, data?: unknown) => void;
|
|
28
|
+
info: (message: string, data?: unknown) => void;
|
|
29
|
+
notice: (message: string, data?: unknown) => void;
|
|
30
|
+
warning: (message: string, data?: unknown) => void;
|
|
31
|
+
error: (message: string, data?: unknown) => void;
|
|
32
|
+
critical: (message: string, data?: unknown) => void;
|
|
33
|
+
alert: (message: string, data?: unknown) => void;
|
|
34
|
+
emergency: (message: string, data?: unknown) => void;
|
|
35
|
+
toolCall: (name: string, args?: unknown) => void;
|
|
36
|
+
toolResult: (name: string, success: boolean, duration?: number) => void;
|
|
37
|
+
promptGet: (name: string, args?: unknown) => void;
|
|
38
|
+
resourceRead: (uri: string) => void;
|
|
39
|
+
sessionStart: () => void;
|
|
40
|
+
sessionEnd: () => void;
|
|
41
|
+
};
|
|
42
|
+
export declare const nullLogger: {
|
|
43
|
+
debug: (message: string, data?: unknown) => void;
|
|
44
|
+
info: (message: string, data?: unknown) => void;
|
|
45
|
+
notice: (message: string, data?: unknown) => void;
|
|
46
|
+
warning: (message: string, data?: unknown) => void;
|
|
47
|
+
error: (message: string, data?: unknown) => void;
|
|
48
|
+
critical: (message: string, data?: unknown) => void;
|
|
49
|
+
alert: (message: string, data?: unknown) => void;
|
|
50
|
+
emergency: (message: string, data?: unknown) => void;
|
|
51
|
+
toolCall: (name: string, args?: unknown) => void;
|
|
52
|
+
toolResult: (name: string, success: boolean, duration?: number) => void;
|
|
53
|
+
promptGet: (name: string, args?: unknown) => void;
|
|
54
|
+
resourceRead: (uri: string) => void;
|
|
55
|
+
sessionStart: () => void;
|
|
56
|
+
sessionEnd: () => void;
|
|
57
|
+
};
|
|
58
|
+
export interface MCPProgressToken {
|
|
59
|
+
token: string | number;
|
|
60
|
+
}
|
|
61
|
+
export interface MCPProgressNotification {
|
|
62
|
+
method: 'notifications/progress';
|
|
63
|
+
params: {
|
|
64
|
+
progressToken: string | number;
|
|
65
|
+
progress: number;
|
|
66
|
+
total?: number;
|
|
67
|
+
message?: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Create a progress reporter for long-running operations
|
|
72
|
+
*/
|
|
73
|
+
export declare function createProgressReporter(sender: ((notification: MCPProgressNotification) => void) | null, token: string | number): {
|
|
74
|
+
update: (progress: number, total?: number, message?: string) => void;
|
|
75
|
+
complete: (message?: string) => void;
|
|
76
|
+
};
|
|
77
|
+
export interface MCPResourceUpdatedNotification {
|
|
78
|
+
method: 'notifications/resources/updated';
|
|
79
|
+
params: {
|
|
80
|
+
uri: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export interface MCPResourceListChangedNotification {
|
|
84
|
+
method: 'notifications/resources/list_changed';
|
|
85
|
+
params: {};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Notify clients that resources have been updated
|
|
89
|
+
*/
|
|
90
|
+
export declare function createResourceNotifier(sender: ((notification: MCPResourceUpdatedNotification | MCPResourceListChangedNotification) => void) | null): {
|
|
91
|
+
updated: (uri: string) => void;
|
|
92
|
+
listChanged: () => void;
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/mcp/logging.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,CAAC;AAEjH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,uBAAuB,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,YAAY,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAMnE;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,GAAG,IAAI,EACxB,OAAO,GAAE;IACP,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAA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C,MAAM,EAAE,iCAAiC,CAAC;IAC1C,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,kCAAkC;IACjD,MAAM,EAAE,sCAAsC,CAAC;IAC/C,MAAM,EAAE,EAAE,CAAC;CACZ;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,CAAC,CAAC,YAAY,EAAE,8BAA8B,GAAG,kCAAkC,KAAK,IAAI,CAAC,GAAG,IAAI;mBAU3F,MAAM;;EAaxB"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tuiuiu MCP Logging
|
|
3
|
+
*
|
|
4
|
+
* Structured logging system for MCP server that sends log messages
|
|
5
|
+
* to connected clients via notifications.
|
|
6
|
+
*/
|
|
7
|
+
// =============================================================================
|
|
8
|
+
// Logger Implementation
|
|
9
|
+
// =============================================================================
|
|
10
|
+
/**
|
|
11
|
+
* Create a structured logger for MCP
|
|
12
|
+
*/
|
|
13
|
+
export function createMCPLogger(sender, options = {}) {
|
|
14
|
+
const { name = 'tuiuiu', minLevel = 'info', enabled = true } = options;
|
|
15
|
+
const levels = {
|
|
16
|
+
debug: 0,
|
|
17
|
+
info: 1,
|
|
18
|
+
notice: 2,
|
|
19
|
+
warning: 3,
|
|
20
|
+
error: 4,
|
|
21
|
+
critical: 5,
|
|
22
|
+
alert: 6,
|
|
23
|
+
emergency: 7,
|
|
24
|
+
};
|
|
25
|
+
const shouldLog = (level) => {
|
|
26
|
+
if (!enabled || !sender)
|
|
27
|
+
return false;
|
|
28
|
+
return levels[level] >= levels[minLevel];
|
|
29
|
+
};
|
|
30
|
+
const log = (level, message, data) => {
|
|
31
|
+
if (!shouldLog(level))
|
|
32
|
+
return;
|
|
33
|
+
const logData = {
|
|
34
|
+
message,
|
|
35
|
+
timestamp: new Date().toISOString(),
|
|
36
|
+
};
|
|
37
|
+
if (data !== undefined) {
|
|
38
|
+
logData.context = data;
|
|
39
|
+
}
|
|
40
|
+
sender({
|
|
41
|
+
jsonrpc: '2.0',
|
|
42
|
+
method: 'notifications/message',
|
|
43
|
+
params: {
|
|
44
|
+
level,
|
|
45
|
+
logger: name,
|
|
46
|
+
data: logData,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
debug: (message, data) => log('debug', message, data),
|
|
52
|
+
info: (message, data) => log('info', message, data),
|
|
53
|
+
notice: (message, data) => log('notice', message, data),
|
|
54
|
+
warning: (message, data) => log('warning', message, data),
|
|
55
|
+
error: (message, data) => log('error', message, data),
|
|
56
|
+
critical: (message, data) => log('critical', message, data),
|
|
57
|
+
alert: (message, data) => log('alert', message, data),
|
|
58
|
+
emergency: (message, data) => log('emergency', message, data),
|
|
59
|
+
// Convenience methods
|
|
60
|
+
toolCall: (name, args) => {
|
|
61
|
+
log('info', `Tool called: ${name}`, args ? { arguments: args } : undefined);
|
|
62
|
+
},
|
|
63
|
+
toolResult: (name, success, duration) => {
|
|
64
|
+
log('info', `Tool completed: ${name}`, { success, duration: duration ? `${duration}ms` : undefined });
|
|
65
|
+
},
|
|
66
|
+
promptGet: (name, args) => {
|
|
67
|
+
log('info', `Prompt retrieved: ${name}`, args ? { arguments: args } : undefined);
|
|
68
|
+
},
|
|
69
|
+
resourceRead: (uri) => {
|
|
70
|
+
log('info', `Resource read: ${uri}`);
|
|
71
|
+
},
|
|
72
|
+
sessionStart: () => {
|
|
73
|
+
log('notice', 'MCP session started');
|
|
74
|
+
},
|
|
75
|
+
sessionEnd: () => {
|
|
76
|
+
log('notice', 'MCP session ended');
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// =============================================================================
|
|
81
|
+
// Null Logger (for non-connected mode)
|
|
82
|
+
// =============================================================================
|
|
83
|
+
export const nullLogger = createMCPLogger(null, { enabled: false });
|
|
84
|
+
/**
|
|
85
|
+
* Create a progress reporter for long-running operations
|
|
86
|
+
*/
|
|
87
|
+
export function createProgressReporter(sender, token) {
|
|
88
|
+
if (!sender) {
|
|
89
|
+
return {
|
|
90
|
+
update: () => { },
|
|
91
|
+
complete: () => { },
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
update: (progress, total, message) => {
|
|
96
|
+
sender({
|
|
97
|
+
method: 'notifications/progress',
|
|
98
|
+
params: {
|
|
99
|
+
progressToken: token,
|
|
100
|
+
progress,
|
|
101
|
+
total,
|
|
102
|
+
message,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
complete: (message) => {
|
|
107
|
+
sender({
|
|
108
|
+
method: 'notifications/progress',
|
|
109
|
+
params: {
|
|
110
|
+
progressToken: token,
|
|
111
|
+
progress: 1,
|
|
112
|
+
total: 1,
|
|
113
|
+
message: message || 'Complete',
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Notify clients that resources have been updated
|
|
121
|
+
*/
|
|
122
|
+
export function createResourceNotifier(sender) {
|
|
123
|
+
if (!sender) {
|
|
124
|
+
return {
|
|
125
|
+
updated: () => { },
|
|
126
|
+
listChanged: () => { },
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
updated: (uri) => {
|
|
131
|
+
sender({
|
|
132
|
+
method: 'notifications/resources/updated',
|
|
133
|
+
params: { uri },
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
listChanged: () => {
|
|
137
|
+
sender({
|
|
138
|
+
method: 'notifications/resources/list_changed',
|
|
139
|
+
params: {},
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/mcp/logging.ts"],"names":[],"mappings":"AAAA;;;;;GAK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AAE,CAAC,OAAgB,EAAE,EAAE;YAC7B,MAAM,CAAC;gBACL,MAAM,EAAE,wBAAwB;gBAChC,MAAM,EAAE;oBACN,aAAa,EAAE,KAAK;oBACpB,QAAQ,EAAE,CAAC;oBACX,KAAK,EAAE,CAAC;oBACR,OAAO,EAAE,OAAO,IAAI,UAAU;iBAC/B;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAkBD;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAA4G;IAE5G,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;YACjB,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;SACtB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE;YACvB,MAAM,CAAC;gBACL,MAAM,EAAE,iCAAiC;gBACzC,MAAM,EAAE,EAAE,GAAG,EAAE;aAChB,CAAC,CAAC;QACL,CAAC;QACD,WAAW,EAAE,GAAG,EAAE;YAChB,MAAM,CAAC;gBACL,MAAM,EAAE,sCAAsC;gBAC9C,MAAM,EAAE,EAAE;aACX,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tuiuiu MCP Prompts
|
|
3
|
+
*
|
|
4
|
+
* Pre-defined prompt templates that help AI assistants create
|
|
5
|
+
* Tuiuiu applications more effectively.
|
|
6
|
+
*/
|
|
7
|
+
export interface MCPPromptArgument {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
required: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface MCPPrompt {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
arguments?: MCPPromptArgument[];
|
|
16
|
+
}
|
|
17
|
+
export interface MCPPromptMessage {
|
|
18
|
+
role: 'user' | 'assistant';
|
|
19
|
+
content: {
|
|
20
|
+
type: 'text';
|
|
21
|
+
text: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface MCPPromptResult {
|
|
25
|
+
description: string;
|
|
26
|
+
messages: MCPPromptMessage[];
|
|
27
|
+
}
|
|
28
|
+
export declare const prompts: MCPPrompt[];
|
|
29
|
+
export declare function getPromptResult(name: string, args: Record<string, string>): MCPPromptResult | null;
|
|
30
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/mcp/prompts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B;AAMD,eAAO,MAAM,OAAO,EAAE,SAAS,EAgO9B,CAAC;AAMF,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,eAAe,GAAG,IAAI,CAmCxB"}
|