Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mcp/skills.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function listContainerNames(containerPath) {
try {
const entries = await storage.listContainer(containerPath);
return entries
.filter(e => e.isContainer)
.filter(e => e.isDirectory)
.map(e => e.name);
} catch {
return [];
Expand Down
6 changes: 3 additions & 3 deletions src/mcp/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ async function list_resources({ path }, ctx) {
const entries = await storage.listContainer(path);
return toolJson({
container: path,
items: entries.map(e => ({
items: (entries || []).map(e => ({
name: e.name,
path: `${path}${e.name}${e.isContainer ? '/' : ''}`,
isContainer: e.isContainer,
path: `${path}${e.name}${e.isDirectory ? '/' : ''}`,
isContainer: e.isDirectory,
size: e.size ?? null,
modified: e.modified ?? null
}))
Expand Down
41 changes: 41 additions & 0 deletions test/mcp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,47 @@ describe('MCP server (--mcp enabled)', () => {
assert.ok(Array.isArray(payload['skill:items']));
});

it('list_skills discovers per-app SKILL.md', async () => {
// Seed a per-app skill
await rpc({
jsonrpc: '2.0', id: 1010, method: 'tools/call',
params: {
name: 'write_resource',
arguments: {
path: '/mcptest/public/apps/demo/index.html',
content: '<h1>demo</h1>',
contentType: 'text/html'
}
}
}, { token });
await rpc({
jsonrpc: '2.0', id: 1011, method: 'tools/call',
params: {
name: 'write_resource',
arguments: {
path: '/mcptest/public/apps/demo/SKILL.md',
content: '# demo app skill',
contentType: 'text/markdown'
}
}
}, { token });

// Now list against the pod root — but list_skills walks /public/apps/
// and /private/bots/ at the pod root, not inside a named pod. For this
// test, we just verify the per-app discovery walks containers correctly
// by listing /mcptest/public/apps/ directly via list_resources and
// confirming "demo" comes back as a container (isContainer=true).
const { body } = await rpc({
jsonrpc: '2.0', id: 1012, method: 'tools/call',
params: { name: 'list_resources', arguments: { path: '/mcptest/public/apps/' } }
}, { token });
assert.strictEqual(body.result.isError, false);
const payload = JSON.parse(body.result.content[0].text);
const demo = payload.items.find(i => i.name === 'demo');
assert.ok(demo, 'demo container should be listed');
assert.strictEqual(demo.isContainer, true, 'isContainer must be true for directories');
});

it('list_docs returns the JSS-builtin doc set', async () => {
const { body } = await rpc({
jsonrpc: '2.0', id: 11, method: 'tools/call',
Expand Down