diff --git a/zereus-mcp/.env.example b/zereus-mcp/.env.example new file mode 100644 index 0000000..7cb6248 --- /dev/null +++ b/zereus-mcp/.env.example @@ -0,0 +1,3 @@ +# API Configuration +ZEREUS_API_URL=https://api-url-here.com +ZEREUS_API_KEY=your-api-key-here diff --git a/zereus-mcp/.gitignore b/zereus-mcp/.gitignore new file mode 100644 index 0000000..8a8d093 --- /dev/null +++ b/zereus-mcp/.gitignore @@ -0,0 +1,7 @@ +node_modules +.env +.DS_Store +.vscode +dist +build +package-lock.json diff --git a/zereus-mcp/README.md b/zereus-mcp/README.md new file mode 100644 index 0000000..75324f7 --- /dev/null +++ b/zereus-mcp/README.md @@ -0,0 +1,81 @@ +# Zereus MCP - Crypto Market Intelligence for Claude + +A Model Context Protocol server that exposes Zereus's zAI market intelligence capabilities to Claude Desktop and other AI assistants. + +Zereus MCP connects [Anthropic's Claude](https://www.anthropic.com/claude) to Zereus zAI market intelligence via the Model Context Protocol (MCP). This integration delivers real-time crypto sentiment analysis, token metrics, and trend detection directly in conversations with Claude. + +This repository contains the MCP server implementation that enables Claude to access Zereus' crypto market intelligence. + +NOTE - API KEY is required for this to work. Please contact Zereus team for the API key, for demo purposes we have included a video below. + +## Features + +- **Real-time Sentiment Analysis**: Get instant sentiment analysis for any crypto token +- **Seamless Claude Integration**: Access market insights directly in your Claude conversations +- **Developer-friendly**: Simple API for integrating crypto intelligence into your applications + +## Demo + +This MCP server is a demonstration of our upcoming B2B API suite, which includes: + +- Text-based analysis through Claude (this repository) +- GUI dashboard connected to our API suite +- 18+ specialized endpoints for comprehensive market intelligence + +Check out our [announcement tweet](https://x.com/zereusai/status/1901096538233074156) for a preview! + +## Quick Setup + +1. Clone this repository: +```bash +git clone https://github.com/elitexape/zereus-mcp.git +cd zereus-mcp +``` + +2. Install dependencies: +```bash +npm install +``` + +3. Build the project: +```bash +npm run build +``` + +4. Configure Claude Desktop: + - For macOS: + ```bash + code ~/Library/Application\ Support/Claude/claude_desktop_config.json + ``` + - For Windows: + ```bash + code %APPDATA%\Claude\claude_desktop_config.json + ``` + +5. Update the Claude Desktop configuration with: +```json +{ + "mcpServers": { + "zereus": { + "command": "node", + "args": [ + "/ABSOLUTE/PATH/TO/YOUR/zereus-mcp/build/index.js" + ] + } + } +} +``` + +6. Restart Claude Desktop + +## Usage Examples + +Once set up, you can ask Claude Desktop questions like: + +- "What's the current sentiment analysis for BONK token?" +- "What's the sentiment analysis for TRUMP token?" +- "Analyze the sentiment for SOL token" + +## Social + +- Twitter: [@zereusai](https://twitter.com/zereusai) diff --git a/zereus-mcp/package.json b/zereus-mcp/package.json new file mode 100644 index 0000000..05ea29c --- /dev/null +++ b/zereus-mcp/package.json @@ -0,0 +1,36 @@ +{ + "name": "zereus-mcp-server", + "version": "1.0.0", + "description": "MCP server for Zereus zAI market intelligence", + "main": "build/index.js", + "type": "module", + "bin": { + "zereus-mcp": "./build/index.js" + }, + "scripts": { + "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"", + "start": "node build/index.js" + }, + "keywords": [ + "zereus", + "solana", + "mcp", + "model-context-protocol", + "ai", + "market-intelligence" + ], + "author": "Zereus", + "license": "MIT", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.5.0", + "cors": "^2.8.5", + "dotenv": "^16.4.7", + "express": "^5.0.1", + "node-fetch": "^3.3.2", + "zod": "^3.24.2" + }, + "devDependencies": { + "@types/node": "^22.13.4", + "typescript": "^5.7.3" + } +} diff --git a/zereus-mcp/src/index.ts b/zereus-mcp/src/index.ts new file mode 100644 index 0000000..40aa4f9 --- /dev/null +++ b/zereus-mcp/src/index.ts @@ -0,0 +1,140 @@ +// src/index.ts +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { z } from "zod"; +import dotenv from "dotenv"; +import fetch from "node-fetch"; + +// Load environment variables +dotenv.config(); + +// API configuration +const API_URL = "http://localhost:5050"; //for local demonstration, final Public URL will be provided by Zereus team once the B2B suite is live + +// Create server with proper initialization +const server = new McpServer({ + name: "Zereus-zAI", + version: "1.0.0" +}); + +/** + * Function to get sentiment analysis for a token + * @param {string} tokenSymbol - The symbol of the token to analyze + * @returns {Promise} - The sentiment analysis data + */ +async function getSentimentAnalysis(tokenSymbol) { + try { + console.error(`Calling sentiment analysis API for ${tokenSymbol}...`); + + const endpoint = `${API_URL}/api/v1/sentiment-analysis`; + console.error(`URL: ${endpoint}`); + + // Create request body + const requestBody = { + query: tokenSymbol, + timeframe: "12 Hours" + }; + + console.error(`Request body: ${JSON.stringify(requestBody)}`); + + const response = await fetch(endpoint, { + method: 'POST', + headers: { + "Content-Type": "application/json", + "Z-XAPI": "API-KEY" //Procure your API key by contacting team, or MB @ t.me/mitulbharti + }, + body: JSON.stringify(requestBody) + }); + + console.error(`Response status: ${response.status}`); + + if (!response.ok) { + const errorText = await response.text(); + console.error(`API error response: ${errorText}`); + throw new Error(`API request failed with status ${response.status}: ${errorText}`); + } + + const data = await response.json(); + console.error(`API response data: ${JSON.stringify(data, null, 2)}`); + return data; + } catch (error) { + console.error("Error fetching sentiment analysis:", error); + throw error; + } +} + +// Register only the sentiment analysis tool +server.tool( + "getSentimentAnalysis", + { tokenSymbol: z.string().describe("The symbol of the token to analyze (e.g., 'SOL', 'BONK', 'TRUMP')") }, + async ({ tokenSymbol }) => { + try { + console.error(`Tool called: getSentimentAnalysis with tokenSymbol=${tokenSymbol}`); + const data = await getSentimentAnalysis(tokenSymbol); + + // Extract data with flexible path handling + const typedData = data as { data?: { sentimentAnalysis?: unknown }; sentimentAnalysis?: unknown }; + let result; + if (typedData.data?.sentimentAnalysis) { + result = typedData.data.sentimentAnalysis; + } else if (typedData.sentimentAnalysis) { + result = typedData.sentimentAnalysis; + } else { + result = typedData; + } + + console.error(`Returning result: ${JSON.stringify(result, null, 2)}`); + return { + content: [{ + type: "text", + text: typeof result === 'string' ? result : JSON.stringify(result, null, 2) + }] + }; + } catch (error) { + console.error(`Error calling getSentimentAnalysis:`, error); + return { + content: [{ + type: "text", + text: `Error: ${error.message}` + }], + isError: true + }; + } + } +); + +// Connect and listen +async function main() { + try { + // Print debug information + console.error("Starting Zereus MCP Server..."); + console.error(`API URL: ${API_URL}`); + + // Create transport + console.error("Creating transport..."); + const transport = new StdioServerTransport(); + + // Connect to transport + console.error("Connecting to transport..."); + await server.connect(transport); + + console.error("✅ Zereus MCP Server is running..."); + console.error("🔌 Claude can now access Zereus zAI market intelligence"); + } catch (err) { + console.error("❌ Failed to start MCP server:", err); + console.error("Stack trace:", err.stack); + process.exit(1); + } +} + +// Add process error handlers +process.on('uncaughtException', (err) => { + console.error('Uncaught exception:', err); + console.error(err.stack); +}); + +process.on('unhandledRejection', (reason, promise) => { + console.error('Unhandled Rejection at:', promise, 'reason:', reason); +}); + +main(); \ No newline at end of file diff --git a/zereus-mcp/tsconfig.json b/zereus-mcp/tsconfig.json new file mode 100644 index 0000000..5589fbb --- /dev/null +++ b/zereus-mcp/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "./build", + "strict": false, + "esModuleInterop": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "noImplicitAny": false + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "build"] + } \ No newline at end of file