mirror of
https://github.com/cursor/plugins.git
synced 2026-09-14 20:00:00 +08:00
5e55a3a3f1
- Add plugin specification README with complete schema documentation - Include boilerplate plugin demonstrating all components: - Rules (.mdc files with frontmatter) - Agents (specialized subagent definitions) - Skills (self-contained capabilities with SKILL.md) - Hooks (pre/post event automation) - MCP servers (external tool integrations) - Extensions directory structure Co-authored-by: Cursor <cursoragent@cursor.com>
69 lines
1.5 KiB
JavaScript
69 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Example MCP Server
|
|
*
|
|
* This is a minimal MCP server demonstrating the structure.
|
|
* Replace with your actual MCP server implementation.
|
|
*/
|
|
|
|
const { Server } = require('@modelcontextprotocol/sdk/server/index.js');
|
|
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
|
|
const server = new Server(
|
|
{
|
|
name: 'example-mcp-server',
|
|
version: '1.0.0',
|
|
},
|
|
{
|
|
capabilities: {
|
|
tools: {},
|
|
},
|
|
}
|
|
);
|
|
|
|
// Register example tool
|
|
server.setRequestHandler('tools/list', async () => {
|
|
return {
|
|
tools: [
|
|
{
|
|
name: 'example_tool',
|
|
description: 'An example tool that echoes input',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
message: {
|
|
type: 'string',
|
|
description: 'Message to echo',
|
|
},
|
|
},
|
|
required: ['message'],
|
|
},
|
|
},
|
|
],
|
|
};
|
|
});
|
|
|
|
server.setRequestHandler('tools/call', async (request) => {
|
|
if (request.params.name === 'example_tool') {
|
|
const message = request.params.arguments?.message || 'Hello, World!';
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: `Echo: ${message}`,
|
|
},
|
|
],
|
|
};
|
|
}
|
|
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
});
|
|
|
|
// Start server
|
|
async function main() {
|
|
const transport = new StdioServerTransport();
|
|
await server.connect(transport);
|
|
console.error('Example MCP server running on stdio');
|
|
}
|
|
|
|
main().catch(console.error);
|