MCP Server Example logo

MCP Server Example

by ykitaza

This is an implementation example of a Model Context Protocol (MCP) server that provides a tool for numerical comparison. It demonstrates how to build an MCP server with custom tools.

View on GitHub

Last updated: N/A

What is MCP Server Example?

This is an example MCP server providing a numerical comparison tool. It allows AI clients to accurately compare numbers, addressing common calculation errors.

How to use MCP Server Example?

  1. Install dependencies with bun install. 2. Build the project with bun build. 3. Configure the MCP server in your client application (e.g., Claude Desktop App) using the provided configuration settings. Specify the server command and arguments (absolute paths are required). 4. Use the <use_mcp_tool> XML tag within the client to invoke the compare-numbers tool, providing the numbers to compare as arguments.

Key features of MCP Server Example

  • Numerical Comparison Tool

  • Custom Tool Creation

  • MCP Integration

  • Configuration via JSON

  • Example Usage Provided

Use cases of MCP Server Example

  • Correcting AI Calculation Errors

  • Verifying Numerical Data

  • Integrating External Tools with AI Clients

  • Custom Tool Development for AI Workflows

FAQ from MCP Server Example

What is MCP?

Model Context Protocol. A protocol facilitating communication between a client application and external tools.

What is Bun?

Bun is a fast, all-in-one JavaScript runtime.

Why is absolute path required in server configuration?

For the client to properly locate and execute the server, the absolute path is required.

How do I create a custom tool?

Create a new tool implementation file, register it in src/index.ts with the server.tool method, specifying parameters, their descriptions, and the execution logic.

What does autoApprove do?

autoApprove automatically approves the MCP request from the defined Client. Minimalise its usage for security reasons.