Skip to content

Conversation

@Scra3
Copy link
Member

@Scra3 Scra3 commented Dec 12, 2025

Summary

  • Add a native Koa implementation of the MCP server that bypasses the Express-based handlers from @modelcontextprotocol/sdk
  • This allows Forest Admin agent (Koa-based) to use MCP without Express bridging
  • New exports: KoaMcpServer, KoaMcpServerOptions, createKoaMcpMiddleware

New files:

  • koa-server.ts: Pure Koa MCP server with OAuth handlers
  • koa-factory.ts: Factory function for creating Koa middleware

Key points:

  • Reuses ForestOAuthProvider (framework-agnostic)
  • Reimplements OAuth routes (authorize, token, metadata endpoints) in native Koa
  • No Express dependency for Koa users
  • Same OAuth flow and security as the Express version

Usage in Forest Agent:

import { createKoaMcpMiddleware } from '@forestadmin/mcp-server';

const mcpMiddleware = await createKoaMcpMiddleware({
  forestServerUrl: context.forestServerUrl,
  envSecret: context.envSecret,
  authSecret: context.authSecret,
  logger: context.logger,
}, { baseUrl: 'https://myapp.com' });

koaApp.use(mcpMiddleware);

Test plan

  • All existing tests pass (216 tests)
  • Build passes
  • Manual testing with MCP client

🤖 Generated with Claude Code

VincentMolinie and others added 15 commits December 11, 2025 14:30
Add a native Koa implementation of the MCP server that bypasses the
Express-based handlers from @modelcontextprotocol/sdk. This allows
Forest Admin agent (Koa-based) to use MCP without Express bridging.

New files:
- koa-server.ts: Pure Koa MCP server with OAuth handlers
- koa-factory.ts: Factory function for creating Koa middleware

The implementation reuses ForestOAuthProvider (framework-agnostic) and
reimplements the OAuth routes (authorize, token, metadata endpoints)
in native Koa.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@qltysh
Copy link

qltysh bot commented Dec 12, 2025

15 new issues

Tool Category Rule Count
qlty Structure Function with high complexity (count = 19): useCallbackOnFastify 6
qlty Structure Function with many parameters (count = 4): exchangeAuthorizationCode 3
qlty Structure Deeply nested control flow (level = 4) 2
qlty Duplication Found 15 lines of similar code in 2 locations (mass = 69) 2
qlty Structure Function with many returns (count = 4): setupSuperagentMock 2

@Scra3 Scra3 changed the base branch from main to feat/forest-mcp/use-route December 12, 2025 19:21
@VincentMolinie VincentMolinie force-pushed the feat/forest-mcp/use-route branch from 6d0ec50 to f740b4e Compare December 16, 2025 10:55
Base automatically changed from feat/forest-mcp/use-route to feat/forest-mcp/main December 17, 2025 10:09
Base automatically changed from feat/forest-mcp/main to main December 18, 2025 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants