/v3-mcp-optimization
MCP server optimization and transport layer enhancement for claude-flow v3. Implements connection pooling, load balancing, tool registry optimization, and performance monitoring for sub-100ms response times.
$ npx -y skills add ruvnet/claude-flow --skill v3-mcp-optimization --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/v3-mcp-optimization
Context preview
The summary Claude sees to decide when to auto-load this skill.
MCP server optimization and transport layer enhancement for claude-flow v3. Implements connection pooling, load balancing, tool registry optimization, and performance monitoring for sub-100ms response times.
SKILL.md
v3-mcp-optimization.SKILL.mdname: "V3 MCP Optimization"
description: "MCP server optimization and transport layer enhancement for claude-flow v3. Implements connection pooling, load balancing, tool registry optimization, and performance monitoring for sub-100ms response times."
V3 MCP Optimization
What This Skill Does
Optimizes claude-flow v3 MCP (Model Context Protocol) server implementation with advanced transport layer optimizations, connection pooling, load balancing, and comprehensive performance monitoring to achieve sub-100ms response times.
Quick Start
# Initialize MCP optimization analysis
Task("MCP architecture", "Analyze current MCP server performance and bottlenecks", "mcp-specialist")
# Optimization implementation (parallel)
Task("Connection pooling", "Implement MCP connection pooling and reuse", "mcp-specialist")
Task("Load balancing", "Add dynamic load balancing for MCP tools", "mcp-specialist")
Task("Transport optimization", "Optimize transport layer performance", "mcp-specialist")MCP Performance Architecture
Current State Analysis
Current MCP Issues:
├── Cold Start Latency: ~1.8s MCP server init
├── Connection Overhead: New connection per request
├── Tool Registry: Linear search O(n) for 213+ tools
├── Transport Layer: No connection reuse
└── Memory Usage: No cleanup of idle connections
Target Performance:
├── Startup Time: <400ms (4.5x improvement)
├── Tool Lookup: <5ms (O(1) hash table)
├── Connection Reuse: 90%+ connection pool hits
├── Response Time: <100ms p95
└── Memory Efficiency: 50% reduction
MCP Server Architecture
// src/core/mcp/mcp-server.ts
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
interface OptimizedMCPConfig {
// Connection pooling
maxConnections: number;
idleTimeoutMs: number;
connectionReuseEnabled: boolean;
// Tool registry
toolCacheEnabled: boolean;
toolIndexType: 'hash' | 'trie';
// Performance
requestTimeoutMs: number;
batchingEnabled: boolean;
compressionEnabled: boolean;
// Monitoring
metricsEnabled: boolean;
healthCheckIntervalMs: number;
}
export class OptimizedMCPServer {
private server: Server;
private connectionPool: ConnectionPool;
private toolRegistry: FastToolRegistry;
private loadBalancer: MCPLoadBalancer;
private metrics: MCPMetrics;
constructor(config: OptimizedMCPConfig) {
this.server = new Server({
name: 'claude-flow-v3',
version: '3.0.0'
}, {
capabilities: {
tools: { listChanged: true },
resources: { subscribe: true, listChanged: true },
prompts: { listChanged: true }
}
});
this.connectionPool = new ConnectionPool(config);
this.toolRegistry = new FastToolRegistry(config.toolIndexType);
this.loadBalancer = new MCPLoadBalancer();
this.metrics = new MCPMetrics(config.metricsEnabled);
}
async start(): Promise<void> {
// Pre-warm connection pool
await this.connectionPool.preWarm();
// Pre-build tool index
await this.toolRegistry.buildIndex();
// Setup request handlers with optimizations
this.setupOptimizedHandlers();
// Start health monitoring
this.startHealthMonitoring();
// Start server
const transport = new StdioServerTransport();
await this.server.connect(transport);
this.metrics.recordStartup();
}
}Connection Pool Implementation
Advanced Connection Pooling
// src/core/mcp/connection-pool.ts
interface PooledConnection {
id: string;
connection: MCPConnection;
lastUsed: number;
usageCount: number;
isHealthy: boolean;
}
export class ConnectionPool {
private pool: Map<string, PooledConnection> = new Map();
private readonly config: ConnectionPoolConfig;
private healthChecker: HealthChecker;
constructor(config: ConnectionPoolConfig) {
this.config = {
maxConnections: 50,
minConnections: 5,
idleTimeoutMs: 300000, // 5 minutes
maxUsageCount: 1000,
healthCheckIntervalMs: 30000,
...config
};
this.healthChecker = new HealthChecker(this.config.healthCheckIntervalMs);
}
async getConnection(endpoint: string): Promise<MCPConnection> {
const start = performance.now();
// Try to get from pool first
const pooled = this.findAvailableConnection(endpoint);
if (pooled) {
pooled.lastUsed = Date.now();
pooled.usageCount++;
this.recordMetric('pool_hit', performance.now() - start);
return pooled.connection;
}
// Check pool capacity
if (this.pool.size >= this.config.maxConnections) {
await this.evictLeastUsedConnection();
}
// Create new connection
const connection = await this.createConnection(endpoint);
const pooledConn: PooledConnection = {
id: this.generateConnectionId(),
connection,
lastUsed: Date.now(),
usageCount: 1,
isHealthy: true
};
this.pool.set(pooledConn.id, pooledConn);
this.recordMetric('pool_miss', performance.now() - start);
return connection;
}
async releaseConnection(connection: MCPConnection): Promise<void> {
// Mark connection as available for reuse
const pooled = this.findConnectionById(connection.id);
if (pooled) {
// Check if connection should be retired
if (pooled.usageCount >= this.config.maxUsageCount) {
await this.removeConnection(pooled.id);
}
}
}
async preWarm(): Promise<void> {
const connections: Promise<MCPConnection>[] = [];
for (let i = 0; i < this.config.minConnections; i++) {
connections.push(this.createConnection('default'));
}
await Promise.all(connections);
}
private async evictLeastUsedConnection(): Promise<void> {
let oldestConn: PooledConnection | null = null;
let oldestTime = Date.now();
for (const conn of this.pool.values()) {
if (conn.lastUsed < oldestTime) {Read more
name: "V3 MCP Optimization" description: "MCP server optimization and transport layer enhancement for claude-flow v3. Implements connection pooling, load balancing, tool registry optimization, and performance monitoring for sub-100ms response times."
V3 MCP Optimization
What This Skill Does
Optimizes claude-flow v3 MCP (Model Context Protocol) server implementation with advanced transport layer optimizations, connection pooling, load balancing, and comprehensive performance monitoring to achieve sub-100ms response times.
Quick Start
# Initialize MCP optimization analysis
Task("MCP architecture", "Analyze current MCP server performance and bottlenecks", "mcp-specialist")
# Optimization implementation (parallel)
Task("Connection pooling", "Implement MCP connection pooling and reuse", "mcp-specialist")
Task("Load balancing", "Add dynamic load balancing for MCP tools", "mcp-specialist")
Task("Transport optimization", "Optimize transport layer performance", "mcp-specialist")MCP Performance Architecture
Current State Analysis
Current MCP Issues: ├── Cold Start Latency: ~1.8s MCP server init ├── Connection Overhead: New connection per request ├── Tool Registry: Linear search O(n) for 213+ tools ├── Transport Layer: No connection reuse └── Memory Usage: No cleanup of idle connections Target Performance: ├── Startup Time: <400ms (4.5x improvement) ├── Tool Lookup: <5ms (O(1) hash table) ├── Connection Reuse: 90%+ connection pool hits ├── Response Time: <100ms p95 └── Memory Efficiency: 50% reduction
MCP Server Architecture
// src/core/mcp/mcp-server.ts
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
interface OptimizedMCPConfig {
// Connection pooling
maxConnections: number;
idleTimeoutMs: number;
connectionReuseEnabled: boolean;
// Tool registry
toolCacheEnabled: boolean;
toolIndexType: 'hash' | 'trie';
// Performance
requestTimeoutMs: number;
batchingEnabled: boolean;
compressionEnabled: boolean;
// Monitoring
metricsEnabled: boolean;
healthCheckIntervalMs: number;
}
export class OptimizedMCPServer {
private server: Server;
private connectionPool: ConnectionPool;
private toolRegistry: FastToolRegistry;
private loadBalancer: MCPLoadBalancer;
private metrics: MCPMetrics;
constructor(config: OptimizedMCPConfig) {
this.server = new Server({
name: 'claude-flow-v3',
version: '3.0.0'
}, {
capabilities: {
tools: { listChanged: true },
resources: { subscribe: true, listChanged: true },
prompts: { listChanged: true }
}
});
this.connectionPool = new ConnectionPool(config);
this.toolRegistry = new FastToolRegistry(config.toolIndexType);
this.loadBalancer = new MCPLoadBalancer();
this.metrics = new MCPMetrics(config.metricsEnabled);
}
async start(): Promise<void> {
// Pre-warm connection pool
await this.connectionPool.preWarm();
// Pre-build tool index
await this.toolRegistry.buildIndex();
// Setup request handlers with optimizations
this.setupOptimizedHandlers();
// Start health monitoring
this.startHealthMonitoring();
// Start server
const transport = new StdioServerTransport();
await this.server.connect(transport);
this.metrics.recordStartup();
}
}Connection Pool Implementation
Advanced Connection Pooling
// src/core/mcp/connection-pool.ts
interface PooledConnection {
id: string;
connection: MCPConnection;
lastUsed: number;
usageCount: number;
isHealthy: boolean;
}
export class ConnectionPool {
private pool: Map<string, PooledConnection> = new Map();
private readonly config: ConnectionPoolConfig;
private healthChecker: HealthChecker;
constructor(config: ConnectionPoolConfig) {
this.config = {
maxConnections: 50,
minConnections: 5,
idleTimeoutMs: 300000, // 5 minutes
maxUsageCount: 1000,
healthCheckIntervalMs: 30000,
...config
};
this.healthChecker = new HealthChecker(this.config.healthCheckIntervalMs);
}
async getConnection(endpoint: string): Promise<MCPConnection> {
const start = performance.now();
// Try to get from pool first
const pooled = this.findAvailableConnection(endpoint);
if (pooled) {
pooled.lastUsed = Date.now();
pooled.usageCount++;
this.recordMetric('pool_hit', performance.now() - start);
return pooled.connection;
}
// Check pool capacity
if (this.pool.size >= this.config.maxConnections) {
await this.evictLeastUsedConnection();
}
// Create new connection
const connection = await this.createConnection(endpoint);
const pooledConn: PooledConnection = {
id: this.generateConnectionId(),
connection,
lastUsed: Date.now(),
usageCount: 1,
isHealthy: true
};
this.pool.set(pooledConn.id, pooledConn);
this.recordMetric('pool_miss', performance.now() - start);
return connection;
}
async releaseConnection(connection: MCPConnection): Promise<void> {
// Mark connection as available for reuse
const pooled = this.findConnectionById(connection.id);
if (pooled) {
// Check if connection should be retired
if (pooled.usageCount >= this.config.maxUsageCount) {
await this.removeConnection(pooled.id);
}
}
}
async preWarm(): Promise<void> {
const connections: Promise<MCPConnection>[] = [];
for (let i = 0; i < this.config.minConnections; i++) {
connections.push(this.createConnection('default'));
}
await Promise.all(connections);
}
private async evictLeastUsedConnection(): Promise<void> {
let oldestConn: PooledConnection | null = null;
let oldestTime = Date.now();
for (const conn of this.pool.values()) {
if (conn.lastUsed < oldestTime) {An agent meta-harness for Claude Code and Codex. Agent = Model + Harness. The model writes; the harness gives it tools, memory, loops, sandboxes, and controls so it can actually work.
Repo: ruvnet/claude-flow
Other skills on claude-flow.
- /agentdb-advanced
Master advanced AgentDB features including QUIC synchronization, multi-database management, custom distance metrics, hybrid search, and distributed systems integration. Use when building distributed AI systems, multi-agent coordination, or advanced vector search applications.
Open skill - /agentdb-learning
Create and train AI learning plugins with AgentDB's 9 reinforcement learning algorithms. Includes Decision Transformer, Q-Learning, SARSA, Actor-Critic, and more. Use when building self-learning agents, implementing RL, or optimizing agent behavior through experience.
Open skill - /agentdb-memory-patterns
Implement persistent memory patterns for AI agents using AgentDB. Includes session memory, long-term storage, pattern learning, and context management. Use when building stateful agents, chat systems, or intelligent assistants.
Open skill - /agentdb-optimization
Optimize AgentDB performance with quantization (4-32x memory reduction), HNSW indexing (150x faster search), caching, and batch operations. Use when optimizing memory usage, improving search speed, or scaling to millions of vectors.
Open skill - /agentdb-vector-search
Implement semantic vector search with AgentDB for intelligent document retrieval, similarity matching, and context-aware querying. Use when building RAG systems, semantic search engines, or intelligent knowledge bases.
Open skill - /agentic-jujutsu
Quantum-resistant, self-learning version control for AI agents with ReasoningBank intelligence and multi-agent coordination
Open skill

