Skip to content
Draft
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
18 changes: 18 additions & 0 deletions sdk/src/__tests__/load-agents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,24 @@ describe('loadLocalAgents', () => {
expect(result['real-agent']).toBeDefined()
})

test('does not execute nested MCP implementation files', async () => {
const mcpBinDir = path.join(agentsDir, 'plugins', 'example', 'mcp', 'bin')
const executionMarker = path.join(tempDir, 'mcp-module-executed')
mkdirSync(mcpBinDir, { recursive: true })
writeAgentFile(
mcpBinDir,
'mcp-proxy.cjs',
`
require('fs').writeFileSync(${JSON.stringify(executionMarker)}, 'executed')
module.exports = {}
`,
)

await loadLocalAgents({ agentsPath: agentsDir })

expect(existsSync(executionMarker)).toBe(false)
})

test('loads valid agent definitions that use shorthand required fields', async () => {
mkdirSync(agentsDir, { recursive: true })
writeAgentFile(
Expand Down
1 change: 1 addition & 0 deletions sdk/src/agents/load-agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const agentFileExtensions = new Set(['.ts', '.tsx', '.js', '.mjs', '.cjs'])
const shouldSkipAgentDirectory = (name: string): boolean =>
name.startsWith('.') ||
name === 'node_modules' ||
name === 'plugins' ||
name === 'scripts' ||
name === 'skills' ||
name.startsWith('skills-')
Expand Down