https://github.com/kriasoft/mcp-client-gen
Turn any MCP server into a type-safe TypeScript SDK in seconds - with OAuth 2.1 and multi-provider support
https://github.com/kriasoft/mcp-client-gen
ai ai-agent anthropic bun claude code-generation cursor llm llms mcp mcp-client mcp-sdk mcp-server mcp-tools model-context-protocol oauth2 openai typescript zed
Last synced: 5 months ago
JSON representation
Turn any MCP server into a type-safe TypeScript SDK in seconds - with OAuth 2.1 and multi-provider support
- Host: GitHub
- URL: https://github.com/kriasoft/mcp-client-gen
- Owner: kriasoft
- License: mit
- Created: 2025-08-13T14:04:21.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-16T23:21:56.000Z (10 months ago)
- Last Synced: 2025-08-16T23:27:26.108Z (10 months ago)
- Topics: ai, ai-agent, anthropic, bun, claude, code-generation, cursor, llm, llms, mcp, mcp-client, mcp-sdk, mcp-server, mcp-tools, model-context-protocol, oauth2, openai, typescript, zed
- Language: TypeScript
- Homepage: https://medium.com/@koistya/why-i-built-mcp-client-generator-and-why-you-should-care-c860193ca902
- Size: 42 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# MCP Client Generator
[](https://www.npmjs.com/package/mcp-client-gen)
[](https://www.npmjs.com/package/mcp-client-gen)
[](https://discord.gg/bSsv7XM)
[](LICENSE)
Generate type-safe TypeScript clients from [MCP](https://modelcontextprotocol.io) servers.
## Quick Start
```bash
# Generate client from URL
npx mcp-client-gen https://mcp.notion.com/mcp -o notion.ts
# Use the generated client
```
```typescript
import { createNotionClient } from "./notion";
import { createMcpConnection } from "mcp-client-gen";
const connection = await createMcpConnection({
url: "https://mcp.notion.com/mcp",
});
const notion = createNotionClient(connection);
// Fully typed based on server schema
const pages = await notion.notionSearch({ query: "Meeting Notes" });
```
## Features
- **Type-safe** — Generated TypeScript types from server schemas
- **Zero config auth** — OAuth 2.1 with PKCE, just approve in browser
- **Tree-shakable** — Only bundle the methods you import
## Installation
```bash
npm install -g mcp-client-gen
# or
bun add -g mcp-client-gen
```
## CLI Usage
```bash
# URL mode (primary)
npx mcp-client-gen # Output to stdout
npx mcp-client-gen -o # Output to file
npx mcp-client-gen # Shorthand
# Config mode (reads .mcp.json, .cursor/, .vscode/)
npx mcp-client-gen # Interactive
npx mcp-client-gen -y # Accept defaults
```
### Config File Format
```jsonc
// .mcp.json
{
"mcpServers": {
"notion": { "url": "https://mcp.notion.com/mcp" },
"github": { "url": "https://api.githubcopilot.com/mcp/" },
},
}
```
## Authentication
No credentials required. OAuth-protected servers trigger automatic browser authentication via Dynamic Client Registration (RFC 7591) and PKCE.
## License
MIT — [Konstantin Tarkus](https://github.com/koistya)