create-mcp-use-app 2.0.8 → 2.0.9
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 +73 -55
- package/dist/index.js +1 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,6 +39,7 @@ Create a new MCP application in seconds:
|
|
|
39
39
|
```bash
|
|
40
40
|
npx create-mcp-use-app my-mcp-server
|
|
41
41
|
cd my-mcp-server
|
|
42
|
+
npm run dev
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
That's it! Your MCP server is running at `http://localhost:3000` with the inspector automatically opened in your browser.
|
|
@@ -59,7 +60,7 @@ my-mcp-server/
|
|
|
59
60
|
├── mcp-env.d.ts # Managed view typing bridge
|
|
60
61
|
├── public/ # Static assets
|
|
61
62
|
└── views/ # Included by the mcp-apps template
|
|
62
|
-
└──
|
|
63
|
+
└── my-view/
|
|
63
64
|
└── view.tsx # React view entry point
|
|
64
65
|
```
|
|
65
66
|
|
|
@@ -109,7 +110,7 @@ npx create-mcp-use-app my-project
|
|
|
109
110
|
```bash
|
|
110
111
|
# Use a specific template
|
|
111
112
|
npx create-mcp-use-app my-project --template mcp-apps
|
|
112
|
-
npx create-mcp-use-app my-project --template mcp-
|
|
113
|
+
npx create-mcp-use-app my-project --template mcp-server
|
|
113
114
|
|
|
114
115
|
# Use a GitHub repository as a template
|
|
115
116
|
npx create-mcp-use-app my-project --template owner/repo
|
|
@@ -159,16 +160,14 @@ The mcp-apps template includes:
|
|
|
159
160
|
|
|
160
161
|
Ideal for building MCP servers that integrate with OpenAI's Apps SDK.
|
|
161
162
|
|
|
162
|
-
###
|
|
163
|
+
### Blank Template
|
|
163
164
|
|
|
164
|
-
The
|
|
165
|
+
The `blank` template includes:
|
|
165
166
|
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
- Kanban board widget demonstration
|
|
169
|
-
- Clean, focused setup for UI-first applications
|
|
167
|
+
- An `MCPServer` with no tools, resources, or prompts registered
|
|
168
|
+
- Development and production scripts
|
|
170
169
|
|
|
171
|
-
|
|
170
|
+
Ideal for starting from an empty server and adding your own tools.
|
|
172
171
|
|
|
173
172
|
### GitHub Repository Templates
|
|
174
173
|
|
|
@@ -244,7 +243,7 @@ This will:
|
|
|
244
243
|
npm run build
|
|
245
244
|
```
|
|
246
245
|
|
|
247
|
-
Creates an optimized build in the
|
|
246
|
+
Creates an optimized build in the `.mcp-use/build/` directory.
|
|
248
247
|
|
|
249
248
|
### Start Production Server
|
|
250
249
|
|
|
@@ -364,22 +363,11 @@ const result = await agent.run("Use my MCP tools");
|
|
|
364
363
|
|
|
365
364
|
### Environment Variables
|
|
366
365
|
|
|
367
|
-
|
|
366
|
+
`mcp-use dev` and `mcp-use start` load a `.env` file from the project root if one exists. The server listens on `PORT` (default `3000`) and binds to `HOST` (default `127.0.0.1`):
|
|
368
367
|
|
|
369
368
|
```bash
|
|
370
|
-
# Server Configuration
|
|
371
369
|
PORT=3000
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
# Observability (optional)
|
|
375
|
-
LANGFUSE_PUBLIC_KEY=your_public_key
|
|
376
|
-
LANGFUSE_SECRET_KEY=your_secret_key
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
Copy to `.env` and configure as needed:
|
|
380
|
-
|
|
381
|
-
```bash
|
|
382
|
-
cp .env.example .env
|
|
370
|
+
HOST=127.0.0.1
|
|
383
371
|
```
|
|
384
372
|
|
|
385
373
|
### TypeScript Configuration
|
|
@@ -389,13 +377,18 @@ The `tsconfig.json` is pre-configured for MCP development:
|
|
|
389
377
|
```json
|
|
390
378
|
{
|
|
391
379
|
"compilerOptions": {
|
|
392
|
-
"target": "
|
|
393
|
-
"module": "ESNext",
|
|
380
|
+
"target": "ES2024",
|
|
394
381
|
"jsx": "react-jsx",
|
|
382
|
+
"module": "NodeNext",
|
|
383
|
+
"moduleResolution": "NodeNext",
|
|
384
|
+
"lib": ["ES2024", "DOM", "DOM.Iterable"],
|
|
385
|
+
"types": ["node"],
|
|
395
386
|
"strict": true,
|
|
396
387
|
"esModuleInterop": true,
|
|
388
|
+
"forceConsistentCasingInFileNames": true,
|
|
397
389
|
"skipLibCheck": true,
|
|
398
|
-
"
|
|
390
|
+
"noEmit": true,
|
|
391
|
+
"noUncheckedSideEffectImports": true
|
|
399
392
|
}
|
|
400
393
|
}
|
|
401
394
|
```
|
|
@@ -407,49 +400,74 @@ The `tsconfig.json` is pre-configured for MCP development:
|
|
|
407
400
|
### Creating a Tool
|
|
408
401
|
|
|
409
402
|
```typescript
|
|
410
|
-
server.tool(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
403
|
+
server.tool(
|
|
404
|
+
{
|
|
405
|
+
name: "search_database",
|
|
406
|
+
description: "Search for records in the database",
|
|
407
|
+
inputSchema: z.object({
|
|
408
|
+
query: z.string().describe("Search query"),
|
|
409
|
+
limit: z.number().optional().default(10),
|
|
410
|
+
}),
|
|
411
|
+
},
|
|
412
|
+
async ({ query, limit }) => {
|
|
417
413
|
// Your tool logic here
|
|
418
414
|
const results = await db.search(query, limit);
|
|
419
|
-
return {
|
|
420
|
-
|
|
421
|
-
}
|
|
415
|
+
return {
|
|
416
|
+
content: [{ type: "text", text: JSON.stringify(results) }],
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
);
|
|
422
420
|
```
|
|
423
421
|
|
|
424
422
|
### Creating a Resource
|
|
425
423
|
|
|
426
424
|
```typescript
|
|
427
|
-
server.resource(
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
return JSON.stringify(profile);
|
|
425
|
+
server.resource(
|
|
426
|
+
{
|
|
427
|
+
name: "user_profile",
|
|
428
|
+
uri: "user://profile",
|
|
429
|
+
description: "Current user profile data",
|
|
430
|
+
mimeType: "application/json",
|
|
434
431
|
},
|
|
435
|
-
|
|
432
|
+
async (uri) => {
|
|
433
|
+
const profile = await getUserProfile();
|
|
434
|
+
return {
|
|
435
|
+
contents: [
|
|
436
|
+
{
|
|
437
|
+
uri: uri.href,
|
|
438
|
+
mimeType: "application/json",
|
|
439
|
+
text: JSON.stringify(profile),
|
|
440
|
+
},
|
|
441
|
+
],
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
);
|
|
436
445
|
```
|
|
437
446
|
|
|
438
447
|
### Creating a Prompt
|
|
439
448
|
|
|
440
449
|
```typescript
|
|
441
|
-
server.prompt(
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
language || ""
|
|
450
|
-
} code for best practices:\n\n${code}`;
|
|
450
|
+
server.prompt(
|
|
451
|
+
{
|
|
452
|
+
name: "code_review",
|
|
453
|
+
description: "Review code for best practices",
|
|
454
|
+
schema: z.object({
|
|
455
|
+
code: z.string().describe("Code to review"),
|
|
456
|
+
language: z.string().optional().describe("Programming language"),
|
|
457
|
+
}),
|
|
451
458
|
},
|
|
452
|
-
})
|
|
459
|
+
async ({ code, language }) => ({
|
|
460
|
+
messages: [
|
|
461
|
+
{
|
|
462
|
+
role: "user",
|
|
463
|
+
content: {
|
|
464
|
+
type: "text",
|
|
465
|
+
text: `Please review this ${language ?? ""} code for best practices:\n\n${code}`,
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
],
|
|
469
|
+
})
|
|
470
|
+
);
|
|
453
471
|
```
|
|
454
472
|
|
|
455
473
|
---
|
package/dist/index.js
CHANGED
|
@@ -1833,6 +1833,7 @@ async function copyTemplate(projectPath, template, versions, isDevelopment = fal
|
|
|
1833
1833
|
}
|
|
1834
1834
|
function copyDirectoryWithProcessing(src, dest, versions, isDevelopment) {
|
|
1835
1835
|
const entries = readdirSync3(src, { withFileTypes: true });
|
|
1836
|
+
mkdirSync(dest, { recursive: true });
|
|
1836
1837
|
for (const entry of entries) {
|
|
1837
1838
|
if (entry.name === ".git") {
|
|
1838
1839
|
continue;
|
|
@@ -1841,7 +1842,6 @@ function copyDirectoryWithProcessing(src, dest, versions, isDevelopment) {
|
|
|
1841
1842
|
const destName = entry.name === "gitignore" ? ".gitignore" : entry.name;
|
|
1842
1843
|
const destPath = join3(dest, destName);
|
|
1843
1844
|
if (entry.isDirectory()) {
|
|
1844
|
-
mkdirSync(destPath, { recursive: true });
|
|
1845
1845
|
copyDirectoryWithProcessing(srcPath, destPath, versions, isDevelopment);
|
|
1846
1846
|
} else if (entry.name === "package.json" || entry.name.endsWith(".json")) {
|
|
1847
1847
|
const processedContent = processTemplateFile(
|
|
@@ -2073,9 +2073,6 @@ async function main() {
|
|
|
2073
2073
|
mcpUseVersion = defaultVersion;
|
|
2074
2074
|
}
|
|
2075
2075
|
const versions = { "mcp-use": mcpUseVersion };
|
|
2076
|
-
if (!useCurrentDir) {
|
|
2077
|
-
mkdirSync(projectPath, { recursive: true });
|
|
2078
|
-
}
|
|
2079
2076
|
console.log(cyan(`\u{1F680} Creating MCP server "${displayName}"...`));
|
|
2080
2077
|
const validatedTemplate = validateTemplateName(selectedTemplate);
|
|
2081
2078
|
await copyTemplate(projectPath, validatedTemplate, versions, options.dev);
|