
一个MCP服务器示例,带有可直接从光标调用的自定义工具
概览
欢迎来到您的AI驱动开发工具包,该工具包设计为Cursor的模型上下文协议(MCP)服务器!本项目通过定制AI工具提供智能编码辅助。请注意,这主要是教程演示,并非生产准备工具。 调用高级推理大型语言模型(LLM),为编码代理生成计划和指令。 截取 UI 设计截图,并用 composer 代理使用。 首先,你需要设置环境变量。创建一个文件,地址是 src/env/keys.ts: ⚠️ : 生产环境不建议直接将API密钥存储在源代码中。这仅用于本地开发和学习目的。你也可以在光标MCP接口中将env var设置为内联。 该项目设计为在Cursor中作为MCP服务器使用。以下是设置方法: 1. 打开光标 2.进入光标设置> MCP 功能> 3.点击 + 添加新 MCP 服务器 4.
概述(AI 翻译)
欢迎来到您的AI驱动开发工具包,该工具包设计为Cursor的模型上下文协议(MCP)服务器!本项目通过定制AI工具提供智能编码辅助。请注意,这主要是教程演示,并非生产准备工具。
✨ 特色
🎨 代码架构师
调用高级推理大型语言模型(LLM),为编码代理生成计划和指令。
📸 截图,伙计
截取 UI 设计截图,并用 composer 代理使用。
🔍 代码评测
用git diffs来触发代码审查。
🚀 开始
1.环境设置
首先,你需要设置环境变量。创建一个文件 src/env/keys.ts
⚠️ 安全提示:生产环境不建议直接将API密钥存储在源代码中。这仅用于本地开发和学习目的。你也可以在光标MCP界面中将env var设置为内联。
2.安装
3.构建服务器
4.添加光标
该项目设计为在Cursor中作为MCP服务器使用。以下是设置方法:
- 打开光标
- 前往
Cursor Settings > Features > MCP - 点击
+ Add New MCP Server - 填写表格:
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
🤖 AI Development Assistant MCP Server
Welcome to your AI-powered development toolkit, designed as a Model Context Protocol (MCP) server for Cursor! This project provides intelligent coding assistance through custom AI tools. Note that this is mostly a tutorial demo, and not a production-ready tool.
✨ Features
🎨 Code Architect
Call advanced reasoning LLMs to generate plans and instructions for coding agents.
📸 Screenshot Buddy
Take UI design screenshots and use them with the composer agent.
🔍 Code Review
Use git diffs to trigger code reviews.
🚀 Getting Started
1. Environment Setup
First, you’ll need to set up your environment variables. Create a file at src/env/keys.ts:
export const OPENAI_API_KEY = "your_key_here";
// Add any other keys you need
⚠️ Security Note: Storing API keys directly in source code is not recommended for production environments. This is only for local development and learning purposes. You can set the env var inline in the Cursor MCP interface as well.
2. Installation
npm install
# or
yarn install
3. Build the Server
npm run build
4. Adding to Cursor
This project is designed to be used as an MCP server in Cursor. Here’s how to set it up:
- Open Cursor
- Go to
Cursor Settings > Features > MCP - Click
+ Add New MCP Server - Fill out the form:
- Name: AI Development Assistant
- Type: stdio
- Command:
node /path/to/your/project/dist/index.js
📘 Pro Tip: You might need to use the full path to your project’s built index.js file.
After adding the server, you should see your tools listed under “Available Tools”. If not, try clicking the refresh button in the top right corner of the MCP server section.
For more details about MCP setup, check out the Cursor MCP Documentation.
🛠️ Using the Tools
Once configured, you can use these tools directly in Cursor’s Composer. The AI will automatically suggest using relevant tools, or you can explicitly request them by name or description.
For example, try typing in Composer:
- “Review this code for best practices”
- “Help me architect a new feature”
- “Analyze this UI screenshot”
The agent will ask for your approval before making any tool calls.
📘 Pro Tip: You can update your .cursorrules file with instructions on how to use the tools for certain scenarios, and the agent will use the tools automatically.
📁 Project Structure
src/
├── tools/
│ ├── architect.ts # Code structure generator
│ ├── screenshot.ts # Screenshot analysis tool
│ └── codeReview.ts # Code review tool
├── env/
│ └── keys.ts # Environment configuration (add your API keys here!)
└── index.ts # Main entry point
🤝 Contributing
Contributions welcome! Please feel free to submit a Pull Request.
📝 License
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →