Oauth tests (#13)

* Moving the non-authed cfagents tests to /public

* Added OAuth CF Agents tests

---------

Co-authored-by: Glen Maddern <glen@glenmaddern.com>
This commit is contained in:
Glen Maddern 2025-07-01 13:26:26 +10:00 • committed by GitHub
commit 0ea0bc48c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -30,11 +30,21 @@ function getMCPServers() {
},
{
name: 'cf-agents',
url: `http://localhost:${state.cfAgentsPort}/mcp`,
url: `http://localhost:${state.cfAgentsPort}/public/mcp`,
expectedTools: 1, // Minimum expected tools count
},
{
name: 'cf-agents-sse',
url: `http://localhost:${state.cfAgentsPort}/public/sse`,
expectedTools: 1, // Minimum expected tools count
},
{
name: 'cf-agents-auth',
url: `http://localhost:${state.cfAgentsPort}/mcp`,
expectedTools: 1, // Minimum expected tools count
},
{
name: 'cf-agents-auth-sse',
url: `http://localhost:${state.cfAgentsPort}/sse`,
expectedTools: 1, // Minimum expected tools count
},
@ -216,23 +226,25 @@ describe('MCP Connection Integration Tests', () => {
})
const testScenarios = [
// Working examples with auto transport (should pass)
// Hono examples (MCP only)
{ serverName: 'hono-mcp', transportType: 'auto' as const },
{ serverName: 'cf-agents', transportType: 'auto' as const },
// SSE endpoint with SSE transport (should pass)
{ serverName: 'cf-agents-sse', transportType: 'sse' as const },
// Additional test cases for HTTP transport
{ serverName: 'hono-mcp', transportType: 'http' as const },
{ serverName: 'cf-agents', transportType: 'http' as const },
// Failing case: SSE endpoint with auto transport (should fail)
// Agents, no auth
{ serverName: 'cf-agents', transportType: 'auto' as const },
{ serverName: 'cf-agents', transportType: 'http' as const },
{ serverName: 'cf-agents-sse', transportType: 'sse' as const },
{ serverName: 'cf-agents-sse', transportType: 'auto' as const },
// Agents, with auth
{ serverName: 'cf-agents-auth', transportType: 'auto' as const },
{ serverName: 'cf-agents-auth', transportType: 'http' as const },
{ serverName: 'cf-agents-auth-sse', transportType: 'sse' as const },
{ serverName: 'cf-agents-auth-sse', transportType: 'auto' as const },
]
test.each(testScenarios)(
'should connect to $serverName with $transportType transport (expect: $shouldPass)',
'should connect to $serverName with $transportType transport',
async ({ serverName, transportType }) => {
const servers = getMCPServers()
const server = servers.find((s) => s.name === serverName)