
3mdistal/css-mcp-server 是从 https://github.com/3mdistal/css-mcp-server. 导入的 MCP 服务器候选
概览
3mdistal/css-mcp-server 是从 https://github.com/3mdistal/css-mcp-server. 导入的 MCP 服务器候选
概述(AI 翻译)
该仓库包含一个简单的模型上下文协议(MCP)服务器,由Node.js和TypeScript构建。它作为“CSS导师”,向连接的AI客户端提供个性化的CSS功能更新。
本服务器演示了关键的MCP概念:定义资源、工具和提示词。本次演示的目标是帮助您从此继续前进,构建更大、更有趣的代理能力。
先修条件
- Node.js(推荐v18或更高版本)
npm)(或您偏好的 Node.js 包管理器,如yarn或pnpm)- 能够连接到MCP服务器(例如Claude桌面应用)的AI客户端
- OpenRouter API 密钥(用于通过 Perplexity 获取实时 CSS 更新)
快速启动
请按照以下步骤快速启动服务器:
-
克隆仓库:
-
安装依赖:
-
准备API密钥:
get_latest_updates工具需要OpenRouter的API密钥。从OpenRouter获取密钥。你将在第5步将该密钥提供给你的MCP客户端。 -
构建服务器: 编译TypeScript代码。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Building a CSS Tutor MCP Server
This repo contains a simple Model Context Protocol (MCP) server built with Node.js and TypeScript. It acts as a “CSS Tutor,” providing personalized updates about CSS features to a connected AI client.
This server demonstrates key MCP concepts: defining Resources, Tools, and Prompts. The goal of this demonstration is to help you move on from here and build much larger and more interesting agentic capabilities.
Prerequisites
- Node.js (v18 or later recommended)
npm(or your preferred Node.js package manager likeyarnorpnpm)- An AI client capable of connecting to an MCP server (e.g., the Claude desktop app)
- An OpenRouter API Key (for fetching live CSS updates via Perplexity)
Quick Start
Follow these steps to get the server running quickly:
-
Clone the Repository:
git clone https://github.com/3mdistal/css-mcp-server.git cd css-mcp-server -
Install Dependencies:
npm install # Or: yarn install / pnpm install -
Prepare API Key: The
get_latest_updatestool requires an OpenRouter API key. Obtain your key from OpenRouter. You will provide this key to your MCP client in Step 5. -
Build the Server: Compile the TypeScript code.
npm run build # Or: yarn build / pnpm run build -
Configure Your MCP Client: Tell your client how to launch the server and provide the API key as an environment variable. Here’s an example for the Claude desktop app’s
claude_desktop_config.json:{ "mcpServers": { "css-tutor": { "command": "node", "args": [ "/full/path/to/your/css-mcp-server/build/index.js" ], "env": { "OPENROUTER_API_KEY": "sk-or-xxxxxxxxxxxxxxxxxxxxxxxxxx" } } } }(Ensure the path in
argsis the correct absolute path to the builtindex.jsfile on your system. Replace the placeholder API key.) -
Connect: Start the connection from your MCP client. The client will launch the server process (with the API key in its environment), and you can start interacting!
Using with Cursor
Cursor is an AI-first code editor that can act as an MCP client. Setting up this server with Cursor is straightforward, but requires an extra step for the guidance prompt.
-
Configure Server in Cursor:
- Go to
Cursor Settings>MCP>Add new global MCP server. - Paste in the same JSON as above in the Claude Desktop step, with all the same caveats.
- Go to
-
Create a Cursor Project Rule for the Prompt: Cursor currently does not automatically use MCP prompts provided by servers. Instead, you need to provide the guidance using Cursor’s Project Rules feature.
安装
npx @modelcontextprotocol/inspector node ./build/index.js配置
{
"mcpServers": {
"css-tutor": {
"command": "node",
"args": [
"/full/path/to/your/css-mcp-server/build/index.js"
],
"env": {
"OPENROUTER_API_KEY": "sk-or-xxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
}