vibe-coding-mcp 2.12.1 → 2.14.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/CHANGELOG.md +74 -0
- package/LICENSE +21 -0
- package/README.md +205 -291
- package/SECURITY.md +65 -0
- package/dist/core/mcpServerFactory.d.ts +30 -0
- package/dist/core/mcpServerFactory.js +136 -0
- package/dist/core/mcpServerFactory.js.map +1 -0
- package/dist/core/prompts.d.ts +42 -0
- package/dist/core/prompts.js +158 -0
- package/dist/core/prompts.js.map +1 -0
- package/dist/core/resources.d.ts +47 -0
- package/dist/core/resources.js +99 -0
- package/dist/core/resources.js.map +1 -0
- package/dist/core/toolRegistry.d.ts +55 -0
- package/dist/core/toolRegistry.js +185 -0
- package/dist/core/toolRegistry.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +88 -147
- package/dist/index.js.map +1 -1
- package/dist/stdio.d.ts +7 -1
- package/dist/stdio.js +15 -137
- package/dist/stdio.js.map +1 -1
- package/package.json +10 -4
- package/dist/__tests__/collectCodeContext.test.d.ts +0 -2
- package/dist/__tests__/collectCodeContext.test.d.ts.map +0 -1
- package/dist/__tests__/collectCodeContext.test.js +0 -139
- package/dist/__tests__/collectCodeContext.test.js.map +0 -1
- package/dist/__tests__/createSessionLog.test.d.ts +0 -2
- package/dist/__tests__/createSessionLog.test.d.ts.map +0 -1
- package/dist/__tests__/createSessionLog.test.js +0 -130
- package/dist/__tests__/createSessionLog.test.js.map +0 -1
- package/dist/__tests__/exportSession.test.d.ts +0 -2
- package/dist/__tests__/exportSession.test.d.ts.map +0 -1
- package/dist/__tests__/exportSession.test.js +0 -180
- package/dist/__tests__/exportSession.test.js.map +0 -1
- package/dist/__tests__/generateDevDocument.test.d.ts +0 -2
- package/dist/__tests__/generateDevDocument.test.d.ts.map +0 -1
- package/dist/__tests__/generateDevDocument.test.js +0 -174
- package/dist/__tests__/generateDevDocument.test.js.map +0 -1
- package/dist/__tests__/git.test.d.ts +0 -2
- package/dist/__tests__/git.test.d.ts.map +0 -1
- package/dist/__tests__/git.test.js +0 -282
- package/dist/__tests__/git.test.js.map +0 -1
- package/dist/__tests__/normalizeForPlatform.test.d.ts +0 -2
- package/dist/__tests__/normalizeForPlatform.test.d.ts.map +0 -1
- package/dist/__tests__/normalizeForPlatform.test.js +0 -171
- package/dist/__tests__/normalizeForPlatform.test.js.map +0 -1
- package/dist/__tests__/projectProfile.test.d.ts +0 -2
- package/dist/__tests__/projectProfile.test.d.ts.map +0 -1
- package/dist/__tests__/projectProfile.test.js +0 -216
- package/dist/__tests__/projectProfile.test.js.map +0 -1
- package/dist/__tests__/publishDocument.test.d.ts +0 -2
- package/dist/__tests__/publishDocument.test.d.ts.map +0 -1
- package/dist/__tests__/publishDocument.test.js +0 -93
- package/dist/__tests__/publishDocument.test.js.map +0 -1
- package/dist/__tests__/sessionHistory.test.d.ts +0 -2
- package/dist/__tests__/sessionHistory.test.d.ts.map +0 -1
- package/dist/__tests__/sessionHistory.test.js +0 -229
- package/dist/__tests__/sessionHistory.test.js.map +0 -1
- package/dist/__tests__/summarizeDesignDecisions.test.d.ts +0 -2
- package/dist/__tests__/summarizeDesignDecisions.test.d.ts.map +0 -1
- package/dist/__tests__/summarizeDesignDecisions.test.js +0 -158
- package/dist/__tests__/summarizeDesignDecisions.test.js.map +0 -1
- package/dist/core/ai.d.ts.map +0 -1
- package/dist/core/cache.d.ts.map +0 -1
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/logger.d.ts.map +0 -1
- package/dist/core/profileStorage.d.ts.map +0 -1
- package/dist/core/schemas.d.ts.map +0 -1
- package/dist/core/security.d.ts.map +0 -1
- package/dist/core/sessionStorage.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/platforms/confluence.d.ts.map +0 -1
- package/dist/platforms/discord.d.ts.map +0 -1
- package/dist/platforms/github-wiki.d.ts.map +0 -1
- package/dist/platforms/notion.d.ts.map +0 -1
- package/dist/platforms/obsidian.d.ts.map +0 -1
- package/dist/platforms/slack.d.ts.map +0 -1
- package/dist/stdio.d.ts.map +0 -1
- package/dist/tools/analyzeCode.d.ts.map +0 -1
- package/dist/tools/autoTag.d.ts.map +0 -1
- package/dist/tools/batch.d.ts.map +0 -1
- package/dist/tools/collectCodeContext.d.ts.map +0 -1
- package/dist/tools/createSessionLog.d.ts.map +0 -1
- package/dist/tools/exportSession.d.ts.map +0 -1
- package/dist/tools/generateDevDocument.d.ts.map +0 -1
- package/dist/tools/git.d.ts.map +0 -1
- package/dist/tools/normalizeForPlatform.d.ts.map +0 -1
- package/dist/tools/projectProfile.d.ts.map +0 -1
- package/dist/tools/publishDocument.d.ts.map +0 -1
- package/dist/tools/sessionHistory.d.ts.map +0 -1
- package/dist/tools/sessionStats.d.ts.map +0 -1
- package/dist/tools/summarizeDesignDecisions.d.ts.map +0 -1
- package/dist/tools/template.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/utils/astParser.d.ts.map +0 -1
- package/dist/utils/gitExecutor.d.ts.map +0 -1
- package/dist/utils/gitParsers.d.ts.map +0 -1
- package/dist/utils/i18n.d.ts.map +0 -1
- package/dist/utils/markdown.d.ts.map +0 -1
- package/dist/utils/mermaidGenerator.d.ts.map +0 -1
package/SECURITY.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
`vibe-coding-mcp` is an MCP (Model Context Protocol) server that reads source code,
|
|
4
|
+
runs `git` commands, and publishes generated documentation to third-party platforms
|
|
5
|
+
(Notion, Obsidian, GitHub Wiki, Confluence, Slack, Discord). Because it executes
|
|
6
|
+
local commands and makes outbound HTTPS requests on behalf of the calling LLM,
|
|
7
|
+
the threat surface is non-trivial. This document describes the guarantees the
|
|
8
|
+
package makes, what is explicitly out of scope, and how to report vulnerabilities.
|
|
9
|
+
|
|
10
|
+
## Supported versions
|
|
11
|
+
|
|
12
|
+
| Version | Supported |
|
|
13
|
+
|----------|-----------|
|
|
14
|
+
| 2.13.x | yes |
|
|
15
|
+
| < 2.13 | no |
|
|
16
|
+
|
|
17
|
+
## Threat model
|
|
18
|
+
|
|
19
|
+
The MCP server runs on the **same trust boundary as the operator's developer
|
|
20
|
+
machine** (or container). It is *not* designed to be exposed to untrusted users
|
|
21
|
+
over a network. The threats actively mitigated are:
|
|
22
|
+
|
|
23
|
+
| # | Threat | Mitigation (in `src/core/security.ts`) |
|
|
24
|
+
|---|-----------------------------------------------------|---------------------------------------------------|
|
|
25
|
+
| 1 | Path traversal via tool arguments | `validatePathWithinDirectory`, `sanitizeFilename` |
|
|
26
|
+
| 2 | SSRF via webhook URLs (Slack / Discord) | `validateWebhookUrl` + allowlist of known hosts |
|
|
27
|
+
| 3 | Plaintext webhook URLs | HTTPS-only check inside `validateWebhookUrl` |
|
|
28
|
+
| 4 | Hung outbound requests / DoS | `fetchWithRetry` with timeout + exponential backoff |
|
|
29
|
+
| 5 | Unbounded retries on transient errors | `maxRetries` cap (default 3) with retry-after honored |
|
|
30
|
+
| 6 | Arbitrary shell injection through `git` invocations | All `git` calls go through `gitExecutor.ts` argv form (no shell) |
|
|
31
|
+
| 7 | Unvalidated tool inputs | All tool args parsed through Zod schemas in `src/core/schemas.ts` |
|
|
32
|
+
|
|
33
|
+
### Out of scope
|
|
34
|
+
|
|
35
|
+
- **Sandboxing of the host machine.** The MCP server has the privileges of the
|
|
36
|
+
user running it. Treat tokens (Notion, GitHub, Discord, Slack) as ambient
|
|
37
|
+
authority and store them in `.env`, not in source control.
|
|
38
|
+
- **Supply-chain attestation for third-party platforms.** We trust the official
|
|
39
|
+
SDKs (`@anthropic-ai/sdk`, `@notionhq/client`) to handle their own transport
|
|
40
|
+
security.
|
|
41
|
+
- **Multi-tenant isolation.** Running a single MCP server for multiple users is
|
|
42
|
+
not a supported deployment.
|
|
43
|
+
|
|
44
|
+
## Reporting a vulnerability
|
|
45
|
+
|
|
46
|
+
If you believe you have found a security issue:
|
|
47
|
+
|
|
48
|
+
1. **Do not open a public GitHub issue.**
|
|
49
|
+
2. Email the maintainers via the GitHub Security Advisories tab on this
|
|
50
|
+
repository, or open a private advisory at
|
|
51
|
+
https://github.com/MUSE-CODE-SPACE/vibe-coding-mcp/security/advisories/new
|
|
52
|
+
3. Include a reproduction (minimal MCP tool call, environment, expected vs
|
|
53
|
+
actual behavior).
|
|
54
|
+
|
|
55
|
+
We aim to acknowledge reports within 72 hours and to ship a fix or mitigation
|
|
56
|
+
within 14 days for high-severity issues.
|
|
57
|
+
|
|
58
|
+
## Hardening checklist for operators
|
|
59
|
+
|
|
60
|
+
- Run `vibe-coding-mcp` inside the smallest reasonable container or user account.
|
|
61
|
+
- Keep `.env` out of version control. Rotate Notion / Slack / Discord tokens
|
|
62
|
+
if they are ever logged.
|
|
63
|
+
- Pin the package to a known-good version (e.g. `vibe-coding-mcp@2.13.0`) in
|
|
64
|
+
production rather than using `latest`.
|
|
65
|
+
- Watch the GitHub Actions `CodeQL` workflow for new findings on `main`.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server factory — builds a fully-wired `McpServer` instance using the
|
|
3
|
+
* high-level `@modelcontextprotocol/sdk` API. Used by both entry points
|
|
4
|
+
* (`src/index.ts` and `src/stdio.ts`) so they expose an identical surface:
|
|
5
|
+
* 15 tools, 3 resources (one of which is a template), 3 prompts.
|
|
6
|
+
*
|
|
7
|
+
* High-level vs low-level: previously both entry points constructed a
|
|
8
|
+
* low-level `Server` and registered request handlers for
|
|
9
|
+
* `ListToolsRequestSchema` / `CallToolRequestSchema`. We now use
|
|
10
|
+
* `McpServer.registerTool()`, `.resource()`, and `.prompt()` — the SDK turns
|
|
11
|
+
* those registrations into the same JSON-RPC surface, but adds first-class
|
|
12
|
+
* resources and prompts support along the way.
|
|
13
|
+
*/
|
|
14
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
15
|
+
declare const SERVER_NAME = "vibe-coding-mcp";
|
|
16
|
+
declare const SERVER_VERSION = "2.14.0";
|
|
17
|
+
/**
|
|
18
|
+
* Build a new `McpServer` instance populated with all 15 tools, the resource
|
|
19
|
+
* set, and the prompt set. The returned server is not yet connected to a
|
|
20
|
+
* transport — caller is responsible for `server.connect(transport)`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createMcpServer(): McpServer;
|
|
23
|
+
/** Counts surfaced for smoke-testing + observability. */
|
|
24
|
+
export declare function getCapabilityCounts(): {
|
|
25
|
+
tools: number;
|
|
26
|
+
resources: number;
|
|
27
|
+
prompts: number;
|
|
28
|
+
};
|
|
29
|
+
export { SERVER_NAME, SERVER_VERSION };
|
|
30
|
+
//# sourceMappingURL=mcpServerFactory.d.ts.map
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server factory — builds a fully-wired `McpServer` instance using the
|
|
3
|
+
* high-level `@modelcontextprotocol/sdk` API. Used by both entry points
|
|
4
|
+
* (`src/index.ts` and `src/stdio.ts`) so they expose an identical surface:
|
|
5
|
+
* 15 tools, 3 resources (one of which is a template), 3 prompts.
|
|
6
|
+
*
|
|
7
|
+
* High-level vs low-level: previously both entry points constructed a
|
|
8
|
+
* low-level `Server` and registered request handlers for
|
|
9
|
+
* `ListToolsRequestSchema` / `CallToolRequestSchema`. We now use
|
|
10
|
+
* `McpServer.registerTool()`, `.resource()`, and `.prompt()` — the SDK turns
|
|
11
|
+
* those registrations into the same JSON-RPC surface, but adds first-class
|
|
12
|
+
* resources and prompts support along the way.
|
|
13
|
+
*/
|
|
14
|
+
import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import { TOOL_REGISTRY } from './toolRegistry.js';
|
|
17
|
+
import { createErrorResponse, ToolError } from './errors.js';
|
|
18
|
+
import { STATIC_RESOURCE_DESCRIPTORS, readSessionsList, readSessionDetail, readConfig, } from './resources.js';
|
|
19
|
+
import { PROMPT_DESCRIPTORS, findPrompt } from './prompts.js';
|
|
20
|
+
import { listSessions } from './sessionStorage.js';
|
|
21
|
+
const SERVER_NAME = 'vibe-coding-mcp';
|
|
22
|
+
const SERVER_VERSION = '2.14.0';
|
|
23
|
+
/**
|
|
24
|
+
* Build a new `McpServer` instance populated with all 15 tools, the resource
|
|
25
|
+
* set, and the prompt set. The returned server is not yet connected to a
|
|
26
|
+
* transport — caller is responsible for `server.connect(transport)`.
|
|
27
|
+
*/
|
|
28
|
+
export function createMcpServer() {
|
|
29
|
+
const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION }, {
|
|
30
|
+
capabilities: {
|
|
31
|
+
tools: {},
|
|
32
|
+
resources: {},
|
|
33
|
+
prompts: {},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
registerTools(server);
|
|
37
|
+
registerResources(server);
|
|
38
|
+
registerPrompts(server);
|
|
39
|
+
return server;
|
|
40
|
+
}
|
|
41
|
+
/** Wire all 15 tools from the shared registry. */
|
|
42
|
+
function registerTools(server) {
|
|
43
|
+
for (const tool of TOOL_REGISTRY) {
|
|
44
|
+
const { name, description } = tool.descriptor;
|
|
45
|
+
// Use `registerTool` with the Zod schema for the input. The SDK uses
|
|
46
|
+
// `normalizeObjectSchema` internally, which accepts our pre-built
|
|
47
|
+
// `z.object(...)` instances. SDK pre-validates `args` before calling the
|
|
48
|
+
// handler; our handler then re-runs `validateInput()` defensively.
|
|
49
|
+
server.registerTool(name, {
|
|
50
|
+
description,
|
|
51
|
+
inputSchema: tool.inputZodSchema,
|
|
52
|
+
}, async (args) => {
|
|
53
|
+
try {
|
|
54
|
+
const result = await tool.handler(args);
|
|
55
|
+
return {
|
|
56
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
return createErrorResponse(error);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Register the static + templated resources. */
|
|
66
|
+
function registerResources(server) {
|
|
67
|
+
// Static: sessions/list
|
|
68
|
+
server.resource('sessions-list', 'vibe-coding://sessions/list', { description: STATIC_RESOURCE_DESCRIPTORS[0].description, mimeType: 'application/json' }, async (uri) => {
|
|
69
|
+
const content = await readSessionsList(uri.toString());
|
|
70
|
+
return { contents: [content] };
|
|
71
|
+
});
|
|
72
|
+
// Static: config
|
|
73
|
+
server.resource('config', 'vibe-coding://config', { description: STATIC_RESOURCE_DESCRIPTORS[1].description, mimeType: 'application/json' }, async (uri) => {
|
|
74
|
+
const content = readConfig(uri.toString());
|
|
75
|
+
return { contents: [content] };
|
|
76
|
+
});
|
|
77
|
+
// Template: sessions/{id}
|
|
78
|
+
server.resource('session-detail', new ResourceTemplate('vibe-coding://sessions/{id}', {
|
|
79
|
+
// List variants of the template — enumerate stored session IDs so
|
|
80
|
+
// clients can autocomplete the {id} placeholder.
|
|
81
|
+
list: async () => {
|
|
82
|
+
const { sessions } = await listSessions({ limit: 50 });
|
|
83
|
+
return {
|
|
84
|
+
resources: sessions
|
|
85
|
+
.filter((s) => s.id !== 'list')
|
|
86
|
+
.map((s) => ({
|
|
87
|
+
uri: `vibe-coding://sessions/${s.id}`,
|
|
88
|
+
name: s.title || s.id,
|
|
89
|
+
description: s.summary?.slice(0, 120) ?? '',
|
|
90
|
+
mimeType: 'application/json',
|
|
91
|
+
})),
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
}), {
|
|
95
|
+
description: 'Full read-only detail of one captured session (code contexts, design decisions, metadata).',
|
|
96
|
+
mimeType: 'application/json',
|
|
97
|
+
}, async (uri, variables) => {
|
|
98
|
+
const id = Array.isArray(variables.id) ? variables.id[0] : variables.id;
|
|
99
|
+
const content = await readSessionDetail(uri.toString(), id ?? '');
|
|
100
|
+
return { contents: [content] };
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/** Register all prompts from the shared prompts module. */
|
|
104
|
+
function registerPrompts(server) {
|
|
105
|
+
for (const descriptor of PROMPT_DESCRIPTORS) {
|
|
106
|
+
// Build a Zod raw-shape from the prompt's argument list so the SDK can
|
|
107
|
+
// surface argument metadata in `prompts/list`.
|
|
108
|
+
const shape = {};
|
|
109
|
+
for (const arg of descriptor.arguments) {
|
|
110
|
+
const base = z.string().describe(arg.description);
|
|
111
|
+
shape[arg.name] = arg.required ? base : base.optional();
|
|
112
|
+
}
|
|
113
|
+
server.prompt(descriptor.name, descriptor.description, shape, (args) => {
|
|
114
|
+
const prompt = findPrompt(descriptor.name);
|
|
115
|
+
if (!prompt) {
|
|
116
|
+
throw new ToolError(`Prompt not found: ${descriptor.name}`, 'NOT_FOUND');
|
|
117
|
+
}
|
|
118
|
+
const result = prompt.build(args);
|
|
119
|
+
return {
|
|
120
|
+
description: result.description,
|
|
121
|
+
messages: result.messages,
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** Counts surfaced for smoke-testing + observability. */
|
|
127
|
+
export function getCapabilityCounts() {
|
|
128
|
+
return {
|
|
129
|
+
tools: TOOL_REGISTRY.length,
|
|
130
|
+
// 2 static + 1 template = 3 logical resources
|
|
131
|
+
resources: STATIC_RESOURCE_DESCRIPTORS.length + 1,
|
|
132
|
+
prompts: PROMPT_DESCRIPTORS.length,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export { SERVER_NAME, SERVER_VERSION };
|
|
136
|
+
//# sourceMappingURL=mcpServerFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpServerFactory.js","sourceRoot":"","sources":["../../src/core/mcpServerFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EA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UAAU,CAAC,SAAS,EAAE,CAAC;YACvC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAClD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC1D,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;YACrE,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,SAAS,CAAC,qBAAqB,UAAU,CAAC,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;YAC3E,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAA0C,CAAC,CAAC;YACxE,OAAO;gBACL,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,KAAK,EAAE,aAAa,CAAC,MAAM;QAC3B,8CAA8C;QAC9C,SAAS,EAAE,2BAA2B,CAAC,MAAM,GAAG,CAAC;QACjD,OAAO,EAAE,kBAAkB,CAAC,MAAM;KACnC,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Prompts — pre-baked, parameterized workflows that compose multiple
|
|
3
|
+
* vibe-coding tools into a single user-facing slash command. Surfaced by
|
|
4
|
+
* Claude UI in the `/`-menu.
|
|
5
|
+
*
|
|
6
|
+
* Each prompt returns a sequence of messages that the LLM should follow,
|
|
7
|
+
* referencing the appropriate `muse_*` tools.
|
|
8
|
+
*/
|
|
9
|
+
export interface PromptArgument {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
required: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PromptDescriptor {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
arguments: PromptArgument[];
|
|
18
|
+
}
|
|
19
|
+
export interface PromptMessage {
|
|
20
|
+
role: 'user' | 'assistant';
|
|
21
|
+
content: {
|
|
22
|
+
type: 'text';
|
|
23
|
+
text: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface PromptResult {
|
|
27
|
+
description: string;
|
|
28
|
+
messages: PromptMessage[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* All registered prompts. The descriptor block is returned by
|
|
32
|
+
* `prompts/list`; the `build` function is invoked by `prompts/get`.
|
|
33
|
+
*/
|
|
34
|
+
interface PromptDefinition {
|
|
35
|
+
descriptor: PromptDescriptor;
|
|
36
|
+
build: (args: Record<string, string | undefined>) => PromptResult;
|
|
37
|
+
}
|
|
38
|
+
export declare const PROMPT_DESCRIPTORS: PromptDescriptor[];
|
|
39
|
+
export declare function findPrompt(name: string): PromptDefinition | undefined;
|
|
40
|
+
export declare function buildPrompt(name: string, args: Record<string, string | undefined>): PromptResult | null;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Prompts — pre-baked, parameterized workflows that compose multiple
|
|
3
|
+
* vibe-coding tools into a single user-facing slash command. Surfaced by
|
|
4
|
+
* Claude UI in the `/`-menu.
|
|
5
|
+
*
|
|
6
|
+
* Each prompt returns a sequence of messages that the LLM should follow,
|
|
7
|
+
* referencing the appropriate `muse_*` tools.
|
|
8
|
+
*/
|
|
9
|
+
const PROMPTS = [
|
|
10
|
+
{
|
|
11
|
+
descriptor: {
|
|
12
|
+
name: 'daily-vibe-log',
|
|
13
|
+
description: 'Generate a daily vibe coding log summarizing today\'s captured sessions, code contexts, and design decisions.',
|
|
14
|
+
arguments: [
|
|
15
|
+
{
|
|
16
|
+
name: 'date',
|
|
17
|
+
description: 'ISO date (YYYY-MM-DD). Defaults to today.',
|
|
18
|
+
required: false,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'language',
|
|
22
|
+
description: 'Output language: `en` or `ko`. Defaults to `en`.',
|
|
23
|
+
required: false,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
build: (args) => {
|
|
28
|
+
const date = args.date || new Date().toISOString().slice(0, 10);
|
|
29
|
+
const language = (args.language || 'en').toLowerCase() === 'ko' ? 'ko' : 'en';
|
|
30
|
+
return {
|
|
31
|
+
description: `Daily vibe log for ${date} (${language}).`,
|
|
32
|
+
messages: [
|
|
33
|
+
{
|
|
34
|
+
role: 'user',
|
|
35
|
+
content: {
|
|
36
|
+
type: 'text',
|
|
37
|
+
text: [
|
|
38
|
+
`Compile a daily vibe coding log for ${date}.`,
|
|
39
|
+
'',
|
|
40
|
+
'Workflow:',
|
|
41
|
+
`1. Call \`muse_session_history\` with action=\"list\" and filter to sessions whose updatedAt starts with \"${date}\".`,
|
|
42
|
+
'2. For each session, call `muse_session_history` with action=\"get\" to fetch full detail.',
|
|
43
|
+
'3. Call `muse_session_stats` with action=\"overview\" for productivity numbers.',
|
|
44
|
+
'4. Call `muse_create_session_log` with logType=\"daily\" passing the aggregated context.',
|
|
45
|
+
`5. Render the final log in ${language === 'ko' ? 'Korean' : 'English'}, grouping by tag and including code-block counts plus key design decisions.`,
|
|
46
|
+
].join('\n'),
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
descriptor: {
|
|
55
|
+
name: 'document-session',
|
|
56
|
+
description: 'Walk a user through documenting a captured vibe coding session — fetch it, extract design decisions, generate a dev document, and (optionally) publish.',
|
|
57
|
+
arguments: [
|
|
58
|
+
{
|
|
59
|
+
name: 'sessionId',
|
|
60
|
+
description: 'Stored session ID (from `muse_session_history` list/save).',
|
|
61
|
+
required: true,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'documentType',
|
|
65
|
+
description: 'README, DESIGN, TUTORIAL, CHANGELOG, API, or ARCHITECTURE. Defaults to DESIGN.',
|
|
66
|
+
required: false,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'platform',
|
|
70
|
+
description: 'Optional publish target: notion, github-wiki, obsidian, confluence, slack, discord. Omit to skip publish.',
|
|
71
|
+
required: false,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
build: (args) => {
|
|
76
|
+
const sessionId = args.sessionId ?? '<sessionId>';
|
|
77
|
+
const documentType = args.documentType || 'DESIGN';
|
|
78
|
+
const platform = args.platform;
|
|
79
|
+
return {
|
|
80
|
+
description: `Document session ${sessionId} as a ${documentType}${platform ? ` and publish to ${platform}` : ''}.`,
|
|
81
|
+
messages: [
|
|
82
|
+
{
|
|
83
|
+
role: 'user',
|
|
84
|
+
content: {
|
|
85
|
+
type: 'text',
|
|
86
|
+
text: [
|
|
87
|
+
`Document vibe coding session \`${sessionId}\` as a ${documentType}.`,
|
|
88
|
+
'',
|
|
89
|
+
'Workflow:',
|
|
90
|
+
`1. Call \`muse_session_history\` action=\"get\", sessionId=\"${sessionId}\". Read codeContexts + designDecisions.`,
|
|
91
|
+
'2. If designDecisions is empty, call `muse_summarize_design_decisions` on the conversationSummary fields.',
|
|
92
|
+
`3. Call \`muse_generate_dev_document\` with documentType=\"${documentType}\", passing designDecisions and codeContexts from step 1-2.`,
|
|
93
|
+
platform
|
|
94
|
+
? `4. Call \`muse_normalize_for_platform\` with platform=\"${platform}\", then \`muse_publish_document\` to push the result.`
|
|
95
|
+
: '4. Return the generated Markdown to the user (no publish).',
|
|
96
|
+
'5. Summarize what was documented and where it was published.',
|
|
97
|
+
].join('\n'),
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
descriptor: {
|
|
106
|
+
name: 'refactor-context',
|
|
107
|
+
description: 'Extract the refactor-ready context from a session: the code that changed, the design decisions that drove the change, and AST analysis of the new code — ready to paste into a refactor PR description.',
|
|
108
|
+
arguments: [
|
|
109
|
+
{
|
|
110
|
+
name: 'sessionId',
|
|
111
|
+
description: 'Stored session ID.',
|
|
112
|
+
required: true,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'language',
|
|
116
|
+
description: 'Code language hint for AST analysis (typescript, javascript, python, go).',
|
|
117
|
+
required: false,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
build: (args) => {
|
|
122
|
+
const sessionId = args.sessionId ?? '<sessionId>';
|
|
123
|
+
const language = args.language || 'typescript';
|
|
124
|
+
return {
|
|
125
|
+
description: `Extract refactor context from session ${sessionId}.`,
|
|
126
|
+
messages: [
|
|
127
|
+
{
|
|
128
|
+
role: 'user',
|
|
129
|
+
content: {
|
|
130
|
+
type: 'text',
|
|
131
|
+
text: [
|
|
132
|
+
`Extract refactor context from session \`${sessionId}\`.`,
|
|
133
|
+
'',
|
|
134
|
+
'Workflow:',
|
|
135
|
+
`1. Call \`muse_session_history\` action=\"get\", sessionId=\"${sessionId}\".`,
|
|
136
|
+
`2. For each non-trivial code block, call \`muse_analyze_code\` with language=\"${language}\" and generateDiagrams=true to surface class/flowchart/dependency diagrams.`,
|
|
137
|
+
'3. Call `muse_git` action=\"diff\" for the related repo to attach the actual diff (if a repoPath is in session metadata).',
|
|
138
|
+
'4. Assemble a markdown report with sections: Motivation (from design decisions) / What changed (diff stat + diagrams) / Risks / Follow-ups.',
|
|
139
|
+
'5. Return the report verbatim so it can be pasted into a refactor PR description.',
|
|
140
|
+
].join('\n'),
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
export const PROMPT_DESCRIPTORS = PROMPTS.map((p) => p.descriptor);
|
|
149
|
+
export function findPrompt(name) {
|
|
150
|
+
return PROMPTS.find((p) => p.descriptor.name === name);
|
|
151
|
+
}
|
|
152
|
+
export function buildPrompt(name, args) {
|
|
153
|
+
const prompt = findPrompt(name);
|
|
154
|
+
if (!prompt)
|
|
155
|
+
return null;
|
|
156
|
+
return prompt.build(args);
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/core/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiCH,MAAM,OAAO,GAAuB;IAClC;QACE,UAAU,EAAE;YACV,IAAI,EAAE,gBAAgB;YACtB,WAAW,EACT,+GAA+G;YACjH,SAAS,EAAE;gBACT;oBACE,IAAI,EAAE,MAAM;oBACZ,WAAW,EAAE,2CAA2C;oBACxD,QAAQ,EAAE,KAAK;iBAChB;gBACD;oBACE,IAAI,EAAE,UAAU;oBAChB,WAAW,EAAE,kDAAkD;oBAC/D,QAAQ,EAAE,KAAK;iBAChB;aACF;SACF;QACD,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;YACd,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAChE,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,CAA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AmF;6BACpF,CAAC,IAAI,CAAC,IAAI,CAAC;yBACb;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAuB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;AAEvF,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,IAAY,EACZ,IAAwC;IAExC,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resources — read-only contextual data exposed via `resources/list` and
|
|
3
|
+
* `resources/read`. Resources let Claude UI surface vibe-coding state with
|
|
4
|
+
* @-mentions / slash commands without the LLM having to call a tool first.
|
|
5
|
+
*
|
|
6
|
+
* Registered URIs:
|
|
7
|
+
* - `vibe-coding://sessions/list` — list of captured sessions
|
|
8
|
+
* - `vibe-coding://sessions/{id}` — full detail for one session (template)
|
|
9
|
+
* - `vibe-coding://config` — current platform configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface ResourceContent {
|
|
12
|
+
uri: string;
|
|
13
|
+
mimeType: string;
|
|
14
|
+
text: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ResourceDescriptor {
|
|
17
|
+
uri: string;
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
mimeType: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Static resources (fixed URI, returned by `resources/list`).
|
|
24
|
+
*/
|
|
25
|
+
export declare const STATIC_RESOURCE_DESCRIPTORS: ResourceDescriptor[];
|
|
26
|
+
/**
|
|
27
|
+
* Resource templates — URIs with variables (RFC 6570). Listed separately
|
|
28
|
+
* by `resources/templates/list`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const RESOURCE_TEMPLATE_DESCRIPTORS: readonly [{
|
|
31
|
+
readonly uriTemplate: "vibe-coding://sessions/{id}";
|
|
32
|
+
readonly name: "session-detail";
|
|
33
|
+
readonly description: "Full read-only detail of one captured session (code contexts, design decisions, metadata).";
|
|
34
|
+
readonly mimeType: "application/json";
|
|
35
|
+
}];
|
|
36
|
+
/** Read the `sessions/list` resource. */
|
|
37
|
+
export declare function readSessionsList(uri: string): Promise<ResourceContent>;
|
|
38
|
+
/** Read a `sessions/{id}` resource. */
|
|
39
|
+
export declare function readSessionDetail(uri: string, sessionId: string): Promise<ResourceContent>;
|
|
40
|
+
/** Read the `config` resource. */
|
|
41
|
+
export declare function readConfig(uri: string): ResourceContent;
|
|
42
|
+
/**
|
|
43
|
+
* Dispatch a `resources/read` call by URI. Returns `null` if the URI does
|
|
44
|
+
* not match any registered resource (caller should surface a proper error).
|
|
45
|
+
*/
|
|
46
|
+
export declare function readResource(uri: string): Promise<ResourceContent | null>;
|
|
47
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resources — read-only contextual data exposed via `resources/list` and
|
|
3
|
+
* `resources/read`. Resources let Claude UI surface vibe-coding state with
|
|
4
|
+
* @-mentions / slash commands without the LLM having to call a tool first.
|
|
5
|
+
*
|
|
6
|
+
* Registered URIs:
|
|
7
|
+
* - `vibe-coding://sessions/list` — list of captured sessions
|
|
8
|
+
* - `vibe-coding://sessions/{id}` — full detail for one session (template)
|
|
9
|
+
* - `vibe-coding://config` — current platform configuration
|
|
10
|
+
*/
|
|
11
|
+
import { listSessions, getSession } from './sessionStorage.js';
|
|
12
|
+
import { validateConfiguration } from './config.js';
|
|
13
|
+
/**
|
|
14
|
+
* Static resources (fixed URI, returned by `resources/list`).
|
|
15
|
+
*/
|
|
16
|
+
export const STATIC_RESOURCE_DESCRIPTORS = [
|
|
17
|
+
{
|
|
18
|
+
uri: 'vibe-coding://sessions/list',
|
|
19
|
+
name: 'sessions-list',
|
|
20
|
+
description: 'List of all captured vibe coding sessions (id, title, tags, timestamps).',
|
|
21
|
+
mimeType: 'application/json',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
uri: 'vibe-coding://config',
|
|
25
|
+
name: 'config',
|
|
26
|
+
description: 'Current publishing platform configuration — which platforms (Notion, GitHub Wiki, Obsidian, Confluence, Slack, Discord) are fully configured via environment variables and which are missing required secrets.',
|
|
27
|
+
mimeType: 'application/json',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Resource templates — URIs with variables (RFC 6570). Listed separately
|
|
32
|
+
* by `resources/templates/list`.
|
|
33
|
+
*/
|
|
34
|
+
export const RESOURCE_TEMPLATE_DESCRIPTORS = [
|
|
35
|
+
{
|
|
36
|
+
uriTemplate: 'vibe-coding://sessions/{id}',
|
|
37
|
+
name: 'session-detail',
|
|
38
|
+
description: 'Full read-only detail of one captured session (code contexts, design decisions, metadata).',
|
|
39
|
+
mimeType: 'application/json',
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
/** Read the `sessions/list` resource. */
|
|
43
|
+
export async function readSessionsList(uri) {
|
|
44
|
+
const { sessions, total } = await listSessions({ limit: 200 });
|
|
45
|
+
const body = {
|
|
46
|
+
total,
|
|
47
|
+
sessions: sessions.map((s) => ({
|
|
48
|
+
id: s.id,
|
|
49
|
+
title: s.title,
|
|
50
|
+
tags: s.tags,
|
|
51
|
+
createdAt: s.createdAt,
|
|
52
|
+
updatedAt: s.updatedAt,
|
|
53
|
+
codeContextCount: s.codeContextCount,
|
|
54
|
+
designDecisionCount: s.designDecisionCount,
|
|
55
|
+
})),
|
|
56
|
+
};
|
|
57
|
+
return { uri, mimeType: 'application/json', text: JSON.stringify(body, null, 2) };
|
|
58
|
+
}
|
|
59
|
+
/** Read a `sessions/{id}` resource. */
|
|
60
|
+
export async function readSessionDetail(uri, sessionId) {
|
|
61
|
+
const session = await getSession(sessionId);
|
|
62
|
+
if (!session) {
|
|
63
|
+
// Return an empty-but-valid envelope so clients don't crash.
|
|
64
|
+
return {
|
|
65
|
+
uri,
|
|
66
|
+
mimeType: 'application/json',
|
|
67
|
+
text: JSON.stringify({ error: 'NOT_FOUND', sessionId }, null, 2),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return { uri, mimeType: 'application/json', text: JSON.stringify(session, null, 2) };
|
|
71
|
+
}
|
|
72
|
+
/** Read the `config` resource. */
|
|
73
|
+
export function readConfig(uri) {
|
|
74
|
+
const result = validateConfiguration();
|
|
75
|
+
return {
|
|
76
|
+
uri,
|
|
77
|
+
mimeType: 'application/json',
|
|
78
|
+
text: JSON.stringify(result, null, 2),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Dispatch a `resources/read` call by URI. Returns `null` if the URI does
|
|
83
|
+
* not match any registered resource (caller should surface a proper error).
|
|
84
|
+
*/
|
|
85
|
+
export async function readResource(uri) {
|
|
86
|
+
if (uri === 'vibe-coding://sessions/list') {
|
|
87
|
+
return readSessionsList(uri);
|
|
88
|
+
}
|
|
89
|
+
if (uri === 'vibe-coding://config') {
|
|
90
|
+
return readConfig(uri);
|
|
91
|
+
}
|
|
92
|
+
// Template match: vibe-coding://sessions/{id}
|
|
93
|
+
const sessionMatch = uri.match(/^vibe-coding:\/\/sessions\/([^/]+)$/);
|
|
94
|
+
if (sessionMatch && sessionMatch[1] !== 'list') {
|
|
95
|
+
return readSessionDetail(uri, sessionMatch[1]);
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=resources.js.map
|
|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C,CAAC;IACzB,CAAC;IACD,8CAA8C;IAC9C,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACtE,IAAI,YAAY,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;QAC/C,OAAO,iBAAiB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared tool registry — single source of truth for all 15 MCP tools.
|
|
3
|
+
*
|
|
4
|
+
* Both entry points (`src/index.ts` HTTP transport and `src/stdio.ts` stdio
|
|
5
|
+
* transport) import from this module so they expose an identical capability
|
|
6
|
+
* surface. Adding/removing a tool is a single-line change here.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
/**
|
|
10
|
+
* MCP-style tool definition object (the JSON-schema descriptor that ships
|
|
11
|
+
* over the wire to clients via `tools/list`).
|
|
12
|
+
*/
|
|
13
|
+
export interface ToolDescriptor {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
inputSchema: unknown;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A registered tool — pairs the public JSON-schema descriptor with the
|
|
20
|
+
* server-side handler (which validates input via a Zod schema then dispatches
|
|
21
|
+
* to the underlying tool implementation).
|
|
22
|
+
*/
|
|
23
|
+
export interface RegisteredTool {
|
|
24
|
+
/** Descriptor returned by `tools/list`. */
|
|
25
|
+
descriptor: ToolDescriptor;
|
|
26
|
+
/** Zod schema used to validate `tools/call` arguments. */
|
|
27
|
+
inputZodSchema: z.ZodTypeAny;
|
|
28
|
+
/** Validated-input handler. Returns the tool's structured result object. */
|
|
29
|
+
handler: (args: unknown) => unknown | Promise<unknown>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* All 15 tools, in display order. Edit this array to add/remove/reorder
|
|
33
|
+
* capabilities. The order here is the order clients see in `tools/list`.
|
|
34
|
+
*/
|
|
35
|
+
export declare const TOOL_REGISTRY: readonly RegisteredTool[];
|
|
36
|
+
/** All tool names exposed by the server. */
|
|
37
|
+
export declare function getToolNames(): string[];
|
|
38
|
+
/** All tool descriptors (for `tools/list`). */
|
|
39
|
+
export declare function getToolDescriptors(): ToolDescriptor[];
|
|
40
|
+
/** Look up a registered tool by its public name. */
|
|
41
|
+
export declare function findTool(name: string): RegisteredTool | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Wraps a tool handler invocation into the MCP `tools/call` result envelope.
|
|
44
|
+
* Used by the low-level transport adapter (kept for backward compatibility);
|
|
45
|
+
* the high-level `McpServer.tool()` registration in `mcpServerFactory.ts`
|
|
46
|
+
* uses the handler directly.
|
|
47
|
+
*/
|
|
48
|
+
export declare function callToolByName(name: string, args: unknown): Promise<{
|
|
49
|
+
content: Array<{
|
|
50
|
+
type: 'text';
|
|
51
|
+
text: string;
|
|
52
|
+
}>;
|
|
53
|
+
isError?: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
//# sourceMappingURL=toolRegistry.d.ts.map
|