Skip to main content
DirectClient provides programmatic access to FrontMCP servers without HTTP or stdio transports. Connect directly from your TypeScript/JavaScript code with automatic LLM-aware response formatting.
DirectClient is ideal for SDK integrations, unit testing, AI agent frameworks (Vercel AI, OpenAI SDK, or custom agent frameworks), and same-process embeddings where network overhead is undesirable.

Transport Comparison

FrontMCP supports multiple ways to connect to MCP servers. Choose based on your use case:

When to Use DirectClient

  • Building AI agents: Integrate MCP tools directly into Vercel AI, OpenAI SDK, or custom agent code
  • Testing: Write unit/integration tests without spinning up servers
  • Same-process integrations: Embed MCP capabilities in your application
  • Performance-critical: Avoid network/IPC overhead for high-throughput scenarios

When to Use Stdio

  • Desktop MCP clients: Claude Desktop, Cursor, VS Code extensions
  • CLI tools: Command-line interfaces that spawn MCP servers
  • Local development: Quick testing with standard MCP clients

When to Use HTTP Transport

  • Production deployments: Remote servers, load balancing, scaling
  • Web applications: Browser-based clients, REST-like access
  • Multi-tenant systems: Shared servers with authentication
  • Distributed architectures: Microservices, serverless

Quick Start

Basic Connection

You can also pass a flat config object instead of a decorated class:

LLM-Specific Connections

For automatic tool/result formatting based on LLM platform:

Core Operations

Tool Operations

Resource Operations

Prompt Operations


Skills Operations

Skills are modular knowledge packages that teach AI how to perform multi-step tasks.

Search Skills

Load Skills

List Skills


Elicitation Handling

Elicitation allows tools to request user input during execution. DirectClient can handle these requests programmatically.

Register Handler

If no handler is registered, elicitation requests are automatically declined.

Manual Submission

For async or external elicitation handling:

Completion Operations

Request argument completion for prompts or resources:

Resource Subscriptions

Subscribe to resource updates for real-time notifications:

Logging Control

Set server-side logging level:

Connection Options


Info Methods


Platform-Specific Formatting

DirectClient automatically formats tools and results based on the detected platform:

Error Handling


Type Exports

All types are exported from @frontmcp/sdk:

Best Practices

Use connectOpenAI, connectClaude, etc. for automatic response formatting instead of manual conversion.
Register an onElicitation handler if your tools use this.elicit() for user input.