leanmcp 0.3.3 → 0.3.4

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.
Files changed (3) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +211 -211
  3. package/package.json +2 -2
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 LeanMCP Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 LeanMCP Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,211 +1,211 @@
1
- <p align="center">
2
- <img
3
- src="https://raw.githubusercontent.com/LeanMCP/leanmcp-sdk/refs/heads/main/assets/logo.png"
4
- alt="LeanMCP Logo"
5
- width="400"
6
- />
7
- </p>
8
-
9
- <p align="center">
10
- <strong>leanmcp</strong><br/>
11
- TypeScript SDK for building Model Context Protocol (MCP) servers.
12
- </p>
13
-
14
- <p align="center">
15
- <a href="https://www.npmjs.com/package/leanmcp">
16
- <img src="https://img.shields.io/npm/v/leanmcp" alt="npm version" />
17
- </a>
18
- <a href="https://www.npmjs.com/package/leanmcp">
19
- <img src="https://img.shields.io/npm/dm/leanmcp" alt="npm downloads" />
20
- </a>
21
- <a href="https://docs.leanmcp.com">
22
- <img src="https://img.shields.io/badge/Docs-leanmcp-0A66C2?" />
23
- </a>
24
- <a href="https://discord.com/invite/DsRcA3GwPy">
25
- <img src="https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white" />
26
- </a>
27
- <a href="https://x.com/LeanMcp">
28
- <img src="https://img.shields.io/badge/@LeanMCP-f5f5f5?logo=x&logoColor=000000" />
29
- </a>
30
- </p>
31
-
32
- ## Installation
33
-
34
- ```bash
35
- npm install leanmcp
36
- ```
37
-
38
- This meta-package includes all LeanMCP packages:
39
- - `@leanmcp/core` — Core decorators (`@Tool`, `@Prompt`, `@Resource`) and HTTP server
40
- - `@leanmcp/auth` — Authentication with Cognito, Clerk, Auth0, LeanMCP providers
41
- - `@leanmcp/ui` — MCP-native React components, hooks, and `@UIApp`/`@GPTApp` decorators
42
- - `@leanmcp/utils` — Utility functions (retry, formatting, async helpers)
43
- - `@leanmcp/elicitation` — Structured user input collection with `@Elicitation`
44
- - `@leanmcp/env-injection` — Request-scoped environment variables with `@RequireEnv`
45
-
46
- ## Quick Start
47
-
48
- ### 1. Create a new project
49
-
50
- ```bash
51
- npx @leanmcp/cli create my-mcp-server
52
- cd my-mcp-server
53
- npm install
54
- ```
55
-
56
- ### 2. Define your service
57
-
58
- ```typescript
59
- import { Tool, SchemaConstraint } from 'leanmcp';
60
-
61
- class GreetInput {
62
- @SchemaConstraint({
63
- description: 'Name to greet',
64
- minLength: 1
65
- })
66
- name!: string;
67
- }
68
-
69
- export class GreetingService {
70
- @Tool({
71
- description: 'Greet someone',
72
- inputClass: GreetInput
73
- })
74
- async greet(args: GreetInput) {
75
- return { message: `Hello, ${args.name}!` };
76
- }
77
- }
78
- ```
79
-
80
- ### 3. Run your server
81
-
82
- ```bash
83
- npm start
84
- ```
85
-
86
- Your MCP server starts on `http://localhost:8080` with:
87
- - HTTP endpoint: `http://localhost:8080/mcp`
88
- - Health check: `http://localhost:8080/health`
89
-
90
- ## Features
91
-
92
- - **Type-safe decorators** - Full TypeScript support with compile-time validation
93
- - **Declarative schema definition** - Define JSON Schema using `@SchemaConstraint` decorators
94
- - **Clean API** - Function names become tool/prompt/resource names automatically
95
- - **MCP compliant** - Built on official @modelcontextprotocol/sdk
96
- - **Streamable HTTP** - Production-ready HTTP server with session management
97
- - **Authentication** - Built-in `@Authenticated` decorator with multi-provider support
98
- - **Interactive CLI** - Guided project setup with dependency installation
99
- - **React UI Components** - Build interactive MCP apps with pre-built components
100
- - **Built-in validation** - Automatic input validation using defined schemas
101
-
102
- ## Usage Examples
103
-
104
- ### Core Server
105
-
106
- ```typescript
107
- import { createHTTPServer, Tool } from 'leanmcp';
108
-
109
- // Services are automatically discovered from ./mcp directory
110
- await createHTTPServer({
111
- name: "my-mcp-server",
112
- version: "1.0.0",
113
- port: 8080,
114
- cors: true,
115
- logging: true
116
- });
117
- ```
118
-
119
- ### Authentication
120
-
121
- ```typescript
122
- import { Tool, AuthProvider, Authenticated } from 'leanmcp';
123
-
124
- const authProvider = new AuthProvider('cognito', {
125
- region: process.env.AWS_REGION,
126
- userPoolId: process.env.COGNITO_USER_POOL_ID,
127
- clientId: process.env.COGNITO_CLIENT_ID
128
- });
129
- await authProvider.init();
130
-
131
- @Authenticated(authProvider)
132
- export class SecureService {
133
- @Tool({ description: 'Protected endpoint' })
134
- async protectedMethod(args: any) {
135
- return { success: true };
136
- }
137
- }
138
- ```
139
-
140
- ### React UI Components
141
-
142
- ```typescript
143
- import { AppProvider, AppShell, HTTPTransport } from 'leanmcp/ui';
144
- import 'leanmcp/ui/styles.css';
145
-
146
- function App() {
147
- const transport = new HTTPTransport('http://localhost:8080/mcp');
148
-
149
- return (
150
- <AppProvider transport={transport}>
151
- <AppShell />
152
- </AppProvider>
153
- );
154
- }
155
- ```
156
-
157
- ## Package Exports
158
-
159
- ### Main Export
160
-
161
- ```typescript
162
- import { createHTTPServer, Tool, Prompt, Resource } from 'leanmcp';
163
- ```
164
-
165
- ### UI Components
166
-
167
- ```typescript
168
- import { AppProvider, AppShell } from 'leanmcp/ui';
169
- import 'leanmcp/ui/styles.css';
170
- ```
171
-
172
- ### Individual Packages
173
-
174
- You can also install individual packages if you only need specific functionality:
175
-
176
- ```bash
177
- npm install @leanmcp/core # Core decorators and server
178
- npm install @leanmcp/auth # Authentication
179
- npm install @leanmcp/ui # React UI components
180
- npm install @leanmcp/cli # CLI tools
181
- ```
182
-
183
- ## Documentation
184
-
185
- For complete documentation, examples, and API reference, visit:
186
- - [GitHub Repository](https://github.com/LeanMCP/leanmcp-sdk)
187
- - [Full Documentation](https://github.com/LeanMCP/leanmcp-sdk#readme)
188
-
189
- ## CLI Commands
190
-
191
- ### Create a new project
192
-
193
- ```bash
194
- npx @leanmcp/cli create my-mcp-server
195
- ```
196
-
197
- ### Add a service to existing project
198
-
199
- ```bash
200
- npx @leanmcp/cli add weather
201
- ```
202
-
203
- ## License
204
-
205
- MIT
206
-
207
- ## Links
208
-
209
- - [MCP Specification](https://modelcontextprotocol.io/)
210
- - [GitHub Repository](https://github.com/LeanMCP/leanmcp-sdk)
211
- - [Issues](https://github.com/LeanMCP/leanmcp-sdk/issues)
1
+ <p align="center">
2
+ <img
3
+ src="https://raw.githubusercontent.com/LeanMCP/leanmcp-sdk/refs/heads/main/assets/logo.png"
4
+ alt="LeanMCP Logo"
5
+ width="400"
6
+ />
7
+ </p>
8
+
9
+ <p align="center">
10
+ <strong>leanmcp</strong><br/>
11
+ TypeScript SDK for building Model Context Protocol (MCP) servers.
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://www.npmjs.com/package/leanmcp">
16
+ <img src="https://img.shields.io/npm/v/leanmcp" alt="npm version" />
17
+ </a>
18
+ <a href="https://www.npmjs.com/package/leanmcp">
19
+ <img src="https://img.shields.io/npm/dm/leanmcp" alt="npm downloads" />
20
+ </a>
21
+ <a href="https://docs.leanmcp.com">
22
+ <img src="https://img.shields.io/badge/Docs-leanmcp-0A66C2?" />
23
+ </a>
24
+ <a href="https://discord.com/invite/DsRcA3GwPy">
25
+ <img src="https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white" />
26
+ </a>
27
+ <a href="https://x.com/LeanMcp">
28
+ <img src="https://img.shields.io/badge/@LeanMCP-f5f5f5?logo=x&logoColor=000000" />
29
+ </a>
30
+ </p>
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ npm install leanmcp
36
+ ```
37
+
38
+ This meta-package includes all LeanMCP packages:
39
+ - `@leanmcp/core` — Core decorators (`@Tool`, `@Prompt`, `@Resource`) and HTTP server
40
+ - `@leanmcp/auth` — Authentication with Cognito, Clerk, Auth0, LeanMCP providers
41
+ - `@leanmcp/ui` — MCP-native React components, hooks, and `@UIApp`/`@GPTApp` decorators
42
+ - `@leanmcp/utils` — Utility functions (retry, formatting, async helpers)
43
+ - `@leanmcp/elicitation` — Structured user input collection with `@Elicitation`
44
+ - `@leanmcp/env-injection` — Request-scoped environment variables with `@RequireEnv`
45
+
46
+ ## Quick Start
47
+
48
+ ### 1. Create a new project
49
+
50
+ ```bash
51
+ npx @leanmcp/cli create my-mcp-server
52
+ cd my-mcp-server
53
+ npm install
54
+ ```
55
+
56
+ ### 2. Define your service
57
+
58
+ ```typescript
59
+ import { Tool, SchemaConstraint } from 'leanmcp';
60
+
61
+ class GreetInput {
62
+ @SchemaConstraint({
63
+ description: 'Name to greet',
64
+ minLength: 1
65
+ })
66
+ name!: string;
67
+ }
68
+
69
+ export class GreetingService {
70
+ @Tool({
71
+ description: 'Greet someone',
72
+ inputClass: GreetInput
73
+ })
74
+ async greet(args: GreetInput) {
75
+ return { message: `Hello, ${args.name}!` };
76
+ }
77
+ }
78
+ ```
79
+
80
+ ### 3. Run your server
81
+
82
+ ```bash
83
+ npm start
84
+ ```
85
+
86
+ Your MCP server starts on `http://localhost:8080` with:
87
+ - HTTP endpoint: `http://localhost:8080/mcp`
88
+ - Health check: `http://localhost:8080/health`
89
+
90
+ ## Features
91
+
92
+ - **Type-safe decorators** - Full TypeScript support with compile-time validation
93
+ - **Declarative schema definition** - Define JSON Schema using `@SchemaConstraint` decorators
94
+ - **Clean API** - Function names become tool/prompt/resource names automatically
95
+ - **MCP compliant** - Built on official @modelcontextprotocol/sdk
96
+ - **Streamable HTTP** - Production-ready HTTP server with session management
97
+ - **Authentication** - Built-in `@Authenticated` decorator with multi-provider support
98
+ - **Interactive CLI** - Guided project setup with dependency installation
99
+ - **React UI Components** - Build interactive MCP apps with pre-built components
100
+ - **Built-in validation** - Automatic input validation using defined schemas
101
+
102
+ ## Usage Examples
103
+
104
+ ### Core Server
105
+
106
+ ```typescript
107
+ import { createHTTPServer, Tool } from 'leanmcp';
108
+
109
+ // Services are automatically discovered from ./mcp directory
110
+ await createHTTPServer({
111
+ name: "my-mcp-server",
112
+ version: "1.0.0",
113
+ port: 8080,
114
+ cors: true,
115
+ logging: true
116
+ });
117
+ ```
118
+
119
+ ### Authentication
120
+
121
+ ```typescript
122
+ import { Tool, AuthProvider, Authenticated } from 'leanmcp';
123
+
124
+ const authProvider = new AuthProvider('cognito', {
125
+ region: process.env.AWS_REGION,
126
+ userPoolId: process.env.COGNITO_USER_POOL_ID,
127
+ clientId: process.env.COGNITO_CLIENT_ID
128
+ });
129
+ await authProvider.init();
130
+
131
+ @Authenticated(authProvider)
132
+ export class SecureService {
133
+ @Tool({ description: 'Protected endpoint' })
134
+ async protectedMethod(args: any) {
135
+ return { success: true };
136
+ }
137
+ }
138
+ ```
139
+
140
+ ### React UI Components
141
+
142
+ ```typescript
143
+ import { AppProvider, AppShell, HTTPTransport } from 'leanmcp/ui';
144
+ import 'leanmcp/ui/styles.css';
145
+
146
+ function App() {
147
+ const transport = new HTTPTransport('http://localhost:8080/mcp');
148
+
149
+ return (
150
+ <AppProvider transport={transport}>
151
+ <AppShell />
152
+ </AppProvider>
153
+ );
154
+ }
155
+ ```
156
+
157
+ ## Package Exports
158
+
159
+ ### Main Export
160
+
161
+ ```typescript
162
+ import { createHTTPServer, Tool, Prompt, Resource } from 'leanmcp';
163
+ ```
164
+
165
+ ### UI Components
166
+
167
+ ```typescript
168
+ import { AppProvider, AppShell } from 'leanmcp/ui';
169
+ import 'leanmcp/ui/styles.css';
170
+ ```
171
+
172
+ ### Individual Packages
173
+
174
+ You can also install individual packages if you only need specific functionality:
175
+
176
+ ```bash
177
+ npm install @leanmcp/core # Core decorators and server
178
+ npm install @leanmcp/auth # Authentication
179
+ npm install @leanmcp/ui # React UI components
180
+ npm install @leanmcp/cli # CLI tools
181
+ ```
182
+
183
+ ## Documentation
184
+
185
+ For complete documentation, examples, and API reference, visit:
186
+ - [GitHub Repository](https://github.com/LeanMCP/leanmcp-sdk)
187
+ - [Full Documentation](https://github.com/LeanMCP/leanmcp-sdk#readme)
188
+
189
+ ## CLI Commands
190
+
191
+ ### Create a new project
192
+
193
+ ```bash
194
+ npx @leanmcp/cli create my-mcp-server
195
+ ```
196
+
197
+ ### Add a service to existing project
198
+
199
+ ```bash
200
+ npx @leanmcp/cli add weather
201
+ ```
202
+
203
+ ## License
204
+
205
+ MIT
206
+
207
+ ## Links
208
+
209
+ - [MCP Specification](https://modelcontextprotocol.io/)
210
+ - [GitHub Repository](https://github.com/LeanMCP/leanmcp-sdk)
211
+ - [Issues](https://github.com/LeanMCP/leanmcp-sdk/issues)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leanmcp",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "LeanMCP SDK - TypeScript SDK for building Model Context Protocol (MCP) servers with type-safe decorators",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -66,4 +66,4 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  }
69
- }
69
+ }