SKILLS/EVOKORE EXTENSIONS/v3-mcp-optimization/SKILL.md
Use when ProxyManager throughput or cold-start latency is a bottleneck — catalogs six optimization patterns (O(1) lookup, 3-tier cache, batch compression, pool reuse, lazy deserialization, parallel boot) with TypeScript snippets and expected gains.
npx skillsauth add mattmre/evokore-mcp v3-mcp-optimizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Catalog of six concrete optimization patterns for EVOKORE-MCP's ProxyManager in v3. Each pattern has a measured-or-expected gain, a trigger condition, a TypeScript snippet, and an anti-pattern note. Apply these only when a profiler or benchmark identifies the corresponding bottleneck — premature application of (3) or (5) can regress cold-start.
Use this skill when:
Replace the linear tools.find(t => t.name === name) scan with a Map<string, Tool> built at registration time. With ~300 tools across proxied servers, this moves dispatch from O(n) to O(1).
Expected gain: 20–60× speedup on dispatch for aggregators with 100+ tools.
// Before
const tool = this.tools.find(t => t.name === name); // O(n)
// After
private toolIndex: Map<string, Tool> = new Map();
registerTool(tool: Tool) {
this.toolIndex.set(tool.name, tool);
}
dispatch(name: string) {
const tool = this.toolIndex.get(name); // O(1)
if (!tool) throw new Error(`Unknown tool: ${name}`);
return tool;
}
Skill and tool metadata flows through a three-level cache. L1 is a Map with LRU eviction; L2 is an on-disk JSON cache under ~/.evokore/cache/; L3 is the remote registry fetch. Hits cascade downward and fill upward.
Expected gain: cold-start ~40% faster on warm L2, ~95% faster on warm L1.
async getSkill(name: string): Promise<Skill> {
// L1
const hit1 = this.l1.get(name);
if (hit1 && !this.isStale(hit1)) return hit1;
// L2
const hit2 = await this.l2ReadJson(`skills/${name}.json`);
if (hit2 && !this.isStale(hit2)) {
this.l1.set(name, hit2);
return hit2;
}
// L3
const fresh = await this.registry.fetchSkill(name);
await this.l2WriteJson(`skills/${name}.json`, fresh);
this.l1.set(name, fresh);
return fresh;
}
When a client issues N sequential tool calls against the same child server, coalesce them into a single batch frame and dispatch via one JSON-RPC round trip (when the child server supports batching) or a pipelined write.
Expected gain: 3–5× throughput on multi-tool pipelines; reduces per-call transport overhead.
async callBatch(calls: ToolCall[]): Promise<ToolResult[]> {
const byServer = groupBy(calls, c => this.serverFor(c.name));
const results = await Promise.all(
Object.entries(byServer).map(([serverId, group]) =>
this.sendBatchFrame(serverId, group)
)
);
return results.flat();
}
Anti-pattern: do NOT batch calls that have cross-call ordering dependencies — the child server is free to reorder within a batch.
Child server processes crash. Instead of rebuilding the transport from scratch, maintain a pool keyed by server ID and recycle the transport wrapper — only the child process is respawned.
Expected gain: restart recovery goes from ~2s → ~200ms on Node-based child servers.
private pool: Map<string, TransportSlot> = new Map();
async ensureChild(serverId: string): Promise<Transport> {
const slot = this.pool.get(serverId);
if (slot?.transport.isAlive()) return slot.transport;
const transport = slot?.transport ?? this.buildTransport(serverId);
await transport.respawn({ keepSchemaCache: true });
this.pool.set(serverId, { transport, respawnCount: (slot?.respawnCount ?? 0) + 1 });
return transport;
}
JSON Schemas for tool inputs are large. Parse them only when a tool is actually invoked or introspected — store the raw string at registration and memoize the parsed form.
Expected gain: 30–50% faster registration for proxies fronting 10+ servers with 50+ tools each.
interface ToolEntry {
name: string;
schemaRaw: string; // stored at registration
schemaParsed?: JSONSchema; // filled on first access
}
getSchema(name: string): JSONSchema {
const entry = this.toolIndex.get(name)!;
if (!entry.schemaParsed) {
entry.schemaParsed = JSON.parse(entry.schemaRaw);
}
return entry.schemaParsed;
}
Anti-pattern: do NOT lazy-parse if you rely on schema validation of the raw string at registration — lazy parsing defers the validity check.
Promise.allSettledSerial for ... await of child server boots turns cold start into Σ(latencies). Replace with Promise.allSettled so partial failures don't block healthy children. Pair with the async-background-boot pattern already in v3 so the MCP handshake returns immediately.
Expected gain: boot wall-clock ≈ max(child_latency) instead of sum; measured ~3–4× improvement on a 5-server config.
async loadServers(configs: ServerConfig[]): Promise<void> {
const results = await Promise.allSettled(
configs.map(cfg => this.bootChild(cfg))
);
for (const [i, r] of results.entries()) {
if (r.status === 'rejected') {
this.logger.error(`Child boot failed: ${configs[i].id}`, r.reason);
this.markDegraded(configs[i].id, r.reason);
}
}
this.emit('bootstrap:complete');
}
Anti-pattern: do NOT use Promise.all — one failing child will reject the whole boot and leave healthy children unregistered.
| Symptom | Pattern(s) |
|---------|-----------|
| Tool dispatch hot in flame graph | 1 |
| Repeated remote fetches of the same skill | 2 |
| N round-trips for logically-batched work | 3 |
| Long child-server restart latency | 4 |
| Slow tools/list on startup | 5 |
| Cold-start time grows linearly with server count | 6 |
Measured on the EVOKORE v3.1 corpus (10 child servers, ~300 aggregated tools), apples-to-apples with the pre-optimization baseline:
tools/list on cold start 480ms → 260ms (~1.85×)Gains are multiplicative when multiple patterns apply, but do NOT just linearly sum — benchmark after each change.
allSettled — see anti-pattern in that sectiondevelopment
Core orchestration framework for model-agnostic multi-agent workflows with handoff protocol, policy governance, and configuration schemas
testing
Specialized skill for triage issue skill workflows.
development
Complete workflow for building, implementing, and testing goal-driven agents. Orchestrates hive-* skills. Use when starting a new agent project, unsure which skill to use, or need end-to-end guidance.
development
Iterative agent testing with session recovery. Execute, analyze, fix, resume from checkpoints. Use when testing an agent, debugging test failures, or verifying fixes without re-running from scratch.