Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit15242a3

Browse files
committed
Add component creation and retrieval scripts
1 parente239945 commit15242a3

File tree

5 files changed

+174
-0
lines changed

5 files changed

+174
-0
lines changed

‎README-COMPONENT-TOOL.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#Component Tool Documentation
2+
3+
This document provides information about the component creation and management tools in the shadcn-ui MCP server.
4+
5+
##Available Tools
6+
7+
1.**create-component.ts** - Creates new UI components
8+
2.**get-component.ts** - Retrieves existing components
9+
3.**push-component.ts** - Pushes components to GitHub repositories
10+
4.**preview-component.ts** - Generates live previews of components
11+
12+
##Usage
13+
14+
Each tool can be accessed through the MCP server interface and provides specific functionality for managing shadcn-ui components.

‎create-menubar.js‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Menubar Component Creation Script
2+
const{ createServer}=require('./build/server');
3+
4+
asyncfunctioncreateMenubar(){
5+
console.log('Creating menubar component...');
6+
7+
// Initialize the MCP server
8+
constserver=createServer();
9+
10+
try{
11+
// Use the create_component tool
12+
constresult=awaitserver.callTool('create_component',{
13+
componentName:'menubar',
14+
componentType:'ui',
15+
description:'A responsive menubar component with dropdown menus'
16+
});
17+
18+
console.log('Menubar component created successfully!');
19+
console.log('Component details:',result);
20+
21+
returnresult;
22+
}catch(error){
23+
console.error('Error creating menubar component:',error);
24+
returnnull;
25+
}
26+
}
27+
28+
// Run the function if this script is executed directly
29+
if(require.main===module){
30+
createMenubar().then(result=>{
31+
if(result){
32+
console.log('✅ Menubar creation completed!');
33+
}else{
34+
console.log('❌ Menubar creation failed!');
35+
process.exit(1);
36+
}
37+
});
38+
}
39+
40+
module.exports={ createMenubar};

‎get-any-component.js‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Generic Component Retrieval Script
2+
const{ createServer}=require('./build/server');
3+
4+
asyncfunctiongetComponent(componentName){
5+
console.log(`Retrieving component:${componentName}`);
6+
7+
// Initialize the MCP server
8+
constserver=createServer();
9+
10+
try{
11+
// Use the get_component tool
12+
constresult=awaitserver.callTool('get_component',{
13+
name:componentName
14+
});
15+
16+
console.log(`${componentName} component retrieved successfully!`);
17+
console.log('Component details:',result);
18+
19+
returnresult;
20+
}catch(error){
21+
console.error(`Error retrieving${componentName} component:`,error);
22+
returnnull;
23+
}
24+
}
25+
26+
// Run the function if this script is executed directly
27+
if(require.main===module){
28+
constcomponentName=process.argv[2];
29+
if(!componentName){
30+
console.error('Please provide a component name as an argument');
31+
process.exit(1);
32+
}
33+
34+
getComponent(componentName).then(result=>{
35+
if(result){
36+
console.log(`✅${componentName} retrieval completed!`);
37+
}else{
38+
console.log(`❌${componentName} retrieval failed!`);
39+
process.exit(1);
40+
}
41+
});
42+
}
43+
44+
module.exports={ getComponent};

‎get-menubar-demo.js‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Menubar Demo Retrieval Script
2+
const{ createServer}=require('./build/server');
3+
4+
asyncfunctiongetMenubarDemo(){
5+
console.log('Retrieving menubar demo...');
6+
7+
// Initialize the MCP server
8+
constserver=createServer();
9+
10+
try{
11+
// Use the get_component_demo tool
12+
constresult=awaitserver.callTool('get_component_demo',{
13+
componentName:'menubar'
14+
});
15+
16+
console.log('Menubar demo retrieved successfully!');
17+
console.log('Demo code:',result);
18+
19+
returnresult;
20+
}catch(error){
21+
console.error('Error retrieving menubar demo:',error);
22+
returnnull;
23+
}
24+
}
25+
26+
// Run the function if this script is executed directly
27+
if(require.main===module){
28+
getMenubarDemo().then(result=>{
29+
if(result){
30+
console.log('✅ Menubar demo retrieval completed!');
31+
}else{
32+
console.log('❌ Menubar demo retrieval failed!');
33+
process.exit(1);
34+
}
35+
});
36+
}
37+
38+
module.exports={ getMenubarDemo};

‎get-menubar.js‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Menubar Component Retrieval Script
2+
const{ createServer}=require('./build/server');
3+
4+
asyncfunctiongetMenubar(){
5+
console.log('Retrieving menubar component...');
6+
7+
// Initialize the MCP server
8+
constserver=createServer();
9+
10+
try{
11+
// Use the get_component tool
12+
constresult=awaitserver.callTool('get_component',{
13+
name:'menubar'
14+
});
15+
16+
console.log('Menubar component retrieved successfully!');
17+
console.log('Component details:',result);
18+
19+
returnresult;
20+
}catch(error){
21+
console.error('Error retrieving menubar component:',error);
22+
returnnull;
23+
}
24+
}
25+
26+
// Run the function if this script is executed directly
27+
if(require.main===module){
28+
getMenubar().then(result=>{
29+
if(result){
30+
console.log('✅ Menubar retrieval completed!');
31+
}else{
32+
console.log('❌ Menubar retrieval failed!');
33+
process.exit(1);
34+
}
35+
});
36+
}
37+
38+
module.exports={ getMenubar};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp