MCP Server in Node.js logo

MCP Server in Node.js

by lucianoayres

This project demonstrates an MCP server built in Node.js that provides two basic tools: add and getApiKey. MCP allows you to integrate custom tools into AI-assisted development environments.

View on GitHub

Last updated: N/A

What is MCP Server in Node.js?

This is an MCP (Model Context Protocol) server built in Node.js. It provides a way to expose custom tools to LLM-based IDEs like Cursor AI, allowing them to call these tools on demand.

How to use MCP Server in Node.js?

  1. Clone the repository. 2. Install dependencies using npm. 3. Configure the ./cursor/mcp.json file with the correct paths to your Node.js executable and server file. 4. Integrate with Cursor AI and use natural language prompts to invoke the tools.

Key features of MCP Server in Node.js

  • MCP Integration

  • Addition Tool

  • Env Var Retrieval

  • Input Validation

  • Standard I/O Transport

Use cases of MCP Server in Node.js

  • Integrating custom tools into AI-assisted IDEs

  • Performing data retrieval on demand

  • Performing code analysis on demand

  • Enforcing coding standards

FAQ from MCP Server in Node.js

What is MCP?

Model Context Protocol provides a standardized approach to integrate custom tools into AI-assisted development environments.

What tools are included in this boilerplate?

The boilerplate includes an 'add' tool that sums two numbers and a 'getApiKey' tool that retrieves an API key from the environment.

What is Zod used for?

Zod is used for schema validation of the input parameters for the 'add' tool.

How do I integrate this with Cursor AI?

You need to configure the mcp.json file in the ./cursor directory with the correct paths and environment variables.

Can I use this with other IDEs?

Yes, as long as the IDE supports the Model Context Protocol and allows you to configure MCP servers.