mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Add marketplace endpoints (#89)
This commit is contained in:
parent
67e0f18265
commit
e129b683a8
5 changed files with 205 additions and 0 deletions
56
src/app/api/marketplace/mcps/route.ts
Normal file
56
src/app/api/marketplace/mcps/route.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import { NextResponse } from 'next/server';
|
||||
import { readFile } from 'fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
// Construct the path to the YAML file
|
||||
const filePath = path.join(
|
||||
process.cwd(),
|
||||
'src',
|
||||
'data',
|
||||
'marketplace',
|
||||
'mcps.yml',
|
||||
);
|
||||
|
||||
// Read the file content
|
||||
const content = await readFile(filePath, 'utf-8');
|
||||
|
||||
// Return the content with appropriate headers
|
||||
return new NextResponse(content, {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-yaml',
|
||||
'Access-Control-Allow-Origin': '*', // Allow CORS for extension access
|
||||
'Access-Control-Allow-Methods': 'GET',
|
||||
'Access-Control-Allow-Headers': 'Content-Type',
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error reading mcps.yml:', error);
|
||||
|
||||
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
||||
return NextResponse.json(
|
||||
{ error: 'MCPS configuration file not found' },
|
||||
{ status: 404 },
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to load MCPS configuration' },
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle OPTIONS requests for CORS preflight
|
||||
export async function OPTIONS() {
|
||||
return new NextResponse(null, {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET',
|
||||
'Access-Control-Allow-Headers': 'Content-Type',
|
||||
},
|
||||
});
|
||||
}
|
||||
56
src/app/api/marketplace/modes/route.ts
Normal file
56
src/app/api/marketplace/modes/route.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import { NextResponse } from 'next/server';
|
||||
import { readFile } from 'fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
// Construct the path to the YAML file
|
||||
const filePath = path.join(
|
||||
process.cwd(),
|
||||
'src',
|
||||
'data',
|
||||
'marketplace',
|
||||
'modes.yml',
|
||||
);
|
||||
|
||||
// Read the file content
|
||||
const content = await readFile(filePath, 'utf-8');
|
||||
|
||||
// Return the content with appropriate headers
|
||||
return new NextResponse(content, {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-yaml',
|
||||
'Access-Control-Allow-Origin': '*', // Allow CORS for extension access
|
||||
'Access-Control-Allow-Methods': 'GET',
|
||||
'Access-Control-Allow-Headers': 'Content-Type',
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error reading modes.yml:', error);
|
||||
|
||||
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
||||
return NextResponse.json(
|
||||
{ error: 'Modes configuration file not found' },
|
||||
{ status: 404 },
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to load modes configuration' },
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle OPTIONS requests for CORS preflight
|
||||
export async function OPTIONS() {
|
||||
return new NextResponse(null, {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET',
|
||||
'Access-Control-Allow-Headers': 'Content-Type',
|
||||
},
|
||||
});
|
||||
}
|
||||
41
src/data/marketplace/mcps.yml
Normal file
41
src/data/marketplace/mcps.yml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
items:
|
||||
- id: "filesystem"
|
||||
name: "File System"
|
||||
description: "Provides comprehensive filesystem operations including reading, writing, moving files, directory management, and advanced file editing with pattern matching and formatting capabilities."
|
||||
author: "modelcontextprotocol"
|
||||
url: "https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem"
|
||||
tags: ["filesystem", "file-management", "directory-operations", "file-search", "file-editing"]
|
||||
content:
|
||||
- name: "NPX (Node.js)"
|
||||
content: |
|
||||
{
|
||||
"filesystem": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@modelcontextprotocol/server-filesystem", "{{ALLOWED_DIRECTORY}}"]
|
||||
}
|
||||
}
|
||||
- name: "Docker"
|
||||
content: |
|
||||
{
|
||||
"filesystem": {
|
||||
"command": "docker",
|
||||
"args": ["run", "-v", "{{ALLOWED_DIRECTORY}}:/workspace", "mcp/filesystem:latest"]
|
||||
}
|
||||
}
|
||||
parameters:
|
||||
- name: "Allowed Directory"
|
||||
key: "ALLOWED_DIRECTORY"
|
||||
placeholder: "/Users/username/Documents"
|
||||
- id: "sequentialthinking"
|
||||
name: "Sequential Thinking"
|
||||
description: "A structured problem-solving tool that enables step-by-step analysis, thought revision, and branching logic for complex reasoning tasks."
|
||||
author: "modelcontextprotocol"
|
||||
url: "https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking"
|
||||
tags: ["problem-solving", "reasoning", "analysis", "structured-thinking", "decision-making"]
|
||||
content: |
|
||||
{
|
||||
"sequentialthinking": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
|
||||
}
|
||||
}
|
||||
51
src/data/marketplace/modes.yml
Normal file
51
src/data/marketplace/modes.yml
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
items:
|
||||
- id: python-expert
|
||||
name: Python Expert
|
||||
description: Specialized mode for Python development with best practices
|
||||
author: Roo Code
|
||||
tags: [python, development, expert]
|
||||
content: |
|
||||
slug: python-expert
|
||||
name: Python Expert
|
||||
roleDefinition: |
|
||||
You are a Python expert with deep knowledge of best practices, design patterns, and the Python ecosystem.
|
||||
Focus on writing clean, efficient, and maintainable Python code. Use type hints, follow PEP 8, and suggest
|
||||
appropriate libraries and frameworks for the task at hand.
|
||||
groups:
|
||||
- read
|
||||
- edit
|
||||
- command
|
||||
|
||||
- id: react-specialist
|
||||
name: React Specialist
|
||||
description: Expert in React development and modern frontend practices
|
||||
author: Frontend Team
|
||||
tags: [react, frontend, javascript]
|
||||
content: |
|
||||
slug: react-specialist
|
||||
name: React Specialist
|
||||
roleDefinition: |
|
||||
You are a React specialist with expertise in modern React patterns, hooks, and performance optimization.
|
||||
Focus on component-based architecture, state management, and best practices for React applications.
|
||||
Use TypeScript when appropriate and suggest modern tooling.
|
||||
groups:
|
||||
- read
|
||||
- edit
|
||||
- command
|
||||
|
||||
- id: devops-engineer
|
||||
name: DevOps Engineer
|
||||
description: Infrastructure and deployment specialist
|
||||
author: DevOps Team
|
||||
tags: [devops, infrastructure, deployment]
|
||||
content: |
|
||||
slug: devops-engineer
|
||||
name: DevOps Engineer
|
||||
roleDefinition: |
|
||||
You are a DevOps engineer with expertise in infrastructure as code, CI/CD pipelines, containerization,
|
||||
and cloud platforms. Focus on automation, scalability, and reliability. Suggest appropriate tools
|
||||
and practices for deployment and monitoring.
|
||||
groups:
|
||||
- read
|
||||
- edit
|
||||
- command
|
||||
|
|
@ -4,6 +4,7 @@ const isUnprotectedRoute = createRouteMatcher([
|
|||
'/sign-in(.*)',
|
||||
'/sign-up(.*)',
|
||||
'/extension/sign-in(.*)',
|
||||
'/api/marketplace(.*)',
|
||||
'/',
|
||||
]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue