my-mcp-server
This project demonstrates how to implement an MCP server to expose payment data from a MongoDB database, integrating with tools like MCP Inspector and Claude AI. It showcases how LLMs interact with structured data, providing insights into successfully completed payments.
NextApp Payments MCP Server Demo
A demonstration project showcasing how to implement a Model Context Protocol (MCP) server that exposes MongoDB payment data through both MCP Inspector and Claude AI integration. This project serves as an example of how to use the MCP protocol to expose database resources through a standardized interface.
Project Overview
This demo project demonstrates:
- Implementation of an MCP server using the official SDK
- Connection to a specific MongoDB Atlas database
- Retrieval of payment records where
done: true
(successfully completed payments) - Integration with both MCP Inspector and Claude AI
- How LLMs can interact with structured database data
MCP Inspector View
The image above shows the MCP Inspector interface displaying the payment records retrieved from MongoDB Atlas through the MCP server. MCP Inspector is a developer tool that helps verify and debug MCP server implementations.
Claude AI Integration
The image above demonstrates Claude AI successfully:
- Connecting to the MCP server
- Accessing the payments resource
- Analyzing payment data
- Presenting structured results with total amounts, date ranges, and key observations
Setting Up Your MCP Resource in Claude Desktop
If you have created your own MCP server and want to use it with Claude Desktop:
-
Locate Claude Desktop Config
- Windows:
C:\Users\<username>\AppData\Roaming\claude\claude_desktop_config.json
- macOS:
~/Library/Application Support/claude/claude_desktop_config.json
- Linux:
~/.config/claude/claude_desktop_config.json
- Windows:
-
Configure Your MCP Server
{ "mcpServers": { "YourServerName": { "transport": "stdio", "command": "node", "args": ["path/to/your/server.js"], "env": { "YOUR_ENV_VARIABLE": "your_value" }, "cwd": "path/to/your/project" } } }
Replace:
YourServerName
: A unique name for your serverpath/to/your/server.js
: Full path to your server fileYOUR_ENV_VARIABLE
: Any environment variables your server needs
-
Verify Connection
- Open Claude Desktop
- Go to Settings → Developer
- Your server should appear with a "running" status
-
Use Your Resource
- In Claude chat, use:
Use the MCP resource your-resource-uri and [your query]
Example: "Use the MCP resource payments://done and show me all successful payments"
Implementation Details
MCP Resource
- URI:
payments://done
- Purpose: Retrieves payment records where
done: true
- Response Format: JSON
- MIME Type:
application/json
Technologies Used
- MCP SDK: For protocol handling and resource exposure
- MongoDB Driver: For database access and query execution
- Claude Desktop: For LLM integration and natural language querying
Error Handling
The implementation includes error handling for:
- MongoDB connection issues
- Query execution errors
- Connection closure errors
- JSON-formatted logging for Claude Desktop compatibility
Important Notes
This is a demonstration project showing:
- How to implement an MCP server
- How to expose MongoDB data as MCP resources
- Two ways to access the data:
- Through MCP Inspector (for developers)
- Through Claude AI (for end users)
- How LLMs can interact with structured data
The MongoDB connection and resource configurations are specific to this demo. You'll need to modify them for your use case.