assetpanda-mcp-calculator
v1.0.25
Published
MCP client wrapper for Asset Panda calculator
Downloads
2,031
Readme
Asset Panda MCP Calculator Wrapper
This is a real MCP server that wraps your calculator Lambda function and makes it available to Claude Desktop via the Model Context Protocol.
What This Does
Claude Desktop (MCP Protocol)
↓
MCP Calculator Wrapper (this package)
↓ HTTP
Calculator Lambda (AWS Lambda Function URL)
↓
Calculator Operations (add, subtract, multiply, divide, power, sqrt)Setup for Claude Desktop (Windows)
Option 1: NPM Package (Recommended)
Your Claude Desktop config at C:\Users\reymondko\AppData\Roaming\Claude\claude_desktop_config.json:
{
"mcpServers": {
"assetpanda-calculator": {
"command": "npx",
"args": ["-y", "[email protected]"]
}
}
}Steps:
- Update your Claude Desktop config with the above
- Restart Claude Desktop
- Ask Claude: "What's 25 times 4?"
Option 2: Local Development
For testing local changes before publishing:
{
"mcpServers": {
"assetpanda-calculator": {
"command": "node",
"args": ["\\\\wsl.localhost\\Ubuntu\\home\\reymondko\\pioneer\\packages\\mcp-calculator-wrapper\\index.js"]
}
}
}Steps:
- Make changes to
index.js - Update config to point to local file
- Restart Claude Desktop
How It Works
1. MCP Protocol (stdio communication)
Claude Desktop talks to this wrapper using the MCP protocol over standard input/output.
2. Tool Registration
The wrapper registers six calculator tools:
add: Add two numbers
- Parameters:
a(first number),b(second number) - Returns: Sum of a and b
- Parameters:
subtract: Subtract one number from another
- Parameters:
a(number to subtract from),b(number to subtract) - Returns: Difference of a minus b
- Parameters:
multiply: Multiply two numbers
- Parameters:
a(first number),b(second number) - Returns: Product of a and b
- Parameters:
divide: Divide one number by another
- Parameters:
a(dividend),b(divisor) - Returns: Quotient of a divided by b
- Parameters:
power: Raise a number to a power
- Parameters:
base(base number),exponent(exponent) - Returns: Base raised to the exponent
- Parameters:
sqrt: Calculate square root
- Parameters:
a(number to calculate square root of) - Returns: Square root of a
- Parameters:
3. HTTP API Calls
When Claude calls a calculator tool, the wrapper:
- Receives MCP request from Claude Desktop
- Converts it to HTTP POST request
- Calls your Lambda at
https://fwigg2gvf2sbsinmddyrwga2tq0zdthi.lambda-url.us-east-1.on.aws/mcp - Converts Zod schemas from Lambda to JSON Schema (for Claude compatibility)
- Returns results back to Claude via MCP protocol
4. Schema Conversion
The wrapper automatically converts Zod schemas returned by the Lambda to proper JSON Schema format that Claude Desktop can understand. This happens in the tools/list handler:
// Convert Zod schemas to JSON Schema for all calculator tools
if (result.result?.tools) {
result.result.tools = result.result.tools.map(tool => {
const schemas = {
'add': {
type: 'object',
properties: {
a: { type: 'number', description: 'First number' },
b: { type: 'number', description: 'Second number' }
},
required: ['a', 'b']
},
// ... other tools
};
return {
name: tool.name,
description: tool.description,
inputSchema: schemas[toolName] || defaultSchema
};
});
}Files
- index.js - Main MCP server implementation with schema conversion
- package.json - NPM configuration
- mcp.log - Runtime logs (created automatically)
Development
# Install dependencies (if any added)
npm install
# Test locally
node index.jsThis starts the MCP server. It communicates via stdio, so you'll need an MCP client (like Claude Desktop) to interact with it.
Testing Locally
Test the wrapper directly:
node /home/reymondko/pioneer/packages/mcp-calculator-wrapper/index.jsThen in another terminal, send MCP messages:
# Initialize
echo '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}},"id":1}' | node index.js
# List tools
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | node index.js
# Call add tool
echo '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"add","arguments":{"a":5,"b":3}},"id":1}' | node index.jsPublishing to NPM
# Update version in package.json
npm version patch # or minor, or major
# Publish (requires NPM account and login)
npm publish --access publicAfter publishing, anyone can use:
npx assetpanda-mcp-calculator@latestImportant: When updating the package, use specific version numbers in Claude Desktop config to avoid NPM cache issues:
{
"mcpServers": {
"assetpanda-calculator": {
"command": "npx",
"args": ["-y", "[email protected]"]
}
}
}Change @1.0.22 to @1.0.23 after publishing a new version to force cache refresh.
Environment Variables
- MCP_API_URL: Your Lambda function URL (default:
https://fwigg2gvf2sbsinmddyrwga2tq0zdthi.lambda-url.us-east-1.on.aws)
You can override this in Claude Desktop config:
{
"mcpServers": {
"assetpanda-calculator": {
"command": "npx",
"args": ["-y", "[email protected]"],
"env": {
"MCP_API_URL": "https://your-custom-lambda-url.amazonaws.com"
}
}
}
}Usage Examples
In Claude Desktop
Just ask natural language questions:
- "What's 25 times 4?"
- "Calculate the square root of 144"
- "What's 2 to the power of 8?"
- "Divide 100 by 5"
- "Add 42 and 58"
Claude will automatically use the MCP calculator tools.
Troubleshooting
Schema Validation Errors
If you see errors like Unrecognized key(s) in object: 'error' or ZodError in Claude Desktop logs:
Cause: The Lambda is returning Zod schemas instead of JSON Schema.
Fix: This wrapper automatically converts Zod schemas to JSON Schema. Make sure you're using version 1.0.22 or later:
# Clear NPM cache
rm -rf /mnt/c/Users/reymondko/AppData/Local/npm-cache/_npx
# Update Claude Desktop config to specific version
# Change: "assetpanda-mcp-calculator@latest"
# To: "[email protected]"
# Restart Claude DesktopNPM Cache Issues
If Claude Desktop keeps using an old version after publishing updates:
Cause: npx caches packages based on the package spec hash.
Fix:
- Use specific version numbers instead of
@latestin config - Delete NPM cache:
rm -rf /mnt/c/Users/reymondko/AppData/Local/npm-cache/_npx - Restart Claude Desktop
Global Package Interference
If you installed the package globally and it's not working:
Cause: Global installations can interfere with npx.
Fix:
# Uninstall global package
npm uninstall -g assetpanda-mcp-calculator
# Clear cache
rm -rf /mnt/c/Users/reymondko/AppData/Local/npm-cache/_npx
# Restart Claude Desktop"Cannot find module" error
Make sure Node.js is accessible from Windows:
# In PowerShell, verify Node.js is installed
node --version
# Should output: v18.0.0 or higherAPI Connection Errors
Check that the Lambda URL is correct and accessible:
curl -X POST "https://fwigg2gvf2sbsinmddyrwga2tq0zdthi.lambda-url.us-east-1.on.aws/mcp" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'Should return a list of calculator tools.
Claude Desktop Doesn't See Tools
- Check Claude Desktop logs: Help → View Logs
- Look for
mcp-server-assetpanda-calculator.log - Verify the config file path is correct
- Make sure you restarted Claude Desktop after changing config
- Check that the wrapper is starting: look for
=== MCP Server starting ===in logs
Check Logs
The wrapper creates a log file at:
/home/reymondko/pioneer/packages/mcp-calculator-wrapper/mcp.logCheck this file for detailed request/response logging:
tail -f /home/reymondko/pioneer/packages/mcp-calculator-wrapper/mcp.logLook for:
=== MCP Server starting ===- Server initialized>>> Making Lambda request- Calling Lambda<<< Lambda response- Got Lambda responseERROR- Any errors
Lambda Function URL
Your current Lambda function URL is:
https://fwigg2gvf2sbsinmddyrwga2tq0zdthi.lambda-url.us-east-1.on.aws/mcpThis Lambda implements the calculator operations and returns results to the wrapper.
Architecture
┌─────────────────────┐
│ Claude Desktop │
│ (User asks math) │
└──────────┬──────────┘
│ MCP Protocol (stdio)
│ {"jsonrpc":"2.0","method":"tools/call",...}
↓
┌─────────────────────┐
│ MCP Wrapper │
│ (this package) │
│ - Converts MCP │
│ - Schema transform │
│ - Logging │
└──────────┬──────────┘
│ HTTPS POST
│ {"jsonrpc":"2.0","method":"tools/call",...}
↓
┌─────────────────────┐
│ Lambda Function │
│ (Calculator) │
│ - add, subtract │
│ - multiply, divide │
│ - power, sqrt │
└─────────────────────┘Version History
- 1.0.22 - Fixed schema conversion (Zod → JSON Schema)
- 1.0.7 - Initial release with basic calculator operations
Related Packages
- assetpanda-mcp-kb - Knowledge Base search MCP wrapper
- @assetpanda/mcp-client - Asset Panda MCP client wrapper
License
ISC
