refactor(mcp-server): extract framework-agnostic handlers#1364
Open
Scra3 wants to merge 4 commits intofeat/add-ai-integrationfrom
Open
refactor(mcp-server): extract framework-agnostic handlers#1364Scra3 wants to merge 4 commits intofeat/add-ai-integrationfrom
Scra3 wants to merge 4 commits intofeat/add-ai-integrationfrom
Conversation
Add new package for AI/LLM integration with MCP server support. - Router for handling AI proxy requests with provider configuration - MCP client for connecting to Model Context Protocol servers - Remote tools abstraction for external tool invocations - Provider dispatcher for multi-provider LLM support - Comprehensive test coverage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add service to fetch MCP server configurations from Forest Admin API. - New McpServerConfigService for fetching MCP server configs - Add getMcpServerConfigs endpoint to ForestHttpApi - Integrate service into ForestAdminClient 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add support for AI/LLM integration in the agent package. - New addAI customization method for configuring AI provider - AI proxy route handler at /_internal/ai-proxy/:route - Integration with MCP server configuration service - Schema flag for AI enabled projects 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This refactor introduces McpHandlers class that provides framework-agnostic handlers for MCP OAuth and protocol requests. This allows: 1. MCP logic to be reused with any HTTP framework (Express, Koa, etc.) 2. Agent to use native Koa routes instead of Express-to-Koa bridging 3. Cleaner separation between protocol logic and HTTP framework Key changes: - Add McpHandlers class with framework-agnostic methods: - getOAuthMetadata(): returns OAuth metadata - getProtectedResourceMetadata(): returns protected resource metadata - handleAuthorize(): returns redirect URL or error - handleToken(): returns tokens or error - handleMcpRequest(): handles MCP protocol requests - Add getAuthorizationUrl() to ForestOAuthProvider (returns URL string) - Update agent to create native Koa routes using McpHandlers - Update FrameworkMounter to mount Koa router for MCP routes - Remove express-to-koa wrapper (no longer needed) - Simplify useMcp() API (no factory needed) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
14 new issues
|
9dd379a to
e5305ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
McpHandlersclass from Express-based MCP serverexpress-to-koa.tsutility (no longer needed)getAuthorizationUrl()method toForestOAuthProviderfor framework-agnostic authorizationArchitecture
The
@forestadmin/mcp-serverpackage now exports:McpHandlers: Framework-agnostic class that returns data/results instead of manipulating response objectsForestMCPServer: Express-based server (kept for CLI/standalone usage)The agent creates native Koa routes that use
McpHandlers:Benefits
Test plan
yarn test)yarn build)🤖 Generated with Claude Code