{"_id":"@ai42/mcp","_rev":"3-7bf15a0e81861d095c29eabe905c2a44","name":"@ai42/mcp","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@ai42/mcp","version":"0.1.0","keywords":["mcp","x402","payment","solana","web3"],"author":{"name":"keyaru"},"license":"MIT","_id":"@ai42/mcp@0.1.0","maintainers":[{"name":"keyaru","email":"tamiltac6@gmail.com"}],"homepage":"https://github.com/Kishore-MK/ai42-mcp#readme","bugs":{"url":"https://github.com/Kishore-MK/ai42-mcp/issues"},"bin":{"ai42-mcp":"dist/index.js"},"dist":{"shasum":"59bbfb62c60f809f2c3809fef1f88c686b58aa31","tarball":"https://registry.npmjs.org/@ai42/mcp/-/mcp-0.1.0.tgz","fileCount":5,"integrity":"sha512-XP7VXbiFuPd0N+X2q6+2Gu9KAZaiYk6vdmn0kuYwiOg+VYxnuKCVIKX7Moc6kpMAjRGZoqZOrWwCWYRoOvKTOg==","signatures":[{"sig":"MEQCIFK1p7RzvAYSOtptnCmif8BbAYPvsQ3TcF9DmngLikZJAiAWD1FplET3te4d6qgBDSpjltTo5GpH9SkC/bV4sILbfA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13795},"main":"dist/index.js","type":"module","gitHead":"d77ccd9af4443ee3510e8a019a0ef8eeebf465ef","scripts":{"dev":"tsx watch src/index.ts","build":"tsc","start":"node dist/index.js"},"_npmUser":{"name":"keyaru","email":"tamiltac6@gmail.com"},"repository":{"url":"git+https://github.com/Kishore-MK/ai42-mcp.git"},"_npmVersion":"10.5.0","description":"X402 Payment MCP Server for automatic web request payments","directories":{},"_nodeVersion":"21.7.3","dependencies":{"zod":"^3.22.4","bs58":"^6.0.0","dotenv":"^16.4.5","x402-fetch":"^0.7.0","@modelcontextprotocol/sdk":"^1.17.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.1","typescript":"^5.8.3","@types/node":"^20.11.17"},"_npmOperationalInternal":{"tmp":"tmp/mcp_0.1.0_1762950377235_0.3116427618757156","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@ai42/mcp","version":"0.1.1","keywords":["mcp","x402","payment","solana","web3"],"author":{"name":"keyaru"},"license":"MIT","_id":"@ai42/mcp@0.1.1","maintainers":[{"name":"keyaru","email":"tamiltac6@gmail.com"}],"homepage":"https://github.com/Kishore-MK/ai42-mcp#readme","bugs":{"url":"https://github.com/Kishore-MK/ai42-mcp/issues"},"bin":{"ai42-mcp":"dist/index.js"},"dist":{"shasum":"2fcc8f2e1ceac25966011c02da81edfde63bbbaa","tarball":"https://registry.npmjs.org/@ai42/mcp/-/mcp-0.1.1.tgz","fileCount":5,"integrity":"sha512-M305y1IF4VRovbWS7BwZZtxrvekIqmmNlgtdVIS8H4szmwRaBEr0y/zDTl9vpMzwZf9U794JwGSyG6glh7fhNw==","signatures":[{"sig":"MEUCIDLyHxzpe7oweMNhOtJNwyiAe6GT3E25Cts/82RqZA84AiEA466oHasKHDRwq4US2kd5U/4I/1+pyTuQgA2UhC5h/zo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20606},"main":"dist/index.js","type":"module","gitHead":"6485108e9dd62fc032be2c24af1df6d96f5fc1bd","scripts":{"dev":"tsx watch src/index.ts","build":"tsc","start":"node dist/index.js"},"_npmUser":{"name":"keyaru","email":"tamiltac6@gmail.com"},"repository":{"url":"git+https://github.com/Kishore-MK/ai42-mcp.git"},"_npmVersion":"10.5.0","description":"X402 Payment MCP Server for automatic web request payments","directories":{},"_nodeVersion":"21.7.3","dependencies":{"zod":"^3.22.4","bs58":"^6.0.0","dotenv":"^16.4.5","x402-fetch":"^0.7.0","@solana/web3.js":"^1.98.4","@modelcontextprotocol/sdk":"^1.17.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.1","typescript":"^5.8.3","@types/node":"^20.11.17"},"_npmOperationalInternal":{"tmp":"tmp/mcp_0.1.1_1762951391766_0.26670383722120783","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@ai42/mcp","version":"0.1.2","type":"module","description":"X402 Payment MCP Server for automatic web request payments","main":"dist/index.js","bin":{"ai42-mcp":"dist/index.js"},"scripts":{"dev":"tsx watch src/index.ts","build":"tsc","start":"node dist/index.js"},"repository":{"url":"git+https://github.com/Kishore-MK/ai42-mcp.git"},"publishConfig":{"access":"public"},"keywords":["mcp","x402","payment","solana","web3"],"author":{"name":"keyaru"},"license":"MIT","dependencies":{"@modelcontextprotocol/sdk":"^1.17.2","@solana/web3.js":"^1.98.4","bs58":"^6.0.0","dotenv":"^16.4.5","x402-fetch":"^0.7.0","zod":"^3.22.4"},"devDependencies":{"@types/node":"^20.11.17","tsx":"^4.7.1","typescript":"^5.8.3"},"_id":"@ai42/mcp@0.1.2","gitHead":"75c4c4a1f28e4078e94b837ee45263fb31863df6","bugs":{"url":"https://github.com/Kishore-MK/ai42-mcp/issues"},"homepage":"https://github.com/Kishore-MK/ai42-mcp#readme","_nodeVersion":"21.7.3","_npmVersion":"10.5.0","dist":{"integrity":"sha512-uylx6YxRjPnnDsTEiP/1Gc+Chrme09BlEdp0XndEw3ceenuKv5l9QjOj1WUuY8loXO5nFiIgSJBWhilYopkmzA==","shasum":"ad9bff8e4400ef269477e049c5bb07b027d7a9fe","tarball":"https://registry.npmjs.org/@ai42/mcp/-/mcp-0.1.2.tgz","fileCount":5,"unpackedSize":20606,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHbVkr1T6DJ1X7p2V+mOO/9QRz5JoNEshq/hTcikMm2UAiBm2h4uMXNhnAJ/4ld9WvllLFCNPZCK9TZA+ZCLdlNqWA=="}]},"_npmUser":{"name":"keyaru","email":"tamiltac6@gmail.com"},"directories":{},"maintainers":[{"name":"keyaru","email":"tamiltac6@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp_0.1.2_1762952480358_0.49200819937565465"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-12T12:26:17.100Z","modified":"2025-11-12T13:01:20.721Z","0.1.0":"2025-11-12T12:26:17.394Z","0.1.1":"2025-11-12T12:43:11.935Z","0.1.2":"2025-11-12T13:01:20.514Z"},"bugs":{"url":"https://github.com/Kishore-MK/ai42-mcp/issues"},"author":{"name":"keyaru"},"license":"MIT","homepage":"https://github.com/Kishore-MK/ai42-mcp#readme","keywords":["mcp","x402","payment","solana","web3"],"repository":{"url":"git+https://github.com/Kishore-MK/ai42-mcp.git"},"description":"X402 Payment MCP Server for automatic web request payments","maintainers":[{"name":"keyaru","email":"tamiltac6@gmail.com"}],"readme":"# AI42 MCP Server\n\n<div align=\"center\">\n\n**X402 Payment MCP Server for Claude Desktop**\n\n[![npm version](https://img.shields.io/npm/v/@ai42/mcp.svg)](https://www.npmjs.com/package/@ai42/mcp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)\n\n[Quick Start](#quick-start) • [Features](#features) • [Installation](#installation) • [Usage](#usage)\n\n</div>\n\n---\n\n## Overview\n\nAI42 MCP Server enables Claude Desktop to automatically handle web requests with X402 payments. Fetch data from any URL and seamlessly process cryptocurrency payments when required (402 status). Includes payment tracking, balance checking, and spending limits.\n\n### Features\n\n-  **Automatic Payment Handling**: Transparent X402 payment processing on 402 responses\n-  **GET & POST Support**: Full HTTP method support for API interactions\n-  **Payment Management**: Track history, check balance, set spending limits\n-  **Solana Integration**: Built on Solana devnet/mainnet\n-  **Type-safe**: Full TypeScript support\n-  **Zero Configuration**: Works out of the box with Claude Desktop\n\n###  Available Tools\n\n| Tool                  | Description                                      |\n| --------------------- | ------------------------------------------------ |\n| `fetch-with-payment`  | Fetch data from URLs with automatic payments     |\n| `get-balance`         | Check wallet SOL balance                         |\n| `get-payment-history` | View all payments made during session            |\n| `set-payment-limit`   | Set maximum spending limit per request           |\n\n---\n\n## Installation\n\n### Prerequisites\n\n- Node.js 18+\n- Solana wallet private key (base58 format)\n- Claude Desktop\n\n### Quick Install\n\nNo manual installation needed! Just configure Claude Desktop:\n\n**Add to `claude_desktop_config.json`:**\n\n**Windows:**\n```json\n{\n  \"mcpServers\": {\n    \"x402-payment\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@ai42/mcp\"],\n      \"env\": {\n        \"SOLANA_PRIVATE_KEY\": \"your_base58_private_key_here\"\n      }\n    }\n  }\n}\n```\n\n**macOS:**\n```json\n{\n  \"mcpServers\": {\n    \"x402-payment\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@ai42/mcp\"],\n      \"env\": {\n        \"SOLANA_PRIVATE_KEY\": \"your_base58_private_key_here\"\n      }\n    }\n  }\n}\n```\n\n**Linux:**\n```json\n{\n  \"mcpServers\": {\n    \"x402-payment\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@ai42/mcp\"],\n      \"env\": {\n        \"SOLANA_PRIVATE_KEY\": \"your_base58_private_key_here\"\n      }\n    }\n  }\n}\n```\n\n### Config File Locations\n\n| Platform | Path                                                      |\n| -------- | --------------------------------------------------------- |\n| Windows  | `%APPDATA%\\Claude\\claude_desktop_config.json`             |\n| macOS    | `~/Library/Application Support/Claude/claude_desktop_config.json` |\n| Linux    | `~/.config/Claude/claude_desktop_config.json`             |\n\n**After adding config:** Restart Claude Desktop!\n\n---\n\n## Quick Start\n\n### Getting Your Private Key\n\n**Generate Solana Keypair:**\n```bash\nsolana-keygen new --outfile ~/.config/solana/id.json\nsolana-keygen pubkey ~/.config/solana/id.json\n```\n\n**Export Private Key (base58 format):**\n```bash\ncat ~/.config/solana/id.json\n# Copy the array, then convert to base58\n```\n\n⚠️ **Never commit private keys to version control!**\n\n### First Request\n\nOnce configured and Claude Desktop is restarted, simply ask:\n\n```\nYou: Check my wallet balance\n\nClaude: [Uses get-balance tool] Your balance is 2.5 SOL on devnet\n```\n\n---\n\n## Usage\n\n### Example Conversations\n\n#### Fetch Data from URL\n\n```\nYou: Get data from https://api.example.com/endpoint\n\nClaude: [Uses fetch-with-payment] Here's the data from the API...\n```\n\n#### Fetch with Payment\n\n```\nYou: Fetch https://paid-service.com/premium-data\n\nClaude: [Uses fetch-with-payment] Payment of 0.05 SOL made successfully. \nHere's the premium data...\n```\n\n#### POST Request\n\n```\nYou: POST this data to https://api.example.com: {\"message\": \"hello\"}\n\nClaude: [Uses fetch-with-payment] Successfully posted. Response: {...}\n```\n\n#### Check Balance\n\n```\nYou: What's my SOL balance?\n\nClaude: [Uses get-balance] Your current balance:\n- Balance: 2.5 SOL\n- Network: devnet\n- Address: 7xK...abc\n```\n\n#### Set Payment Limit\n\n```\nYou: Set payment limit to 0.1 SOL\n\nClaude: [Uses set-payment-limit] Payment limit set to 0.1 SOL. \nAny request exceeding this amount will be rejected.\n```\n\n#### View Payment History\n\n```\nYou: Show my payment history\n\nClaude: [Uses get-payment-history] \nTotal payments: 3\nTotal spent: 0.15 SOL\n\nRecent payments:\n1. 0.05 SOL to xyz...abc at 2025-11-12T10:30:00Z\n2. 0.08 SOL to def...123 at 2025-11-12T11:45:00Z\n3. 0.02 SOL to ghi...789 at 2025-11-12T12:15:00Z\n```\n\n---\n\n## Tool Reference\n\n### 1. `fetch-with-payment`\n\nFetch data from any URL with automatic payment handling.\n\n**Parameters:**\n- `url` (string, required): URL to fetch\n- `method` (string, optional): HTTP method - \"GET\" or \"POST\" (default: \"GET\")\n- `body` (string, optional): JSON string for POST requests\n\n**Returns:**\n```typescript\n{\n  success: boolean;\n  data: any;\n  payment_made: boolean;\n  payment_amount: number; // in SOL\n}\n```\n\n**Example:**\n```\nGet data from https://api.weather.com/current\n```\n\n### 2. `get-balance`\n\nCheck current SOL balance in your wallet.\n\n**Parameters:** None\n\n**Returns:**\n```typescript\n{\n  balance: number;      // SOL amount\n  unit: \"SOL\";\n  network: string;      // \"devnet\" or \"mainnet\"\n  address: string;      // Public key\n}\n```\n\n**Example:**\n```\nCheck my wallet balance\n```\n\n### 3. `get-payment-history`\n\nView all payments made during the current session.\n\n**Parameters:**\n- `limit` (number, optional): Maximum records to return (default: all)\n\n**Returns:**\n```typescript\n{\n  total_payments: number;\n  total_spent: number;     // Total SOL spent\n  records: Array<{\n    url: string;\n    amount: number;        // in SOL\n    recipient: string;\n    timestamp: string;\n    signature: string;\n  }>;\n}\n```\n\n**Example:**\n```\nShow last 5 payments\n```\n\n### 4. `set-payment-limit`\n\nSet maximum spending limit per request. Set to 0 to remove limit.\n\n**Parameters:**\n- `limit` (number, required): Maximum SOL amount (0 to remove)\n\n**Returns:**\n```typescript\n{\n  message: string;\n  current_limit: number | null;\n}\n```\n\n**Example:**\n```\nDon't let me spend more than 0.05 SOL per request\n```\n\n---\n\n## How It Works\n\n### The X402 Payment Flow\n\n1. **Request**: Claude makes a request to a URL\n2. **402 Response**: If the endpoint requires payment, it returns HTTP 402\n3. **Automatic Payment**: The MCP server automatically processes the payment using your Solana wallet\n4. **Retry**: The request is retried with payment proof\n5. **Success**: Data is returned to Claude\n\n### Payment Tracking\n\n- All payments are logged in-memory during the session\n- Track amounts, recipients, timestamps, and transaction signatures\n- View history anytime with `get-payment-history`\n\n### Spending Limits\n\n- Set a maximum amount per request to prevent overspending\n- Requests exceeding the limit are automatically rejected\n- Remove limits by setting to 0\n\n---\n\n## Advanced Usage\n\n### Testing with MCP Inspector\n\nFor development and debugging:\n\n```bash\n# Install globally or use npx\nnpx @modelcontextprotocol/inspector npx @ai42/mcp\n```\n\nThis opens a web UI where you can:\n- See all registered tools\n- Test tool calls with custom inputs\n- View request/response JSON\n- Debug payment flows\n\n### Environment Variables\n\nIf running locally (not via npx in Claude config):\n\n```bash\n# .env file\nSOLANA_PRIVATE_KEY=your_base58_private_key_here\n```\n\n### Network Configuration\n\nCurrently supports:\n- **Solana Devnet** (default): For testing with test SOL\n- **Solana Mainnet**: For production (update in source)\n\n---\n\n## Security Best Practices\n\n### Private Key Safety\n\n✅ **DO:**\n- Store private keys in environment variables\n- Use separate wallets for testing (devnet) and production (mainnet)\n- Set reasonable payment limits\n- Regularly check payment history\n\n❌ **DON'T:**\n- Commit private keys to git\n- Share private keys in chat or screenshots\n- Use production wallets without payment limits\n- Ignore payment history\n\n### Payment Limits\n\nRecommended limits based on usage:\n\n| Use Case        | Recommended Limit |\n| --------------- | ----------------- |\n| Testing         | 0.01 SOL          |\n| Light Usage     | 0.1 SOL           |\n| Regular Usage   | 0.5 SOL           |\n| Heavy Usage     | 1.0 SOL           |\n\n---\n\n## Troubleshooting\n\n### \"Bad secret key size\" error\n\nYour private key format is incorrect. Ensure it's in base58 format:\n\n```bash\n# Convert from JSON array to base58\nnode -e \"console.log(require('bs58').encode(Buffer.from([your,array,here])))\"\n```\n\n### \"Module not found\" error\n\nClear npx cache and reinstall:\n\n```bash\nnpx clear-npx-cache\n# Restart Claude Desktop\n```\n\n### \"Payment failed\" error\n\nCheck:\n1. Wallet has sufficient balance (`get-balance`)\n2. Network connectivity to Solana RPC\n3. Private key is valid\n4. Payment limit not exceeded\n\n### Tool not appearing in Claude\n\n1. Verify config file location and syntax\n2. Restart Claude Desktop completely\n3. Check Claude Desktop logs for errors\n4. Test with MCP Inspector\n\n---\n\n## Development\n\n### Local Development\n\n```bash\n# Clone repository\ngit clone https://github.com/Kishore-MK/ai42-mcp\ncd ai42-mcp\n\n# Install dependencies\nnpm install\n\n# Create .env file\necho \"SOLANA_PRIVATE_KEY=your_key\" > .env\n\n# Build\nnpm run build\n\n# Test locally\nnode dist/index.js\n```\n\n### Project Structure\n\n```\nai42-mcp/\n├── src/\n│   ├── index.ts          # Main MCP server\n|   ├── payment.ts        # Payment client wrapper\n│   └── types.ts          # Types file\n├── dist/                 # Compiled JavaScript\n├── package.json\n├── tsconfig.json\n└── README.md\n```\n\n---\n\n## Contributing\n\nContributions welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Feat: Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n---\n\n## Links\n\n- 📦 **NPM Package**: [@ai42/mcp](https://www.npmjs.com/package/@ai42/mcp)\n- 💻 **GitHub Repository**: [ai42-mcp](https://github.com/Kishore-MK/ai42-mcp)\n- 📖 **X402 Protocol**: [x402.org](https://x402.org)\n- 🔧 **MCP SDK**: [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/sdk)\n\n---\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details\n\n---\n\n## Acknowledgments\n\nBuilt with:\n\n- [X402 Protocol](https://x402.org) - HTTP 402 payment standard\n- [x402-fetch](https://github.com/x402/x402-fetch) - Payment wrapper for Node.js\n- [Model Context Protocol](https://modelcontextprotocol.io) - MCP SDK\n- [@solana/web3.js](https://solana.com) - Solana blockchain interaction\n\n---\n\n<div align=\"center\">\n\n**Made with ❤️ by keyaru**\n\n[NPM](https://www.npmjs.com/package/@ai42/mcp) • [GitHub](https://github.com/Kishore-MK/ai42-mcp) • [Issues](https://github.com/Kishore-MK/ai42-mcp/issues)\n\n</div>","readmeFilename":"README.md"}