Skip to content

perf: Reduce MCP server memory usage by 53% - #64

Open
kdcokenny wants to merge 1 commit into
Dokploy:mainfrom
kdcokenny:kdcokenny/perf-lazy-tool-schemas
Open

perf: Reduce MCP server memory usage by 53%#64
kdcokenny wants to merge 1 commit into
Dokploy:mainfrom
kdcokenny:kdcokenny/perf-lazy-tool-schemas

Conversation

@kdcokenny

Copy link
Copy Markdown
Contributor

Addresses #63

This is the minimal TypeScript fix described in the issue. It reduces memory usage from around 89 MB to 42 MB without replacing Node or the official MCP SDK.

Version RAM usage Decrease
Current 89 MB
This PR 42 MB 53%

The main change is generating the advertised JSON schemas during the existing build step and only creating each Zod validation schema when its tool is actually called. The Dokploy API client is also loaded on its first use.

All 524 tools and their advertised schemas remain identical. Stdio, Streamable HTTP, SSE, tag filtering, validation, redaction, and existing packaging are preserved.

The only measured tradeoff is around 65 ms of additional latency on the first tool call. Later calls perform approximately the same as before.

Tests, type-checking, build, package verification, and MCP transport checks pass.

@kdcokenny
kdcokenny marked this pull request as ready for review July 30, 2026 23:28
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.

1 participant