@trikhub/mcp 0.2.0 → 0.13.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 +21 -30
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +434 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/analyze.d.ts +9 -0
- package/dist/tools/analyze.d.ts.map +1 -0
- package/dist/tools/analyze.js +243 -0
- package/dist/tools/analyze.js.map +1 -0
- package/dist/tools/design.d.ts +36 -0
- package/dist/tools/design.d.ts.map +1 -0
- package/dist/tools/design.js +188 -0
- package/dist/tools/design.js.map +1 -0
- package/dist/tools/diagnose.d.ts +9 -0
- package/dist/tools/diagnose.d.ts.map +1 -0
- package/dist/tools/diagnose.js +186 -0
- package/dist/tools/diagnose.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +7 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/scaffold.d.ts +42 -0
- package/dist/tools/scaffold.d.ts.map +1 -0
- package/dist/tools/scaffold.js +758 -0
- package/dist/tools/scaffold.js.map +1 -0
- package/dist/tools/types.d.ts +71 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +5 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/validate.d.ts +9 -0
- package/dist/tools/validate.d.ts.map +1 -0
- package/dist/tools/validate.js +179 -0
- package/dist/tools/validate.js.map +1 -0
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -4,11 +4,11 @@ An MCP (Model Context Protocol) server for AI-assisted trik authoring. Use your
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Guided trik creation** - Describe what you want, get a complete trik scaffold
|
|
8
|
-
- **Manifest validation** - Real-time feedback on
|
|
9
|
-
- **
|
|
10
|
-
- **Error diagnosis** - Understand and fix validation/publish errors
|
|
11
|
-
- **Documentation access** -
|
|
7
|
+
- **Guided trik creation** - Describe what you want, get a complete v2 trik scaffold with agent, tools, and system prompt
|
|
8
|
+
- **Manifest validation** - Real-time feedback on quality score, log schema constraints, and schema correctness
|
|
9
|
+
- **Tool design** - Interactive tool declaration design with logTemplate and logSchema
|
|
10
|
+
- **Error diagnosis** - Understand and fix validation/publish/runtime errors with context-aware guidance
|
|
11
|
+
- **Documentation access** - v2 manifest schema reference
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -80,29 +80,18 @@ trik mcp --stdio # Start server in stdio mode
|
|
|
80
80
|
|
|
81
81
|
| Tool | Description |
|
|
82
82
|
|------|-------------|
|
|
83
|
-
| `analyze_trik_requirements` | Analyze description and suggest
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `scaffold_trik` | Generate complete trik structure |
|
|
87
|
-
| `validate_manifest` | Validate manifest
|
|
88
|
-
| `diagnose_error` | Explain and fix errors |
|
|
83
|
+
| `analyze_trik_requirements` | Analyze description and suggest agent mode, domain tags, and tools |
|
|
84
|
+
| `design_tool` | Design a tool declaration with logTemplate and logSchema |
|
|
85
|
+
| `design_log_schema` | Create constrained logSchema for log template placeholders |
|
|
86
|
+
| `scaffold_trik` | Generate complete v2 trik project structure |
|
|
87
|
+
| `validate_manifest` | Validate v2 manifest with quality score |
|
|
88
|
+
| `diagnose_error` | Explain and fix v2 errors with context-aware guidance |
|
|
89
89
|
|
|
90
90
|
## Available Resources
|
|
91
91
|
|
|
92
92
|
| Resource | Description |
|
|
93
93
|
|----------|-------------|
|
|
94
|
-
| `trikhub://docs/manifest-schema` |
|
|
95
|
-
| `trikhub://docs/security-model` | Type-Directed Privilege Separation guide |
|
|
96
|
-
| `trikhub://docs/response-modes` | Template vs passthrough explanation |
|
|
97
|
-
| `trikhub://examples/all` | Example trik patterns for common use cases |
|
|
98
|
-
|
|
99
|
-
## Available Prompts
|
|
100
|
-
|
|
101
|
-
| Prompt | Description |
|
|
102
|
-
|--------|-------------|
|
|
103
|
-
| `create-trik` | Guided trik creation conversation |
|
|
104
|
-
| `debug-manifest` | Debug invalid manifests |
|
|
105
|
-
| `add-api-integration` | Add external API action |
|
|
94
|
+
| `trikhub://docs/manifest-schema` | v2 manifest schema reference with examples |
|
|
106
95
|
|
|
107
96
|
## Development
|
|
108
97
|
|
|
@@ -125,19 +114,21 @@ pnpm dev
|
|
|
125
114
|
|
|
126
115
|
The MCP server provides structured tools that guide you through trik creation:
|
|
127
116
|
|
|
128
|
-
1. **Exploration** - `analyze_trik_requirements` understands your intent
|
|
129
|
-
2. **Design** - `
|
|
130
|
-
3. **Scaffold** - `scaffold_trik` generates the complete project
|
|
131
|
-
4. **Validate** - `validate_manifest`
|
|
117
|
+
1. **Exploration** - `analyze_trik_requirements` understands your intent and suggests agent mode, domain tags, and tools
|
|
118
|
+
2. **Design** - `design_tool` and `design_log_schema` create valid tool declarations with constrained log schemas
|
|
119
|
+
3. **Scaffold** - `scaffold_trik` generates the complete v2 project (manifest, agent.ts with wrapAgent(), system prompt, tool files)
|
|
120
|
+
4. **Validate** - `validate_manifest` checks correctness and reports a quality score (0-100)
|
|
121
|
+
5. **Diagnose** - `diagnose_error` explains errors with context-specific fix suggestions
|
|
132
122
|
|
|
133
123
|
The LLM orchestrates these tools through natural conversation, asking clarifying questions and iterating on designs.
|
|
134
124
|
|
|
135
125
|
## Related Packages
|
|
136
126
|
|
|
137
127
|
- [@trikhub/cli](../cli) - Command-line tool for trik management
|
|
138
|
-
- [@trikhub/gateway](../gateway) -
|
|
139
|
-
- [@trikhub/manifest](../manifest) -
|
|
140
|
-
- [@trikhub/
|
|
128
|
+
- [@trikhub/gateway](../gateway) - Handoff routing and agent orchestration
|
|
129
|
+
- [@trikhub/manifest](../manifest) - v2 manifest types and validation
|
|
130
|
+
- [@trikhub/sdk](../sdk) - wrapAgent() and tool interception for trik agents
|
|
131
|
+
- [@trikhub/linter](../linter) - Static analysis for trik quality
|
|
141
132
|
|
|
142
133
|
## License
|
|
143
134
|
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* TrikHub MCP Server — v2
|
|
4
|
+
*
|
|
5
|
+
* An MCP server that helps developers create, validate, and manage Triks
|
|
6
|
+
* through AI-assisted authoring in IDEs like Claude Code and VS Code.
|
|
7
|
+
*/
|
|
8
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { analyzeTrikRequirements, designTool, designLogSchema, scaffoldTrik, validateTrikManifest, diagnoseErrorTool, } from './tools/index.js';
|
|
12
|
+
// Create the MCP server
|
|
13
|
+
const server = new McpServer({
|
|
14
|
+
name: 'trikhub',
|
|
15
|
+
version: '0.2.0',
|
|
16
|
+
});
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Tool 1: analyze_trik_requirements
|
|
19
|
+
// ============================================================================
|
|
20
|
+
server.tool('analyze_trik_requirements', 'Analyze a user description and suggest trik architecture, agent mode, tools, and capabilities. Call this first to understand what to build.', {
|
|
21
|
+
description: z.string().describe('What the user wants the trik to do'),
|
|
22
|
+
constraints: z.string().optional().describe('Any specific requirements (API, language, etc)'),
|
|
23
|
+
}, async ({ description, constraints }) => {
|
|
24
|
+
const result = analyzeTrikRequirements(description, constraints);
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// Tool 2: design_tool
|
|
31
|
+
// ============================================================================
|
|
32
|
+
server.tool('design_tool', 'Design a single trik tool with proper log template and log schema. Enforces security rules for log values.', {
|
|
33
|
+
toolName: z.string().describe('Name of the tool (e.g., "searchArticles")'),
|
|
34
|
+
purpose: z.string().describe('What the tool does'),
|
|
35
|
+
logFields: z
|
|
36
|
+
.array(z.object({
|
|
37
|
+
name: z.string().describe('Field name'),
|
|
38
|
+
type: z
|
|
39
|
+
.enum(['string', 'number', 'integer', 'boolean'])
|
|
40
|
+
.describe('Field type'),
|
|
41
|
+
maxLength: z.number().optional().describe('Max length for strings'),
|
|
42
|
+
values: z
|
|
43
|
+
.array(z.string())
|
|
44
|
+
.optional()
|
|
45
|
+
.describe('For enums: list of allowed values'),
|
|
46
|
+
description: z.string().optional().describe('Field description'),
|
|
47
|
+
}))
|
|
48
|
+
.optional()
|
|
49
|
+
.describe('Log fields for structured logging'),
|
|
50
|
+
}, async ({ toolName, purpose, logFields }) => {
|
|
51
|
+
const result = designTool(toolName, purpose, logFields);
|
|
52
|
+
return {
|
|
53
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
// ============================================================================
|
|
57
|
+
// Tool 3: design_log_schema
|
|
58
|
+
// ============================================================================
|
|
59
|
+
server.tool('design_log_schema', 'Create a logSchema for log template placeholders. Enforces constrained types for security.', {
|
|
60
|
+
fields: z
|
|
61
|
+
.array(z.object({
|
|
62
|
+
name: z.string().describe('Field name'),
|
|
63
|
+
type: z
|
|
64
|
+
.enum(['string', 'number', 'integer', 'boolean', 'array', 'object'])
|
|
65
|
+
.describe('Field type'),
|
|
66
|
+
maxLength: z.number().optional().describe('Max length for strings'),
|
|
67
|
+
values: z
|
|
68
|
+
.array(z.string())
|
|
69
|
+
.optional()
|
|
70
|
+
.describe('For enums: list of allowed values'),
|
|
71
|
+
description: z.string().optional().describe('Field description'),
|
|
72
|
+
}))
|
|
73
|
+
.describe('Fields to include in the logSchema'),
|
|
74
|
+
}, async ({ fields }) => {
|
|
75
|
+
const result = designLogSchema(fields);
|
|
76
|
+
return {
|
|
77
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
// ============================================================================
|
|
81
|
+
// Tool 4: scaffold_trik
|
|
82
|
+
// ============================================================================
|
|
83
|
+
server.tool('scaffold_trik', 'Generate a complete trik project structure with manifest, code, and config files.', {
|
|
84
|
+
name: z.string().describe('Trik name (lowercase, alphanumeric + dashes)'),
|
|
85
|
+
displayName: z.string().describe('Human-readable name'),
|
|
86
|
+
description: z.string().describe('Short description of what the trik does'),
|
|
87
|
+
language: z.enum(['ts', 'py']).describe('TypeScript or Python'),
|
|
88
|
+
category: z
|
|
89
|
+
.enum([
|
|
90
|
+
'utilities', 'productivity', 'developer', 'data', 'search',
|
|
91
|
+
'content', 'communication', 'finance', 'entertainment', 'education', 'other',
|
|
92
|
+
])
|
|
93
|
+
.describe('Category for the trik'),
|
|
94
|
+
mode: z
|
|
95
|
+
.enum(['conversational', 'tool'])
|
|
96
|
+
.describe('Agent mode: conversational (LLM agent) or tool (export native tools)'),
|
|
97
|
+
handoffDescription: z
|
|
98
|
+
.string()
|
|
99
|
+
.optional()
|
|
100
|
+
.describe('Description used for handoff routing (10-500 chars). Required for conversational mode, omit for tool mode.'),
|
|
101
|
+
domain: z
|
|
102
|
+
.array(z.string())
|
|
103
|
+
.describe('Domain tags for routing (e.g., ["content curation", "RSS feeds"])'),
|
|
104
|
+
tools: z
|
|
105
|
+
.array(z.object({
|
|
106
|
+
name: z.string(),
|
|
107
|
+
description: z.string(),
|
|
108
|
+
logTemplate: z.string().optional(),
|
|
109
|
+
logSchema: z.record(z.unknown()).optional(),
|
|
110
|
+
outputTemplate: z.string().optional().describe('Template for tool output sent to main LLM. Placeholders: {{field}}. Required for tool-mode.'),
|
|
111
|
+
}))
|
|
112
|
+
.optional()
|
|
113
|
+
.describe('Tool definitions'),
|
|
114
|
+
capabilities: z
|
|
115
|
+
.object({
|
|
116
|
+
storage: z.boolean().optional(),
|
|
117
|
+
session: z.boolean().optional(),
|
|
118
|
+
config: z
|
|
119
|
+
.array(z.object({ key: z.string(), description: z.string() }))
|
|
120
|
+
.optional(),
|
|
121
|
+
})
|
|
122
|
+
.optional()
|
|
123
|
+
.describe('Required capabilities'),
|
|
124
|
+
}, async (input) => {
|
|
125
|
+
const result = scaffoldTrik(input);
|
|
126
|
+
return {
|
|
127
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
// ============================================================================
|
|
131
|
+
// Tool 5: validate_manifest
|
|
132
|
+
// ============================================================================
|
|
133
|
+
server.tool('validate_manifest', 'Validate a trik manifest against schema and security rules. Returns errors, warnings, and quality score.', {
|
|
134
|
+
manifest: z.string().describe('The manifest.json content as a string'),
|
|
135
|
+
strict: z.boolean().optional().describe('Enable additional warnings'),
|
|
136
|
+
}, async ({ manifest, strict }) => {
|
|
137
|
+
const result = validateTrikManifest(manifest, strict);
|
|
138
|
+
return {
|
|
139
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
// ============================================================================
|
|
143
|
+
// Tool 6: diagnose_error
|
|
144
|
+
// ============================================================================
|
|
145
|
+
server.tool('diagnose_error', 'Explain an error message and suggest how to fix it.', {
|
|
146
|
+
error: z.string().describe('The error message to diagnose'),
|
|
147
|
+
context: z
|
|
148
|
+
.enum(['publish', 'lint', 'runtime'])
|
|
149
|
+
.optional()
|
|
150
|
+
.describe('Where the error occurred'),
|
|
151
|
+
}, async ({ error, context }) => {
|
|
152
|
+
const result = diagnoseErrorTool(error, context);
|
|
153
|
+
return {
|
|
154
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
155
|
+
};
|
|
156
|
+
});
|
|
157
|
+
// ============================================================================
|
|
158
|
+
// Resources
|
|
159
|
+
// ============================================================================
|
|
160
|
+
server.resource('manifest-schema', 'trikhub://docs/manifest-schema', { mimeType: 'text/markdown' }, async () => ({
|
|
161
|
+
contents: [
|
|
162
|
+
{
|
|
163
|
+
uri: 'trikhub://docs/manifest-schema',
|
|
164
|
+
mimeType: 'text/markdown',
|
|
165
|
+
text: MANIFEST_SCHEMA_DOC,
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
}));
|
|
169
|
+
const MANIFEST_SCHEMA_DOC = `# TrikHub v2 Manifest Schema
|
|
170
|
+
|
|
171
|
+
## Required Fields
|
|
172
|
+
|
|
173
|
+
| Field | Type | Description |
|
|
174
|
+
|-------|------|-------------|
|
|
175
|
+
| schemaVersion | \`2\` | Must be 2 |
|
|
176
|
+
| id | string | Lowercase alphanumeric + dashes, starts with letter |
|
|
177
|
+
| name | string | Human-readable display name |
|
|
178
|
+
| description | string | What the trik does |
|
|
179
|
+
| version | string | Semantic version |
|
|
180
|
+
| agent | AgentDefinition | How this trik operates as an agent |
|
|
181
|
+
| entry | EntryDefinition | Module entry point |
|
|
182
|
+
|
|
183
|
+
## Optional Fields
|
|
184
|
+
|
|
185
|
+
| Field | Type | Description |
|
|
186
|
+
|-------|------|-------------|
|
|
187
|
+
| tools | Record<string, ToolDeclaration> | Internal tools the agent uses |
|
|
188
|
+
| capabilities | { session?, storage? } | Session and storage capabilities |
|
|
189
|
+
| limits | { maxTurnTimeMs } | Resource limits |
|
|
190
|
+
| config | { required?, optional? } | Configuration requirements (API keys, tokens) |
|
|
191
|
+
| author | string | Author name |
|
|
192
|
+
| repository | string | Repository URL |
|
|
193
|
+
| license | string | License identifier |
|
|
194
|
+
|
|
195
|
+
## Agent Definition
|
|
196
|
+
|
|
197
|
+
| Field | Type | Required | Description |
|
|
198
|
+
|-------|------|----------|-------------|
|
|
199
|
+
| mode | "conversational" \\| "tool" | Yes | How the agent operates |
|
|
200
|
+
| handoffDescription | string (10-500 chars) | Conversational only | Routing description for the handoff tool |
|
|
201
|
+
| systemPrompt | string | Conversational only* | Inline system prompt |
|
|
202
|
+
| systemPromptFile | string | Conversational only* | Path to .md file |
|
|
203
|
+
| model | ModelPreferences | No | LLM preferences |
|
|
204
|
+
| domain | string[] | Yes | Expertise tags (min 1) |
|
|
205
|
+
|
|
206
|
+
*Conversational mode requires one of systemPrompt or systemPromptFile (not both).
|
|
207
|
+
Tool-mode triks should NOT have handoffDescription or systemPrompt.
|
|
208
|
+
|
|
209
|
+
### Model Preferences
|
|
210
|
+
|
|
211
|
+
| Field | Type | Description |
|
|
212
|
+
|-------|------|-------------|
|
|
213
|
+
| provider | string | Provider hint: "anthropic", "openai", "any" |
|
|
214
|
+
| capabilities | string[] | Required model capabilities, e.g. ["tool_use"] |
|
|
215
|
+
| temperature | number | Temperature for generation (0.0-2.0) |
|
|
216
|
+
|
|
217
|
+
## Tool Declaration
|
|
218
|
+
|
|
219
|
+
| Field | Type | Required | Description |
|
|
220
|
+
|-------|------|----------|-------------|
|
|
221
|
+
| description | string | Yes | What the tool does |
|
|
222
|
+
| logTemplate | string | Conversational only | Template with {{placeholders}} for log entries |
|
|
223
|
+
| logSchema | Record<string, JSONSchema> | Conversational only | Types for log placeholders |
|
|
224
|
+
| inputSchema | JSONSchema | Tool-mode only | JSON Schema for tool input |
|
|
225
|
+
| outputSchema | JSONSchema | Tool-mode only | JSON Schema for tool output (agent-safe types) |
|
|
226
|
+
| outputTemplate | string | Tool-mode only | Template with {{placeholders}} for output sent to LLM |
|
|
227
|
+
|
|
228
|
+
## Entry Definition
|
|
229
|
+
|
|
230
|
+
| Field | Type | Required | Description |
|
|
231
|
+
|-------|------|----------|-------------|
|
|
232
|
+
| module | string | Yes | Path to compiled module (relative to trik directory) |
|
|
233
|
+
| export | string | Yes | Export name ("default" for TypeScript, "agent" for Python) |
|
|
234
|
+
| runtime | "node" \\| "python" | No | Runtime environment (defaults to "node") |
|
|
235
|
+
|
|
236
|
+
## Capabilities
|
|
237
|
+
|
|
238
|
+
### Session
|
|
239
|
+
|
|
240
|
+
| Field | Type | Description |
|
|
241
|
+
|-------|------|-------------|
|
|
242
|
+
| enabled | boolean | Whether session state is enabled |
|
|
243
|
+
| maxDurationMs | number | Maximum session duration in ms (default: 30 minutes) |
|
|
244
|
+
|
|
245
|
+
### Storage
|
|
246
|
+
|
|
247
|
+
| Field | Type | Description |
|
|
248
|
+
|-------|------|-------------|
|
|
249
|
+
| enabled | boolean | Whether persistent storage is enabled |
|
|
250
|
+
| maxSizeBytes | number | Maximum storage size in bytes (default: 100MB) |
|
|
251
|
+
| persistent | boolean | Whether storage persists across sessions (default: true) |
|
|
252
|
+
|
|
253
|
+
## Configuration
|
|
254
|
+
|
|
255
|
+
Triks can declare required and optional configuration values (typically API keys):
|
|
256
|
+
|
|
257
|
+
\`\`\`json
|
|
258
|
+
"config": {
|
|
259
|
+
"required": [{ "key": "API_KEY", "description": "API key for the service" }],
|
|
260
|
+
"optional": [{ "key": "MODEL", "description": "Model name", "default": "gpt-4" }]
|
|
261
|
+
}
|
|
262
|
+
\`\`\`
|
|
263
|
+
|
|
264
|
+
## Security Constraints
|
|
265
|
+
|
|
266
|
+
### Log Schema (conversational mode)
|
|
267
|
+
|
|
268
|
+
String fields in logSchema MUST be constrained:
|
|
269
|
+
- \`enum\`: list of allowed values
|
|
270
|
+
- \`maxLength\`: maximum character count
|
|
271
|
+
- \`pattern\`: regex pattern
|
|
272
|
+
- \`format\`: "id", "date", "date-time", "uuid", "email", "url"
|
|
273
|
+
|
|
274
|
+
### Output Schema (tool mode — stricter)
|
|
275
|
+
|
|
276
|
+
String fields in outputSchema must be **agent-safe**:
|
|
277
|
+
- \`enum\`: list of allowed values
|
|
278
|
+
- \`pattern\`: regex pattern
|
|
279
|
+
- \`format\`: "id", "date", "date-time", "uuid", "email", "url"
|
|
280
|
+
- **NOT** \`maxLength\` alone (still free-form text, rejected)
|
|
281
|
+
|
|
282
|
+
If your tool returns user-provided content (titles, free text), use conversational mode instead.
|
|
283
|
+
|
|
284
|
+
Integer, number, and boolean fields are always safe.
|
|
285
|
+
|
|
286
|
+
## Examples
|
|
287
|
+
|
|
288
|
+
### Conversational Mode
|
|
289
|
+
|
|
290
|
+
\`\`\`json
|
|
291
|
+
{
|
|
292
|
+
"schemaVersion": 2,
|
|
293
|
+
"id": "my-assistant",
|
|
294
|
+
"name": "My Assistant",
|
|
295
|
+
"description": "A conversational assistant for specific tasks",
|
|
296
|
+
"version": "1.0.0",
|
|
297
|
+
"agent": {
|
|
298
|
+
"mode": "conversational",
|
|
299
|
+
"handoffDescription": "Handles specific tasks with multi-turn conversations",
|
|
300
|
+
"systemPromptFile": "./src/prompts/system.md",
|
|
301
|
+
"model": { "capabilities": ["tool_use"] },
|
|
302
|
+
"domain": ["specific-domain"]
|
|
303
|
+
},
|
|
304
|
+
"tools": {
|
|
305
|
+
"doThing": {
|
|
306
|
+
"description": "Does the thing",
|
|
307
|
+
"logTemplate": "Did thing: {{result}}",
|
|
308
|
+
"logSchema": { "result": { "type": "string", "maxLength": 100 } }
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
"capabilities": {
|
|
312
|
+
"session": { "enabled": true },
|
|
313
|
+
"storage": { "enabled": true }
|
|
314
|
+
},
|
|
315
|
+
"config": {
|
|
316
|
+
"optional": [{ "key": "ANTHROPIC_API_KEY", "description": "Anthropic API key" }]
|
|
317
|
+
},
|
|
318
|
+
"limits": { "maxTurnTimeMs": 30000 },
|
|
319
|
+
"entry": { "module": "./dist/index.js", "export": "default" }
|
|
320
|
+
}
|
|
321
|
+
\`\`\`
|
|
322
|
+
|
|
323
|
+
#### Python Conversational Example
|
|
324
|
+
|
|
325
|
+
\`\`\`json
|
|
326
|
+
{
|
|
327
|
+
"schemaVersion": 2,
|
|
328
|
+
"id": "my-assistant",
|
|
329
|
+
"name": "My Assistant",
|
|
330
|
+
"description": "A conversational assistant for specific tasks",
|
|
331
|
+
"version": "1.0.0",
|
|
332
|
+
"agent": {
|
|
333
|
+
"mode": "conversational",
|
|
334
|
+
"handoffDescription": "Handles specific tasks with multi-turn conversations",
|
|
335
|
+
"systemPromptFile": "./src/prompts/system.md",
|
|
336
|
+
"model": { "capabilities": ["tool_use"] },
|
|
337
|
+
"domain": ["specific-domain"]
|
|
338
|
+
},
|
|
339
|
+
"tools": {
|
|
340
|
+
"doThing": {
|
|
341
|
+
"description": "Does the thing",
|
|
342
|
+
"logTemplate": "Did thing: {{result}}",
|
|
343
|
+
"logSchema": { "result": { "type": "string", "maxLength": 100 } }
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
"entry": { "module": "./src/agent.py", "export": "agent", "runtime": "python" }
|
|
347
|
+
}
|
|
348
|
+
\`\`\`
|
|
349
|
+
|
|
350
|
+
### Tool Mode
|
|
351
|
+
|
|
352
|
+
\`\`\`json
|
|
353
|
+
{
|
|
354
|
+
"schemaVersion": 2,
|
|
355
|
+
"id": "my-tool",
|
|
356
|
+
"name": "My Tool",
|
|
357
|
+
"description": "A tool that returns structured data to the main agent",
|
|
358
|
+
"version": "1.0.0",
|
|
359
|
+
"agent": {
|
|
360
|
+
"mode": "tool",
|
|
361
|
+
"domain": ["utilities"]
|
|
362
|
+
},
|
|
363
|
+
"tools": {
|
|
364
|
+
"lookup": {
|
|
365
|
+
"description": "Look up a value by ID",
|
|
366
|
+
"inputSchema": {
|
|
367
|
+
"type": "object",
|
|
368
|
+
"properties": { "id": { "type": "string", "format": "uuid" } },
|
|
369
|
+
"required": ["id"]
|
|
370
|
+
},
|
|
371
|
+
"outputSchema": {
|
|
372
|
+
"type": "object",
|
|
373
|
+
"properties": {
|
|
374
|
+
"status": { "type": "string", "enum": ["found", "not_found"] },
|
|
375
|
+
"category": { "type": "string", "enum": ["A", "B", "C"] }
|
|
376
|
+
},
|
|
377
|
+
"required": ["status"]
|
|
378
|
+
},
|
|
379
|
+
"outputTemplate": "Lookup {{status}}: category={{category}}"
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"entry": { "module": "./dist/index.js", "export": "default" }
|
|
383
|
+
}
|
|
384
|
+
\`\`\`
|
|
385
|
+
|
|
386
|
+
#### Python Tool Mode Example
|
|
387
|
+
|
|
388
|
+
\`\`\`json
|
|
389
|
+
{
|
|
390
|
+
"schemaVersion": 2,
|
|
391
|
+
"id": "my-tool",
|
|
392
|
+
"name": "My Tool",
|
|
393
|
+
"description": "A tool that returns structured data to the main agent",
|
|
394
|
+
"version": "1.0.0",
|
|
395
|
+
"agent": {
|
|
396
|
+
"mode": "tool",
|
|
397
|
+
"domain": ["utilities"]
|
|
398
|
+
},
|
|
399
|
+
"tools": {
|
|
400
|
+
"lookup": {
|
|
401
|
+
"description": "Look up a value by ID",
|
|
402
|
+
"inputSchema": {
|
|
403
|
+
"type": "object",
|
|
404
|
+
"properties": { "id": { "type": "string", "format": "uuid" } },
|
|
405
|
+
"required": ["id"]
|
|
406
|
+
},
|
|
407
|
+
"outputSchema": {
|
|
408
|
+
"type": "object",
|
|
409
|
+
"properties": {
|
|
410
|
+
"status": { "type": "string", "enum": ["found", "not_found"] },
|
|
411
|
+
"category": { "type": "string", "enum": ["A", "B", "C"] }
|
|
412
|
+
},
|
|
413
|
+
"required": ["status"]
|
|
414
|
+
},
|
|
415
|
+
"outputTemplate": "Lookup {{status}}: category={{category}}"
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
"entry": { "module": "./src/tools.py", "export": "agent", "runtime": "python" }
|
|
419
|
+
}
|
|
420
|
+
\`\`\`
|
|
421
|
+
`;
|
|
422
|
+
// ============================================================================
|
|
423
|
+
// Start server
|
|
424
|
+
// ============================================================================
|
|
425
|
+
async function main() {
|
|
426
|
+
const transport = new StdioServerTransport();
|
|
427
|
+
await server.connect(transport);
|
|
428
|
+
console.error('TrikHub MCP server started (v2)');
|
|
429
|
+
}
|
|
430
|
+
main().catch((error) => {
|
|
431
|
+
console.error('Failed to start MCP server:', error);
|
|
432
|
+
process.exit(1);
|
|
433
|
+
});
|
|
434
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":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+EAA+E;AAE/E,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;AACnD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;IACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* analyze_trik_requirements — v2 implementation.
|
|
3
|
+
*
|
|
4
|
+
* Analyzes a user description and suggests v2 trik architecture:
|
|
5
|
+
* agent mode, handoff description, domain tags, and internal tools.
|
|
6
|
+
*/
|
|
7
|
+
import type { AnalyzeResult } from './types.js';
|
|
8
|
+
export declare function analyzeTrikRequirements(description: string, constraints?: string): AnalyzeResult;
|
|
9
|
+
//# sourceMappingURL=analyze.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/tools/analyze.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAiOhD,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,GACnB,aAAa,CAsEf"}
|