DEV Community

Cover image for # Why I Built MCP Client Generator (And Why You Should Care)
Konstantin Tarkus
Konstantin Tarkus

Posted on • Originally published at Medium

# Why I Built MCP Client Generator (And Why You Should Care)

⚠️ Upfront disclaimer: This is an early prototype exploring new approaches to API integration. It's not production-ready, but I'm sharing it to gather feedback from developers facing similar challenges.

Picture this: You're building with AI coding assistants like Claude or GitHub Copilot, and they're using MCP tools to interact with your services. But here's the catch – inefficient tool usage can dramatically increase your token costs. A single poorly optimized loop calling APIs could burn through tokens faster than you expect.

I learned this the hard way. My AI assistant was making individual API calls in a loop, consuming tokens at an alarming rate. That's when I realized: we need a better way to interact with MCP servers – one that's both cost-effective and developer-friendly.

The Hidden Cost of AI Tool Usage

You know the drill – you need to connect to GitHub, Notion, Linear, and multiple other services. Each one has its own SDK quirks, authentication dance, and type definitions that may or may not be up-to-date. But there's a bigger problem:

When AI agents use MCP tools inefficiently, your costs can escalate quickly.

Instead of letting AI assistants make hundreds of individual tool calls, what if we could generate efficient, batched automation scripts? What if we could have type-safe clients that encourage best practices? What if authentication could just... work?

That's when I discovered the potential of the Model Context Protocol (MCP) and decided to build something to solve this problem.

The Integration Challenge Many Developers Face

Whether you're a solo developer automating your workflow or part of a startup building integrations, you've likely encountered this scenario:

  • Create GitHub issues from Notion pages
  • Sync tasks with Linear for bug tracking
  • Move data between multiple platforms
  • Do it all with proper TypeScript support

The traditional approach? Install multiple SDKs, manage different authentication flows, deal with various error handling patterns, and hope everything stays in sync. Oh, and don't forget to create OAuth applications for each service – complete with client IDs and secrets that you'll need to manage securely.

The boilerplate accumulates quickly.

Enter MCP Client Generator: A Prototype

Here's what I'm experimenting with:

import { notion, github, linear } from "./lib/mcp-client";

// One command will generate all of this with full type safety
const page = await notion.createPage({
  title: "Bug Report: Login Issues",
  content: "Users are reporting authentication failures...",
});

const issue = await github.createIssue({
  title: page.title,
  body: page.content,
});

await linear.createIssue({
  title: `Bug: ${page.title}`,
  description: `GitHub Issue: ${issue.html_url}`,
  teamId: "engineering",
});
Enter fullscreen mode Exit fullscreen mode

That's the goal. Three services, fully typed, with a single configuration file:

{
  "mcpServers": {
    "notion": {
      "type": "http",
      "url": "https://mcp.notion.com/mcp"
    },
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/"
    },
    "linear": {
      "type": "sse",
      "url": "https://mcp.linear.app/sse"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

The Authentication Reality

Here's what I'm exploring: simplified OAuth setup where possible.

Traditional approach:

  1. Go to GitHub's developer settings
  2. Create a new OAuth app
  3. Configure redirect URIs
  4. Copy client ID and secret
  5. Repeat for each service
  6. Manage secrets securely
  7. Handle token refresh logic
  8. Deal with different OAuth flows per service

The idealized MCP approach (when fully implemented):

  1. Run npx mcp-client-gen
  2. Configure your MCP server endpoints
  3. Authenticate through browser redirect
  4. Tokens stored locally for reuse

Reality check: This relies on RFC 7591 Dynamic Client Registration, which:

  • Isn't universally supported - Many services don't allow dynamic registration
  • Has security implications - Some orgs prohibit dynamic client creation
  • Still requires browser auth - You'll be redirected to approve access
  • Needs secure token storage - We handle refresh, but you manage security

For services without dynamic registration, you'll still need to create OAuth apps manually and provide credentials in your config.

The Potential for Cost Optimization

The Efficiency Problem: When using AI assistants with APIs, inefficient patterns can increase costs. For example, making 100 individual API calls instead of batched requests means more tokens for tool invocations, responses, and error handling.

The Proposed Solution: Generate automation scripts using MCP Client Generator that could:

  • Batch operations efficiently
  • Use proper pagination
  • Cache responses when appropriate
  • Provide type safety to prevent errors that trigger retries

While I don't have exact metrics yet (the tool is still in development), the potential for cost reduction is significant based on the difference between individual vs batched API operations.

Potential Use Cases

Cross-Platform Data Sync: Scripts that keep GitHub issues and Notion project pages in sync, automatically updating status changes across platforms.

Automated Reporting: Weekly reports pulling data from GitHub (commits, PRs), Jira (completed tickets), and Slack (team activity), then creating summaries in Notion.

Incident Response: When monitoring systems detect issues, automatically create Slack threads, open GitHub issues, and update status pages with proper context.

Content Pipeline: Write technical content in one platform and cross-post to Dev.to, LinkedIn, and company blogs with platform-specific formatting.

Current State & Roadmap

Actually Implemented (You can test these today)

  • ✅ CLI interface and configuration parsing
  • ✅ Interactive prompts with smart defaults
  • ✅ Basic scaffolding for client generation
  • ✅ Multiple config format support (.mcp.json, .cursor/, .vscode/)

Not Yet Working (Under Development)

  • ❌ MCP server introspection (cannot connect to servers yet)
  • ❌ OAuth authentication (no auth flow implemented)
  • ❌ Type generation from live servers (uses mocks currently)
  • ❌ Error handling and retry logic
  • ❌ Streaming support

Reality check: The core generation pipeline exists, but it doesn't actually connect to MCP servers yet. Think of it as a foundation waiting for the protocol implementation.

Prerequisites (Current)

  • MCP servers must support HTTP transport
  • Servers need proper schema exposure
  • Node.js 18+ or Bun runtime

Performance Considerations

  • Initial connection overhead (estimated ~200ms)
  • Type generation at build time (not runtime)
  • Tree-shakable output for optimal bundle size

Addressing Common Questions

"Why not just use existing SDKs?"

This is a valid point. Traditional SDKs are mature and well-tested. However, they present challenges when you need:

  • Unified patterns across multiple services
  • Consistent authentication handling
  • Type safety that stays in sync with API changes
  • Integration with AI coding assistants

MCP Client Generator aims to complement, not replace, existing SDKs. It's specifically designed for scenarios requiring unified access to multiple MCP-enabled services.

When to stick with traditional SDKs

  • Production systems requiring battle-tested reliability
  • Complex operations that need SDK-specific optimizations
  • Single service integration where you don't need cross-platform consistency
  • Teams with existing SDK expertise and established patterns

When this tool might help (once complete)

  • Prototyping multi-service integrations quickly
  • AI-assisted development where consistent patterns reduce token usage
  • Small teams managing many integrations without dedicated expertise per SDK
  • Exploratory projects testing MCP capabilities

"What's the learning curve?"

Fair question. While MCP itself is new, the generated clients use familiar JavaScript/TypeScript patterns. If you can use an SDK, you can use the generated clients. The main learning curve is understanding MCP configuration, which we're working to simplify with better documentation and examples.

"What about existing integration platforms?"

Tools like Zapier, n8n, and Make excel at no-code workflows. MCP Client Generator targets a different need:

  • Type safety in your code
  • Custom business logic
  • Direct API access without middleware
  • Integration with your existing codebase
  • Cost-effective high-volume operations

"Is dynamic client registration secure?"

RFC 7591 Dynamic Client Registration is an OAuth 2.1 standard with both benefits and risks:

Security benefits:

  • Clients register with limited scopes
  • Short-lived, refreshable tokens
  • No hardcoded secrets in code
  • Unique registration per application

Security considerations:

  • Token storage: Generated clients store tokens locally - secure your development environment
  • Scope creep: Dynamic registration might request broader permissions than needed
  • Audit trails: Harder to track dynamically created clients in your OAuth provider
  • Organizational policies: Many enterprises prohibit dynamic registration

Best practice: Use dynamic registration for development/prototyping. For production, consider traditional OAuth apps with proper secret management (environment variables, secret stores, etc.).

Always review security implications for your specific use case and comply with your organization's security policies.

"What if MCP doesn't achieve widespread adoption?"

A legitimate concern. MCP is emerging technology currently supported by:

  • Claude Desktop - Anthropic's desktop app with MCP support
  • Cline (formerly Claude Dev) - VS Code extension using MCP
  • Continue.dev - Open-source AI code assistant
  • Official MCP servers - GitHub repo includes filesystem, GitHub, GitLab, Slack, and Google Drive implementations

The ecosystem is small but growing. Even if adoption remains limited, the code generation patterns have value beyond MCP. The project could adapt to other protocols if needed.

"How do you handle API changes and maintenance?"

The maintenance challenge is real. Here's the proposed approach:

  • Regeneration workflow: Run mcp-client-gen again to update types when APIs change
  • Version pinning: Lock to specific MCP server versions in your config
  • Git diff review: Generated code changes are reviewable like any dependency update
  • Fallback strategy: Keep previous generated versions if servers break compatibility

Reality check: This adds a build step and requires you to manage regeneration. It's a tradeoff between automation and control.

Why I'm Sharing This Prototype Now

AI-assisted development is changing how we build integrations, but the tooling hasn't caught up. I'm sharing this early prototype to:

  1. Validate the problem: Do others face similar multi-service integration challenges?
  2. Gather feedback: What would make this actually useful?
  3. Find collaborators: Who wants to help build this?

This isn't a launch – it's an invitation to experiment together.

What's Next

Immediate priorities:

  • Complete MCP protocol implementation
  • Robust server introspection
  • Comprehensive error handling
  • Streaming support for real-time APIs
  • Plugin system for custom transformations

But I'm most interested in community input on priorities.

How You Can Help

For Developers

  • Test the proof of concept: Try npx mcp-client-gen and share feedback
  • Contribute to development:
    • MCP server introspection
    • Authentication flows
    • Error handling patterns
    • Test coverage

For Potential Users

  • Share your use cases: What MCP servers do you need?
  • Provide feedback: What would make this useful for your workflow?
  • Help with documentation: Explain concepts to newcomers

For MCP Server Implementers

  • Feedback on approach: What patterns work best?
  • Schema standards: How should servers expose capabilities?

Get Started

# Try the interactive mode
npx mcp-client-gen

# Or quick mode with defaults
npx mcp-client-gen -y
Enter fullscreen mode Exit fullscreen mode

The Vision

I believe we're at an inflection point in API integration, especially with AI-assisted development. While traditional SDKs remain valuable, there's room for new approaches that better serve modern development workflows.

The future I'm building toward:

  • Configuration-driven service connections
  • Type safety as a default
  • Abstracted authentication complexity
  • Efficient clients for both AI and human developers

This is an early-stage project with ambitious goals. If you're interested in shaping how developers interact with MCP services, I'd love your input and collaboration.


The MCP Client Generator is MIT licensed and available on GitHub. If this project helps you build amazing integrations, consider sponsoring the development to support continued progress.

Top comments (0)