Skip to main content
Glama
ivanbtrujillo

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

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Appeared in Searches

Latest Blog Posts

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