-
Notifications
You must be signed in to change notification settings - Fork 27
feat(mcp-data): adds mcp indexing and mcp requests/responses analytics #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…rver - Implemented event logging for proxy requests and responses to an ingest URL. - Enhanced the MCP server's index file to include request and response latency tracking. - Updated pnpm-lock.yaml to include new dependencies for the MCP data application. - Added AnalyticsHook export to the js-sdk handler for improved analytics integration.
…text Protocol SDK - Added new SQL migration files to create 'events' and 'mcp_servers' tables with appropriate constraints and indexes. - Introduced a new 'inspectMcp' function to interact with the Model Context Protocol SDK for enhanced server inspection capabilities. - Updated package.json to include the Model Context Protocol SDK as a dependency. - Modified server logic to utilize the new inspection functionality and improved data handling. - Added an example environment file for database configuration.
…RPC ingestion - Created a new SQL migration to establish the 'rpc_logs' table with necessary fields and indexes. - Modified the server logic to handle RPC requests, including enhanced data parsing and validation. - Updated the database schema to reflect changes in the 'mcp_servers' and 'rpc_logs' tables. - Removed the deprecated 'events' table and adjusted related logic accordingly.
…hance analytics integration - Introduced typed support and hook stages for various MCP methods including initialize, tools/list, prompts/list, and more. - Added optional requestContext to all request shapes and support for continueAsync in request hooks. - Generalized proxy routing to handle all MCP methods and notifications, ensuring proper response handling. - Implemented analytics logging for proxy requests, enhancing data tracking capabilities. - Updated environment configuration to include MCP_DATA_URL and MCP_DATA_SECRET for analytics ingestion. - Maintained backward compatibility for existing hooks and documented new hook methods in README.
…nsive request handling - Expanded the MCP proxy hooks to support a wider range of request types, including initialize, tools/list, prompts/list, and resources/read. - Introduced optional requestContext in request schemas for better context management. - Implemented detailed analytics logging for various request results, improving tracking and monitoring capabilities. - Updated README documentation to reflect new hook methods and usage examples. - Maintained backward compatibility while enhancing the overall structure and functionality of the proxy system.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| } | ||
|
|
||
| const withMcpProxy = (session: any) => withProxy(targetUrl, [ | ||
| new AnalyticsHook(analyticsSink, targetUrl), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented-out code on line 488 uses the old withProxy API signature which is missing the required targetUrl parameter.
View Details
📝 Patch Details
diff --git a/apps/mcp/src/index.ts b/apps/mcp/src/index.ts
index bfd973c..3712932 100644
--- a/apps/mcp/src/index.ts
+++ b/apps/mcp/src/index.ts
@@ -484,8 +484,12 @@ app.all("/mcp", async (c) => {
});
// app.all("/mcp/*", async (c) => {
+// const targetUrl = await resolveTargetUrl(c.req.raw);
+// if (!targetUrl) {
+// return new Response("target-url missing", { status: 400 });
+// }
-// const withMcpProxy = (session: any) => withProxy([
+// const withMcpProxy = (session: any) => withProxy(targetUrl, [
// new LoggingHook(),
// new X402WalletHook(session),
// new SecurityHook(),
Analysis
Commented code uses outdated withProxy API signature missing required targetUrl parameter
What fails: Line 488 in apps/mcp/src/index.ts calls withProxy([...]) but the current API signature requires withProxy(targetUrl, hooks)
How to reproduce: Uncomment the code block at line 485-505 and run the application - it will throw a runtime error when the /mcp/* route is accessed
Result: Runtime error: "withProxy expects first argument to be a string (targetUrl)" due to API signature mismatch
Expected: Should use withProxy(targetUrl, [...]) like the working code above it at line 390
Fix: Updated commented code to include targetUrl resolution and pass it as first parameter to withProxy, matching the current API defined in packages/js-sdk/src/handler/proxy/index.ts line 43
- Bumped MCPay version in package.json to 0.1.7-beta.13. - Added new changeset files: cold-lizards-sniff and legal-shrimps-smash for upcoming changes.
- Bumped MCPay version in package.json to 0.1.7-beta.14. - Added new changeset file: quick-tips-study for upcoming changes. - Refactored proxy hooks to improve type handling and error propagation in request processing.
No description provided.