mcp-nodejs
A Node.js MCP server example for the OpenWeather API, requiring an API key.
Bring the model context protocol (MCP) in action:
- Generate an MCP server (Node.js) from Postman
- Deploy the server locally
- Test the server from a local MCP client (Cursor)
The MCP server in this example connects to the OpenWeather API.
Actions:
Develop
Generate an MCP server, using Postman.
See the sections below for a description of the actions taken.
Install Postman
sudo snap install postman
Start Postman
postman
Login with an account > free plan.
Generate
In Postman:
- API network > MCP Generator
- Search > Openweathermap (by API Evangelist)
- Select APIs > Add Requests
- Generate
- Download ZIP
- Unzip
The API requests in this example serve as the "tools" that an LLM can use.
Build
In the ./src directory:
npm install
Deploy (MCP server)
Start the MCP server and configure it with an API key to access the underlying API.
See the sections below for a description of the actions taken.
Start
In the ./src directory:
node mcpServer.js
Configure
In this example, we use the OpenWeather API.
In OpenWeather:
- Create an account or sign-in
- Save the API key
- https://openweathermap.org/api
Copy the API key into src/.env (not checked in in this repo):
- OPENWEATHERMAP_API_KEY=your_copied_key
Restart
In the ./src directory:
node mcpServer.js
Deploy (MCP client)
Install and configure Cursor as an MCP client that embeds the above deployed MCP server into its models.
In this example, no specific model binding is selected (we just use the Cursor defaults).
See the sections below for a description of the actions taken.
Install Cursor
Install:
Observe preconfigured models:
- Cursor settings > Models
Configure Cursor
Add the running MCP server to Cursor.
- In Cursor, select Cursor Settings > Tools & Integrations > MCP tools > New MCP Server
- Add args: "your-parent-dirs/mcpServer.js"
{ "mcpServers": { "weather-mcp-agent": { "command": "node", "args": ["your-parent-dirs/mcp-nodejs/src/mcpServer.js"] } } }
Observe a green dot, indicating that the MCP-server is ready to use.
Sometimes it seems additionally selecting the disable/enable switch is required.
Test
Ask a question to the models:
- Ctrl-I > "What's the weather in Amsterdam" > Accept
Based on the question, the LLM internally reasons and decides which tool to use in order to produce an answer.
Credits
This example is based on:
Related Servers
SonarQube
Provides seamless integration with SonarQube Server or Cloud, and enables analysis of code snippets directly within the agent context
YepCode
Execute any LLM-generated code in the YepCode secure and scalable sandbox environment and create your own MCP tools using JavaScript or Python, with full support for NPM and PyPI packages
MCP Server Starter
A TypeScript starter template for building Model Context Protocol (MCP) servers.
MCP System Monitor Server
A cross-platform server for real-time monitoring of CPU, GPU, memory, disk, network, and process information.
nREPL MCP Server
Interact with a running Clojure nREPL instance for code evaluation, namespace inspection, and other utilities.
Remote MCP Server on Cloudflare
A template for deploying a remote MCP server on Cloudflare Workers, customizable by defining tools in the source code.
MCP Chart Server
Create real-time TradingView chart visualizations using the Chart-IMG API.
REPL MCP Server
A universal REPL session manager supporting Python, Node.js, Ruby, and more, with session management and LLM-assisted recovery.
EOL MCP Server
Check software end-of-life (EOL) dates and support status using the endoflife.date API to provide accurate lifecycle and security information.
mcp-graphql
A GraphQL server that supports the Model Context Protocol (MCP), enabling Large Language Models (LLMs) to interact with GraphQL APIs through schema introspection and query execution.