Adding cf/agents tests (#11)

* Cloning demo repo

* added test for agents/mcp

---------

Co-authored-by: Glen Maddern <glen@glenmaddern.com>
This commit is contained in:
Glen Maddern 2025-06-30 21:51:49 +10:00 • committed by GitHub
commit 7f019fed7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,18 +18,21 @@ function getMCPServers() {
throw new Error('hono-mcp port not found in test state')
}
if (!state.cfAgentsPort) {
throw new Error('cf-agents port not found in test state')
}
return [
{
name: 'hono-mcp',
url: `http://localhost:${state.honoPort}/mcp`,
expectedTools: 1, // Minimum expected tools count
},
// Add more servers here as they become available
// {
// name: 'another-server',
// url: 'http://localhost:9902/mcp',
// expectedTools: 1,
// },
{
name: 'cf-agents',
url: `http://localhost:${state.cfAgentsPort}/mcp`,
expectedTools: 1, // Minimum expected tools count
},
]
} catch (error) {
throw new Error(`Test environment not properly initialized: ${error}`)
@ -161,6 +164,15 @@ describe('MCP Connection Integration Tests', () => {
// Ignore errors - process might already be dead
}
try {
if (state?.cfAgentsServer && !state.cfAgentsServer.killed) {
console.log('🔥 Force cleanup cf-agents server...')
state.cfAgentsServer.kill('SIGKILL')
}
} catch (e) {
// Ignore errors - process might already be dead
}
try {
if (state?.staticServer) {
state.staticServer.close()