mcp-client-gen 0.0.1 โ 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -15
- package/dist/index.js +1010 -18
- package/package.json +21 -5
package/README.md
CHANGED
|
@@ -8,17 +8,17 @@ import { notion, github, slack } from "./lib/mcp-client";
|
|
|
8
8
|
// Type-safe client calls with full IntelliSense
|
|
9
9
|
const page = await notion.createPage({
|
|
10
10
|
title: "Meeting Notes",
|
|
11
|
-
content: "Discussion about Q4 roadmap..."
|
|
11
|
+
content: "Discussion about Q4 roadmap...",
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
const issue = await github.createIssue({
|
|
15
15
|
title: "Bug: Login failure",
|
|
16
|
-
body: "Users cannot authenticate..."
|
|
16
|
+
body: "Users cannot authenticate...",
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
await slack.notify({
|
|
20
20
|
channel: "#dev",
|
|
21
|
-
message: `New issue created: ${issue.url}
|
|
21
|
+
message: `New issue created: ${issue.url}`,
|
|
22
22
|
});
|
|
23
23
|
```
|
|
24
24
|
|
|
@@ -28,7 +28,8 @@ await slack.notify({
|
|
|
28
28
|
๐ **Multi-Provider** - Connect to multiple MCP servers simultaneously
|
|
29
29
|
๐ฏ **Tree-Shakable** - Only bundle the methods you use
|
|
30
30
|
โก **Fast** - Built with Bun for optimal performance
|
|
31
|
-
๐ ๏ธ **CLI
|
|
31
|
+
๐ ๏ธ **Interactive CLI** - Smart prompts with sensible defaults
|
|
32
|
+
โ๏ธ **Flexible** - Works with multiple MCP config formats
|
|
32
33
|
|
|
33
34
|
## Installation
|
|
34
35
|
|
|
@@ -49,18 +50,27 @@ Create a `.mcp.json` file with your MCP server endpoints:
|
|
|
49
50
|
"mcpServers": {
|
|
50
51
|
"notion": {
|
|
51
52
|
"type": "http",
|
|
52
|
-
"url": "https://mcp.notion.com/mcp"
|
|
53
|
+
"url": "https://mcp.notion.com/mcp",
|
|
53
54
|
},
|
|
54
55
|
"github": {
|
|
55
|
-
"type": "http",
|
|
56
|
-
"url": "https://api.githubcopilot.com/mcp/"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
56
|
+
"type": "http",
|
|
57
|
+
"url": "https://api.githubcopilot.com/mcp/",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
59
60
|
}
|
|
60
61
|
```
|
|
61
62
|
|
|
62
63
|
### 2. Generate Client SDK
|
|
63
64
|
|
|
65
|
+
**Interactive Mode (Recommended):**
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx mcp-client-gen # Launch interactive prompts
|
|
69
|
+
npx mcp-client-gen -y # Accept all defaults and proceed
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Direct Mode:**
|
|
73
|
+
|
|
64
74
|
```bash
|
|
65
75
|
npx mcp-client-gen ./lib/mcp-client.ts
|
|
66
76
|
```
|
|
@@ -74,11 +84,21 @@ import { notion } from "./lib/mcp-client";
|
|
|
74
84
|
const page = await notion.fetchPage("page-id");
|
|
75
85
|
const newPage = await notion.createPage({
|
|
76
86
|
title: "My Page",
|
|
77
|
-
content: "Page content..."
|
|
87
|
+
content: "Page content...",
|
|
78
88
|
});
|
|
79
89
|
```
|
|
80
90
|
|
|
81
|
-
## CLI
|
|
91
|
+
## CLI Reference
|
|
92
|
+
|
|
93
|
+
### Interactive Mode
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npx mcp-client-gen # Launch interactive prompts
|
|
97
|
+
npx mcp-client-gen -y # Accept defaults and proceed
|
|
98
|
+
npx mcp-client-gen --yes # Same as -y
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Direct Mode
|
|
82
102
|
|
|
83
103
|
```bash
|
|
84
104
|
npx mcp-client-gen [options] <output-file>
|
|
@@ -87,11 +107,14 @@ Arguments:
|
|
|
87
107
|
output-file Path for the generated client file
|
|
88
108
|
|
|
89
109
|
Options:
|
|
90
|
-
--config <file> MCP configuration file (default:
|
|
110
|
+
--config <file> MCP configuration file (default: auto-discover)
|
|
111
|
+
-y, --yes Accept all defaults and skip prompts
|
|
91
112
|
--help Show help information
|
|
92
113
|
|
|
93
114
|
Examples:
|
|
94
|
-
npx mcp-client-gen
|
|
115
|
+
npx mcp-client-gen # Interactive mode
|
|
116
|
+
npx mcp-client-gen -y # Quick generation with defaults
|
|
117
|
+
npx mcp-client-gen ./lib/mcp.ts # Direct mode with output file
|
|
95
118
|
npx mcp-client-gen --config custom.json ./src/clients.ts
|
|
96
119
|
```
|
|
97
120
|
|
|
@@ -100,21 +123,75 @@ Examples:
|
|
|
100
123
|
๐ **API Integration** - Connect to multiple services with one SDK
|
|
101
124
|
๐ค **Workflow Automation** - Build cross-platform automation scripts
|
|
102
125
|
๐ **Data Synchronization** - Keep data in sync across different platforms
|
|
103
|
-
๐งช **Rapid Prototyping** - Quickly test integrations with type safety
|
|
126
|
+
๐งช **Rapid Prototyping** - Quickly test integrations with type safety
|
|
104
127
|
|
|
105
128
|
## Development Status
|
|
106
129
|
|
|
107
130
|
> **Preview Release** - This is an early preview. The core CLI and configuration parsing works, but MCP server introspection is still in development.
|
|
108
131
|
|
|
109
132
|
**Current Status:**
|
|
133
|
+
|
|
110
134
|
- โ
CLI interface and configuration parsing
|
|
111
|
-
- โ
|
|
135
|
+
- โ
Interactive prompts with smart defaults
|
|
136
|
+
- โ
Multi-server client generation structure
|
|
137
|
+
- โ
Multiple MCP config format support (.mcp.json, .cursor/, .vscode/)
|
|
112
138
|
- ๐ง MCP server schema introspection (in progress)
|
|
113
139
|
- ๐ง Real-time type generation from server capabilities
|
|
114
140
|
- ๐ Plugin system for custom transformations
|
|
115
141
|
|
|
116
142
|
**Coming Soon:**
|
|
143
|
+
|
|
117
144
|
- Full MCP protocol implementation
|
|
118
145
|
- Authentication handling
|
|
119
146
|
- Streaming support
|
|
120
147
|
- Error handling and retries
|
|
148
|
+
|
|
149
|
+
## Authentication
|
|
150
|
+
|
|
151
|
+
Generated MCP clients include built-in support for OAuth 2.1 authentication using RFC 7591 Dynamic Client Registration. The authentication flow is handled automatically:
|
|
152
|
+
|
|
153
|
+
### OAuth 2.1 Support
|
|
154
|
+
|
|
155
|
+
- **Dynamic Client Registration (RFC 7591)** - Clients automatically register with OAuth providers
|
|
156
|
+
- **PKCE Flow (RFC 7636)** - Secure authorization code exchange with Proof Key for Code Exchange
|
|
157
|
+
- **Multiple Auth Methods** - Supports `client_secret_basic`, `client_secret_post`, and public clients
|
|
158
|
+
- **Token Management** - Automatic token refresh and credential storage
|
|
159
|
+
- **Resource Protection** - RFC 9728 OAuth 2.0 Protected Resource Metadata support
|
|
160
|
+
|
|
161
|
+
### Authentication Flow
|
|
162
|
+
|
|
163
|
+
1. **Discovery** - Client discovers OAuth authorization server metadata
|
|
164
|
+
2. **Registration** - Dynamic client registration if credentials not found
|
|
165
|
+
3. **Authorization** - PKCE-based authorization code flow initiation
|
|
166
|
+
4. **Token Exchange** - Secure token exchange with automatic refresh
|
|
167
|
+
5. **API Calls** - Authenticated requests using Bearer tokens
|
|
168
|
+
|
|
169
|
+
### Configuration
|
|
170
|
+
|
|
171
|
+
Authentication is configured per MCP server in your `.mcp.json`:
|
|
172
|
+
|
|
173
|
+
```jsonc
|
|
174
|
+
{
|
|
175
|
+
"mcpServers": {
|
|
176
|
+
"secured-service": {
|
|
177
|
+
"type": "http",
|
|
178
|
+
"url": "https://api.example.com/mcp",
|
|
179
|
+
"auth": {
|
|
180
|
+
"type": "oauth",
|
|
181
|
+
"clientId": "your-client-id", // Optional for dynamic registration
|
|
182
|
+
"scopes": ["read", "write"]
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Support & License
|
|
190
|
+
|
|
191
|
+
If this tool helps you build amazing integrations, consider [sponsoring the project](https://github.com/sponsors/koistya) to support continued development. ๐
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
**MIT Licensed** โข Feel free to use this in your commercial projects, contribute back, or fork it entirely. Code should be free! ๐
|
|
196
|
+
|
|
197
|
+
Built with โค๏ธ by [Konstantin Tarkus](https://github.com/koistya) and [contributors](https://github.com/kriasoft/mcp-client-gen/graphs/contributors).
|