Skip to main content
Glama

MCP Server Example

MCP 服务器示例

该项目是一个非常基本的 MCP 服务器,可供 Cursor 或其他工具使用。

修改 index.ts 并添加您想要的任何工具,或保留默认工具。

然后构建项目:

pnpm run build

并运行它:

pnpm run start

现在在您的项目中添加一个 .cursor/mcp.json 文件,并粘贴以下内容;

{ "mcpServers":{ "weather":{ "command": "node", "args": ["[path]/build/index.js"] } } }

[path] 替换为此项目的绝对路径。在项目文件夹中运行 pwd 即可。例如,在我的情况下,它是:

{ "mcpServers":{ "weather":{ "command": "node", "args": ["/Users/ivanbtrujillo/Development/mcp-server-spike/build/index.js"] } } }

现在前往光标处的“设置”。您应该能够在那里看到 MCP 服务器。启用它(点击右上角)MCP 服务器光标

现在进入聊天,切换到代理模式并选择 claude-3.7-sonnet 作为您的模型。

输入以下内容:

What is the weather in Texas?

它将使用 MCP 首先获取天气警报,然后获取天气预报。以下是查询德克萨斯州天气时聊天界面的示例:

聊天界面

Install Server
A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

一个基本的 MCP 服务器模板,可以与 Cursor 集成,以使用 Claude-3.7-sonnet 模型实现天气信息检索等 AI 工具。

Related MCP Servers

  • A
    security
    F
    license
    A
    quality
    A starter template for building Model Context Protocol servers that can be integrated with Cursor or Claude Desktop, allowing developers to create custom tools and extensions for AI assistants.
    Last updated -
    1
    3
    13
    TypeScript
    • Apple
  • -
    security
    F
    license
    -
    quality
    A simple MCP service that allows users to query weather conditions for cities worldwide through the Cursor AI assistant.
    Last updated -
    1
    JavaScript
  • -
    security
    A
    license
    -
    quality
    A Model Context Protocol server that enables users to fetch weather forecasts through Cursor AI by using natural language queries.
    Last updated -
    Python
    MIT License
  • A
    security
    F
    license
    A
    quality
    A starter template for building Model Context Protocol servers that integrate with AI assistants like Claude and Cursor, providing custom tools, resource providers, and prompt templates.
    Last updated -
    2
    JavaScript

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ivanbtrujillo/mcp-server-spike'

If you have feedback or need assistance with the MCP directory API, please join our Discord server