### Setup Environment Variables (Bash) Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/flash-arb-system/README.md Copies the example environment file and instructs the user to edit it with their specific API keys and wallet information. This is a crucial first step before building or running any components. ```bash cp .env.example .env # Edit .env with your Helius API keys and wallet key ``` -------------------------------- ### Run AI Link MCP Server with Node.js Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/GEMINI.md Starts the AI Link MCP Server, which includes both the MCP (stdio) interface and the REST API on port 3000. Requires Node.js to be installed. ```bash node index.js ``` -------------------------------- ### Install Dependencies with npm Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/GEMINI.md Installs all necessary project dependencies using npm. This is a standard step before running or developing Node.js applications. ```bash npm install ``` -------------------------------- ### Initialize Data Connect SDK Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Initializes the Data Connect SDK using the provided connector configuration. Supports both CommonJS and ESM import styles. This is the basic setup required to interact with the connector. ```typescript import { getDataConnect } from 'firebase/data-connect'; import { connectorConfig } from '@dataconnect/generated'; const dataConnect = getDataConnect(connectorConfig); ``` -------------------------------- ### Project Cross-Reference Tools: List, Structure, Read, and Search Projects (JavaScript) Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt This section details how to use the MCP client to interact with registered external project codebases. It includes functions to list all projects, get the directory structure of a project, read the content of a specific file, and search for code patterns across projects. These tools are designed for AI agents to understand and interact with other systems. ```javascript // List all registered projects const projectsList = await mcpClient.callTool({ name: 'list_projects', arguments: {} }); // Get project directory structure const structure = await mcpClient.callTool({ name: 'get_project_structure', arguments: { projectName: 'drift-sdk', relativePath: 'src', depth: 3 } }); // Read specific file from registered project const fileContent = await mcpClient.callTool({ name: 'read_project_file', arguments: { projectName: 'drift-sdk', filePath: 'src/DriftClient.ts' } }); // Search for code patterns across project const searchResults = await mcpClient.callTool({ name: 'search_project', arguments: { projectName: 'drift-sdk', query: 'openPosition', filePattern: '*.ts' } }); ``` -------------------------------- ### Get ListStrategies Query Reference and Execute (TypeScript) Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Explains how to obtain a QueryRef for the ListStrategies query and then execute it using `executeQuery`. This approach provides more control by first getting a reference to the query before execution. It also covers using a DataConnect instance and the Promise API. ```typescript import { getDataConnect, executeQuery } from 'firebase/data-connect'; import { connectorConfig, listStrategiesRef } from '@dataconnect/generated'; // Call the `listStrategiesRef()` function to get a reference to the query. const ref = listStrategiesRef(); // You can also pass in a `DataConnect` instance to the `QueryRef` function. const dataConnect = getDataConnect(connectorConfig); const ref = listStrategiesRef(dataConnect); // Call `executeQuery()` on the reference to execute the query. // You can use the `await` keyword to wait for the promise to resolve. const { data } = await executeQuery(ref); console.log(data.strategies); // Or, you can use the `Promise` API. executeQuery(ref).then((response) => { const data = response.data; console.log(data.strategies); }); ``` -------------------------------- ### Drift Protocol Integration: Get Market Summary and User Data (JavaScript) Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt This snippet demonstrates how to interact with the Drift Protocol using the MCP client to fetch market summaries for perpetual futures markets and retrieve detailed user account information, including positions and collateral. It requires the MCP client to be initialized and configured. ```javascript const marketResult = await mcpClient.callTool({ name: 'drift_get_market_summary', arguments: { symbol: 'SOL-PERP' } }); const userResult = await mcpClient.callTool({ name: 'drift_get_user', arguments: { userPublicKey: 'GzC5MxRPzPT8QqVvP5C7TY9wr7FxRmrVf4HnqJ3aXYqM' } }); ``` -------------------------------- ### Get All Tasks API Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt Retrieves a list of all tasks managed by the AI Link API Server. Requires an API key for authentication. ```APIDOC ## GET /api/tasks ### Description Retrieves a list of all tasks managed by the AI Link API Server. ### Method GET ### Endpoint /api/tasks ### Parameters #### Header Parameters - **x-api-key** (string) - Required - The API key for authentication. ### Request Example ```bash curl -H "x-api-key: ai-link-secure-key" http://localhost:3000/api/tasks ``` ### Response #### Success Response (200) - **count** (integer) - The total number of tasks. - **tasks** (array) - An array of task objects. #### Response Example ```json { "count": 5, "tasks": [ // ... task objects ... ] } ``` ``` -------------------------------- ### Get GetPortfolioSnapshots Query Reference and Execute (TypeScript) Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Illustrates obtaining a QueryRef for the GetPortfolioSnapshots query and executing it via `executeQuery`. This method offers more granular control over the query lifecycle. Usage with a DataConnect instance and the Promise API are also covered. ```typescript import { getDataConnect, executeQuery } from 'firebase/data-connect'; import { connectorConfig, getPortfolioSnapshotsRef } from '@dataconnect/generated'; // Call the `getPortfolioSnapshotsRef()` function to get a reference to the query. const ref = getPortfolioSnapshotsRef(); // You can also pass in a `DataConnect` instance to the `QueryRef` function. const dataConnect = getDataConnect(connectorConfig); const ref = getPortfolioSnapshotsRef(dataConnect); // Call `executeQuery()` on the reference to execute the query. // You can use the `await` keyword to wait for the promise to resolve. const { data } = await executeQuery(ref); console.log(data.portfolioSnapshots); // Or, you can use the `Promise` API. executeQuery(ref).then((response) => { const data = response.data; console.log(data.portfolioSnapshots); }); ``` -------------------------------- ### UpdateStrategy Mutation Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Details on how to execute the `UpdateStrategy` mutation, including variable types, return values, and examples. ```APIDOC ## UpdateStrategy Mutation ### Description Updates an existing strategy with provided details. ### Method POST ### Endpoint `/updateStrategy` (This is an inferred endpoint based on the mutation name) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **id** (UUIDString) - Required - The unique identifier of the strategy to update. - **status** (string) - Required - The new status to set for the strategy. ### Request Example ```json { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "status": "active" } ``` ### Response #### Success Response (200) - **strategy_update** (object | null) - Contains the result of the strategy update, potentially including the updated strategy details or a key. #### Response Example ```json { "data": { "strategy_update": { // Details of the updated strategy or a key identifier } } } ``` ``` -------------------------------- ### Execute Flipside Crypto SQL Queries with JavaScript Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt This function allows users to run SQL queries against the Flipside Crypto data warehouse. Currently in stub mode, it validates SQL syntax but does not execute queries, returning an informational message. Once the SDK is installed and configured (requiring FLIPSIDE_API_KEY), it will return actual query results including transaction counts and fees. ```javascript // Execute SQL query on Flipside data const flipsideResult = await mcpClient.callTool({ name: 'flipside_query', arguments: { sql: ` SELECT DATE_TRUNC('day', block_timestamp) as date, COUNT(*) as transaction_count, SUM(fee) as total_fees FROM solana.core.fact_transactions WHERE block_timestamp >= CURRENT_DATE - 7 GROUP BY date ORDER BY date DESC ` } }); // Response format (stub mode): // { // content: [{ // type: 'text', // text: JSON.stringify([ // { // info: "Flipside SDK missing. SQL checked but not executed.", // sql_preview: "SELECT DATE_TRUNC('day'..." // } // ], null, 2) // }] // } // Note: Requires FLIPSIDE_API_KEY environment variable // When SDK is properly installed, returns actual query results: // [ // { date: '2025-12-22', transaction_count: 1234567, total_fees: 45.67 }, // { date: '2025-12-21', transaction_count: 1123456, total_fees: 43.21 }, // ... // ] ``` -------------------------------- ### Execute UpdateStrategy Mutation with TypeScript Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Provides examples for executing the `UpdateStrategy` mutation using the `updateStrategy` action shortcut function. It covers passing variables, using a `DataConnect` instance, and handling the returned promise. Dependencies include `firebase/data-connect` and `@dataconnect/generated`. ```typescript import { getDataConnect } from 'firebase/data-connect'; import { connectorConfig, updateStrategy, UpdateStrategyVariables } from '@dataconnect/generated'; // The `UpdateStrategy` mutation requires an argument of type `UpdateStrategyVariables`: const updateStrategyVars: UpdateStrategyVariables = { id: ..., status: ..., }; // Call the `updateStrategy()` function to execute the mutation. // You can use the `await` keyword to wait for the promise to resolve. const { data } = await updateStrategy(updateStrategyVars); // Variables can be defined inline as well. const { data } = await updateStrategy({ id: ..., status: ..., }); // You can also pass in a `DataConnect` instance to the action shortcut function. const dataConnect = getDataConnect(connectorConfig); const { data } = await updateStrategy(dataConnect, updateStrategyVars); console.log(data.strategy_update); // Or, you can use the `Promise` API. updateStrategy(updateStrategyVars).then((response) => { const data = response.data; console.log(data.strategy_update); }); ``` -------------------------------- ### Run AI Link MCP Server in Watch Mode Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/GEMINI.md Starts the AI Link MCP Server in watch mode using Node.js's built-in watch functionality. This automatically restarts the server when file changes are detected, speeding up development. ```bash npm run dev ``` -------------------------------- ### Manage SQLite Database with JavaScript Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt This snippet demonstrates direct access to an SQLite database using provided JavaScript functions. It covers database initialization, AI agent registration and retrieval, message handling (sending, receiving, marking as read), task management, and context storage with expiration. The database supports concurrent access via WAL mode. ```javascript import { initDatabase, registerAI, getAI, getAllAIs, saveMessage, getMessages, markMessagesRead, saveTask, getTask, getAllTasks, saveContext, getContext, deleteContext } from './database.js'; // Initialize database with WAL mode for concurrent access await initDatabase(); // Register an agent programmatically await registerAI({ aiId: 'custom-agent-42', name: 'Custom Analysis Agent', capabilities: ['analysis', 'reporting'], metadata: { version: '2.0', team: 'research' }, registeredAt: new Date().toISOString() }); // Query specific agent const agent = await getAI('custom-agent-42'); console.log(agent); // { aiId: 'custom-agent-42', name: 'Custom Analysis Agent', capabilities: [...], ... } // Save message directly await saveMessage({ fromAiId: 'system', toAiId: 'custom-agent-42', message: 'System maintenance scheduled for 02:00 UTC', messageType: 'notification', metadata: { priority: 'low', category: 'system' }, timestamp: new Date().toISOString(), read: false }); // Get unread messages const unreadMessages = await getMessages('custom-agent-42', true); console.log(`${unreadMessages.length} unread messages`); // Mark all messages as read await markMessagesRead('custom-agent-42'); // Save context with expiration await saveContext({ contextId: 'session-data-xyz', data: { sessionStart: Date.now(), userPreferences: {} }, authorizedAiIds: ['custom-agent-42', 'master-1'], createdAt: new Date().toISOString(), expiresAt: new Date(Date.now() + 3600000).toISOString() // 1 hour }); // Retrieve and delete expired context const ctx = await getContext('session-data-xyz'); if (ctx && new Date() > new Date(ctx.expiresAt)) { await deleteContext('session-data-xyz'); } ``` -------------------------------- ### Get Messages for Specific Agent API Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt Retrieves messages associated with a specific agent. Requires an API key for authentication. ```APIDOC ## GET /api/messages ### Description Retrieves messages associated with a specific agent. ### Method GET ### Endpoint /api/messages ### Parameters #### Query Parameters - **aiId** (string) - Required - The ID of the agent whose messages are to be retrieved. #### Header Parameters - **x-api-key** (string) - Required - The API key for authentication. ### Request Example ```bash curl -H "x-api-key: ai-link-secure-key" "http://localhost:3000/api/messages?aiId=oracle-1" ``` ### Response #### Success Response (200) - **count** (integer) - The total number of messages. - **messages** (array) - An array of message objects. #### Response Example ```json { "count": 12, "messages": [ // ... message objects ... ] } ``` ``` -------------------------------- ### Execute ListStrategies Query using Action Shortcut (TypeScript) Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Demonstrates how to execute the ListStrategies query using its action shortcut function. This method simplifies query execution by directly calling a function that returns a promise. It shows usage with and without a pre-configured DataConnect instance, and also illustrates the Promise API. ```typescript import { getDataConnect } from 'firebase/data-connect'; import { connectorConfig, listStrategies } from '@dataconnect/generated'; // Call the `listStrategies()` function to execute the query. // You can use the `await` keyword to wait for the promise to resolve. const { data } = await listStrategies(); // You can also pass in a `DataConnect` instance to the action shortcut function. const dataConnect = getDataConnect(connectorConfig); const { data } = await listStrategies(dataConnect); console.log(data.strategies); // Or, you can use the `Promise` API. listStrategies().then((response) => { const data = response.data; console.log(data.strategies); }); ``` -------------------------------- ### Execute GetPortfolioSnapshots Query using Action Shortcut (TypeScript) Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Shows how to execute the GetPortfolioSnapshots query using its action shortcut function. Similar to ListStrategies, this simplifies direct query execution and supports passing a DataConnect instance. The Promise API usage is also demonstrated. ```typescript import { getDataConnect } from 'firebase/data-connect'; import { connectorConfig, getPortfolioSnapshots } from '@dataconnect/generated'; // Call the `getPortfolioSnapshots()` function to execute the query. // You can use the `await` keyword to wait for the promise to resolve. const { data } = await getPortfolioSnapshots(); // You can also pass in a `DataConnect` instance to the action shortcut function. const dataConnect = getDataConnect(connectorConfig); const { data } = await getPortfolioSnapshots(dataConnect); console.log(data.portfolioSnapshots); // Or, you can use the `Promise` API. getPortfolioSnapshots().then((response) => { const data = response.data; console.log(data.portfolioSnapshots); }); ``` -------------------------------- ### Execute CreateUser Mutation with TypeScript Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Demonstrates how to execute the `CreateUser` mutation using `MutationRef` and `executeMutation` functions. It shows both async/await and Promise API usage. Dependencies include `firebase/data-connect` and `@dataconnect/generated`. ```typescript import { getDataConnect, executeMutation } from 'firebase/data-connect'; import { connectorConfig, createUserRef } from '@dataconnect/generated'; // Call the `createUserRef()` function to get a reference to the mutation. const ref = createUserRef(); // You can also pass in a `DataConnect` instance to the `MutationRef` function. const dataConnect = getDataConnect(connectorConfig); const ref = createUserRef(dataConnect); // Call `executeMutation()` on the reference to execute the mutation. // You can use the `await` keyword to wait for the promise to resolve. const { data } = await executeMutation(ref); console.log(data.user_insert); // Or, you can use the `Promise` API. executeMutation(ref).then((response) => { const data = response.data; console.log(data.user_insert); }); ``` -------------------------------- ### Get UpdateStrategy Operation Name with TypeScript Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Shows how to retrieve the operation name for the `UpdateStrategy` mutation directly from its reference without executing it. This is useful for debugging or dynamic operation handling. Dependencies include `@dataconnect/generated`. ```typescript import { updateStrategyRef } from '@dataconnect/generated'; const name = updateStrategyRef.operationName; console.log(name); ``` -------------------------------- ### Deploy Flash Loan Executor (Anchor CLI) Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/flash-arb-system/README.md Builds and deploys the Anchor program for the flash loan executor to the Solana devnet. This program is central to executing the flash loan arbitrage strategy. ```bash cd flash-loan-executor anchor build anchor deploy --provider.cluster devnet ``` -------------------------------- ### Execute CreateUser Mutation using Action Shortcut Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Illustrates executing the `CreateUser` mutation using its generated action shortcut function. It covers calling the function directly, passing a `DataConnect` instance, and handling the returned promise. Dependencies include `firebase/data-connect` and `@dataconnect/generated`. ```typescript import { getDataConnect } from 'firebase/data-connect'; import { connectorConfig, createUser } from '@dataconnect/generated'; // Call the `createUser()` function to execute the mutation. // You can use the `await` keyword to wait for the promise to resolve. const { data } = await createUser(); // You can also pass in a `DataConnect` instance to the action shortcut function. const dataConnect = getDataConnect(connectorConfig); const { data } = await createUser(dataConnect); console.log(data.user_insert); // Or, you can use the `Promise` API. createUser().then((response) => { const data = response.data; console.log(data.user_insert); }); ``` -------------------------------- ### Execute ListStrategies Query Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Demonstrates how to execute the 'ListStrategies' query using the generated SDK. It shows the usage of an action shortcut function and how to retrieve the operation name. The 'ListStrategies' query does not accept any variables. ```typescript import { listStrategies, listStrategiesRef } from '@dataconnect/generated'; // Using action shortcut function listStrategies().then(result => { console.log(result); }); // Using QueryRef function // const queryRef = listStrategiesRef(); // executeQuery(queryRef).then(result => { // console.log(result); // }); // Retrieving operation name const name = listStrategiesRef.operationName; console.log(name); ``` -------------------------------- ### CreateUser Mutation Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md This section details how to use the `CreateUser` mutation, including obtaining a reference and executing it. ```APIDOC ## CreateUser Mutation ### Description Allows for the creation of a new user. ### Method POST ### Endpoint `/createUser` (This is an inferred endpoint based on the mutation name) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body This mutation likely accepts parameters for user creation, but they are not explicitly detailed in the provided text. Refer to `@dataconnect/generated` for `CreateUser` mutation arguments. ### Request Example ```json // Example assuming standard mutation execution { "query": "mutation CreateUser($variables: CreateUserInput!) { createUser(input: $variables) { ... } }", "variables": { "variables": { // User creation fields go here } } } ``` ### Response #### Success Response (200) - **data** (object) - Contains the result of the user creation, likely including inserted user details. #### Response Example ```json { "data": { "user_insert": { // User details returned upon successful creation } } } ``` ``` -------------------------------- ### Custom Agent Framework Implementation Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt This JavaScript code defines a custom trading agent by extending the base Agent class. It includes methods for initialization, processing requests, performing market analysis, and executing trades using an internal client. Automatic message polling is handled by the base class. ```javascript import { Agent } from './agents/AgentFramework.js'; import { InternalClient } from './InternalClient.js'; class CustomTradingAgent extends Agent { constructor(config) { super({ aiId: config.aiId || 'custom-trader-1', name: config.name || 'Custom Trading Agent', capabilities: ['trading', 'technical-analysis', 'backtesting'] }); this.riskLimit = config.riskLimit || 0.02; this.strategies = config.strategies || ['momentum', 'mean-reversion']; } async initialize(client) { await super.initialize(client); // Register with the server await this.client.callTool({ name: 'register_ai', arguments: { aiId: this.aiId, name: this.name, capabilities: this.capabilities, metadata: { riskLimit: this.riskLimit, strategies: this.strategies, version: '1.0.0' } } }); console.log(`[${this.name}] Initialized and registered`); } async processRequest(request, metadata) { // Custom business logic for handling requests if (request.includes('analyze')) { return await this.performAnalysis(request); } else if (request.includes('execute')) { return await this.executeTrade(request); } return `[${this.name}] Processed: ${request}`; } async performAnalysis(request) { // Get shared market context const contextResult = await this.client.callTool({ name: 'get_shared_context', arguments: { contextId: 'latest-market-data', aiId: this.aiId } }); const marketData = JSON.parse(contextResult.content[0].text); // Perform analysis const analysis = { signal: 'LONG', confidence: 0.78, entryPrice: marketData.markets['SOL-PERP'].price, stopLoss: marketData.markets['SOL-PERP'].price * 0.95, takeProfit: marketData.markets['SOL-PERP'].price * 1.10 }; // Share analysis results await this.client.callTool({ name: 'share_context', arguments: { contextId: `analysis-${Date.now()}`, data: analysis, authorizedAiIds: ['master-1', 'drift-1'], expiresIn: 300 } }); return JSON.stringify(analysis); } async executeTrade(request) { // Submit task to execution agent const taskResult = await this.client.callTool({ name: 'submit_task', arguments: { description: `Execute trade: ${request}`, requiredCapabilities: ['trading', 'perpetuals'] } }); return `Trade task submitted: ${JSON.parse(taskResult.content[0].text).taskId}`; } } // Usage in server startup const customAgent = new CustomTradingAgent({ aiId: 'custom-trader-1', name: 'Momentum Trader', riskLimit: 0.01, strategies: ['momentum', 'breakout'] }); const internalClient = new InternalClient(serverInstance); await customAgent.initialize(internalClient); // Agent automatically polls for messages every 2 seconds via heartbeat loop ``` -------------------------------- ### Run Scanner Bot on Devnet (Rust/Cargo) Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/flash-arb-system/README.md Navigates to the scanner-bot directory and builds/runs the scanner bot in release mode on the Solana devnet. This bot is responsible for high-frequency price discovery. ```rust cd scanner-bot cargo run --release ``` -------------------------------- ### Build Release Version (Rust/Cargo) Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/flash-arb-system/README.md Compiles the Rust components of the project in release mode, optimizing for performance. This command is typically run from the project root. ```rust cargo build --release ``` -------------------------------- ### Drift Protocol API Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt Query Drift perpetual futures markets and user account data. ```APIDOC ## Drift Protocol Integration ### Description Provides endpoints to query Drift perpetual futures market summaries and user account details. ### Method POST ### Endpoint /drift #### Parameters ##### Request Body - **name** (string) - Required - The name of the Drift tool to call (e.g., `drift_get_market_summary`, `drift_get_user`). - **arguments** (object) - Required - Parameters specific to the chosen Drift tool. - **symbol** (string) - Optional - The market symbol for `drift_get_market_summary` (e.g., 'SOL-PERP'). - **userPublicKey** (string) - Optional - The public key of the user for `drift_get_user`. ### Request Example ```json { "name": "drift_get_market_summary", "arguments": { "symbol": "SOL-PERP" } } ``` ### Response #### Success Response (200) - **content** (array) - An array containing the API response. - **type** (string) - The type of content, usually 'text'. - **text** (string) - A JSON string representing the fetched data. #### Response Example ```json { "content": [ { "type": "text", "text": "{\n \"symbol\": \"SOL-PERP\",\n \"price\": \"142350000\",\n \"marketIndex\": 0\n}" } ] } ``` ``` -------------------------------- ### Project Cross-Reference Tools API Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt Access and search registered external project codebases for AI agents. ```APIDOC ## Project Cross-Reference Tools ### Description Provides tools to list, navigate, read, and search code within registered project codebases. ### Method POST ### Endpoint /projects #### Parameters ##### Request Body - **name** (string) - Required - The name of the project tool to call (e.g., `list_projects`, `get_project_structure`, `read_project_file`, `search_project`). - **arguments** (object) - Required - Parameters specific to the chosen project tool. - **projectName** (string) - Optional - The name of the project (e.g., 'drift-sdk'). Required for `get_project_structure`, `read_project_file`, `search_project`. - **relativePath** (string) - Optional - A relative path within the project for `get_project_structure`. - **depth** (integer) - Optional - The depth for directory traversal in `get_project_structure`. - **filePath** (string) - Optional - The path to the file to read in `read_project_file`. - **query** (string) - Optional - The search query for `search_project`. - **filePattern** (string) - Optional - A file pattern for `search_project` (e.g., '*.ts'). ### Request Example (List Projects) ```json { "name": "list_projects", "arguments": {} } ``` ### Response (List Projects) #### Success Response (200) - **content** (array) - **type** (string) - 'text' - **text** (string) - A JSON string mapping project names to their local paths. #### Response Example (List Projects) ```json { "content": [ { "type": "text", "text": "{\n \"drift-sdk\": \"/Users/dev/projects/drift-protocol\",\n \"flash-sdk\": \"/Users/dev/projects/flash-trade-sdk\",\n \"jupiter-api\": \"/Users/dev/projects/jupiter-aggregator\"\n}" } ] } ``` ### Request Example (Search Project) ```json { "name": "search_project", "arguments": { "projectName": "drift-sdk", "query": "openPosition", "filePattern": "*.ts" } } ``` ### Response (Search Project) #### Success Response (200) - **content** (array) - **type** (string) - 'text' - **text** (string) - A string containing search results, with each line representing a match (e.g., 'filePath:lineNumber: code snippet'). #### Response Example (Search Project) ```text src/DriftClient.ts:234: async openPosition(params: OpenPositionParams) { src/instructions/placeOrder.ts:45: // Helper for openPosition instruction test/DriftClient.test.ts:178: await client.openPosition({ ... }); ``` ``` -------------------------------- ### Solana Blockchain Interaction with MCP Client Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt Interact with the Solana blockchain using the MCP client. This includes querying the balance of a given address in lamports and SOL, retrieving detailed account information such as owner and lamport balance, and requesting airdrops of SOL to a specified address (only applicable for devnet/testnet). ```javascript await mcpClient.callTool({ name: 'solana_get_balance', arguments: { address: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK' } }); ``` ```javascript await mcpClient.callTool({ name: 'solana_get_account_info', arguments: { address: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK' } }); ``` ```javascript await mcpClient.callTool({ name: 'solana_request_airdrop', arguments: { address: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK', amount: 1.0 // SOL amount } }); ``` -------------------------------- ### Register AI Agent using MCP and REST API Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt Demonstrates how to register a new AI agent in the network. This includes registering with a unique identifier, capabilities, and metadata. It shows two methods: using the MCP client's `callTool` function and via the Express REST API. ```javascript const result = await mcpClient.callTool({ name: 'register_ai', arguments: { aiId: 'trading-bot-1', name: 'Automated Trading Bot', capabilities: ['trading', 'market-analysis', 'risk-management'], metadata: { version: '2.1.0', owner: 'team-alpha', environment: 'production' } } }); // Response: { content: [{ type: 'text', text: 'AI "Automated Trading Bot" (trading-bot-1) registered successfully.' }] } ``` ```javascript const response = await fetch('http://localhost:3000/api/register_agent', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': process.env.AI_LINK_API_KEY || 'ai-link-secure-key' }, body: JSON.stringify({ aiId: 'trading-bot-1', name: 'Automated Trading Bot', capabilities: ['trading', 'market-analysis'], metadata: { version: '2.1.0', type: 'remote' } }) }); // Response: { success: true, message: 'Agent connected to Hive Mind' } ``` -------------------------------- ### Lint Project Code Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/GEMINI.md Executes the linting process for the project's code. Linting helps maintain code quality and consistency. The specific linting tool and configuration are defined in the project's package.json. ```bash npm run lint ``` -------------------------------- ### Connect to Local Data Connect Emulator Source: https://github.com/chillax4life/ryanmolinich-ai-link-mcp-server/blob/main/src/dataconnect-generated/README.md Configures the Data Connect SDK to connect to a local emulator instance instead of the production service. This is useful for development and testing. Requires specifying the host and port of the emulator. ```typescript import { connectDataConnectEmulator, getDataConnect } from 'firebase/data-connect'; import { connectorConfig } from '@dataconnect/generated'; const dataConnect = getDataConnect(connectorConfig); connectDataConnectEmulator(dataConnect, 'localhost', 9399); ``` -------------------------------- ### Solana Blockchain Tools API Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt Tools to query Solana blockchain state and request airdrops on devnet/testnet. ```APIDOC ## Solana Blockchain Tools API ### Description Query Solana blockchain state including account balances and request devnet airdrops. ### Get Account Balance Retrieves the SOL balance of a given Solana address. #### Method POST (via `mcpClient.callTool`) #### Endpoint `solana_get_balance` #### Parameters ##### Arguments - **address** (string) - Required - The Solana address to query. ##### Request Example ```json { "name": "solana_get_balance", "arguments": { "address": "DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK" } } ``` ##### Response Example (Success) ```json { "content": [ { "type": "text", "text": "{\n \"address\": \"DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK\",\n \"balanceLamports\": 2500000000,\n \"balanceSol\": 2.5\n}" } ] } ``` --- ### Get Account Info Retrieves detailed information about a Solana account. #### Method POST (via `mcpClient.callTool`) #### Endpoint `solana_get_account_info` #### Parameters ##### Arguments - **address** (string) - Required - The Solana address to query. ##### Request Example ```json { "name": "solana_get_account_info", "arguments": { "address": "DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK" } } ``` ##### Response Example (Success) ```json { "content": [ { "type": "text", "text": "{\n \"executable\": false,\n \"owner\": \"11111111111111111111111111111111\",\n \"lamports\": 2500000000,\n \"dataSize\": 0\n}" } ] } ``` --- ### Request Airdrop Requests an airdrop of SOL to a specified address on devnet or testnet. #### Method POST (via `mcpClient.callTool`) #### Endpoint `solana_request_airdrop` #### Parameters ##### Arguments - **address** (string) - Required - The Solana address to receive the airdrop. - **amount** (number) - Required - The amount of SOL to request. ##### Request Example ```json { "name": "solana_request_airdrop", "arguments": { "address": "DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK", "amount": 1.0 } } ``` ##### Response Example (Success) ```json { "content": [ { "type": "text", "text": "Airdrop successful. Signature: 5j7s..." } ] } ``` ``` -------------------------------- ### Task Queue Management with MCP Client Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt Manage tasks within a global queue using the MCP client. This includes submitting new tasks with descriptions and required capabilities, listing pending tasks filtered by capability, claiming tasks by agents, and completing tasks with their results. The client interacts with the server to orchestrate these operations. ```javascript await mcpClient.callTool({ name: 'submit_task', arguments: { description: 'Analyze SOL market volatility and recommend position sizing', requiredCapabilities: ['market-analysis', 'risk-management'] } }); ``` ```javascript await mcpClient.callTool({ name: 'list_tasks', arguments: { status: 'pending', capability: 'market-analysis' } }); ``` ```javascript await mcpClient.callTool({ name: 'claim_task', arguments: { taskId: 'task-1703251234567-123', aiId: 'quant-1' } }); ``` ```javascript await mcpClient.callTool({ name: 'complete_task', arguments: { taskId: 'task-1703251234567-123', result: JSON.stringify({ volatility: 0.42, recommendation: 'Use 3x leverage with 15% position size', confidence: 0.87, timeframe: '4h' }) } }); ``` -------------------------------- ### Task Queue Management API Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt Manage tasks in a global queue. Agents can submit, list, claim, and complete tasks. ```APIDOC ## Task Queue Management API ### Description Manage tasks in a global queue. Agents can submit, list, claim, and complete tasks. Tasks are picked up by agents with matching capabilities. ### Submit Task Submits a new task to the global queue. #### Method POST (via `mcpClient.callTool`) #### Endpoint `submit_task` #### Parameters ##### Arguments - **description** (string) - Required - A detailed description of the task to be performed. - **requiredCapabilities** (array of strings) - Required - A list of capabilities required by agents to claim this task. ##### Request Example ```json { "name": "submit_task", "arguments": { "description": "Analyze SOL market volatility and recommend position sizing", "requiredCapabilities": ["market-analysis", "risk-management"] } } ``` ##### Response Example (Success) ```json { "content": [ { "type": "text", "text": "{\"taskId\":\"task-1703251234567-123\",\"status\":\"pending\"}" } ] } ``` --- ### List Tasks Retrieves a list of available tasks based on specified criteria. #### Method POST (via `mcpClient.callTool`) #### Endpoint `list_tasks` #### Parameters ##### Arguments - **status** (string) - Optional - Filters tasks by their status (e.g., 'pending', 'completed'). - **capability** (string) - Optional - Filters tasks by required capabilities. ##### Request Example ```json { "name": "list_tasks", "arguments": { "status": "pending", "capability": "market-analysis" } } ``` ##### Response Example (Success) ```json { "content": [ { "type": "text", "text": "{\n \"count\": 2,\n \"tasks\": [\n {\n \"taskId\": \"task-1703251234567-123\",\n \"description\": \"Analyze SOL market volatility and recommend position sizing\",\n \"requiredCapabilities\": [\"market-analysis\", \"risk-management\"],\n \"status\": \"pending\",\n \"assignedTo\": null,\n \"result\": null,\n \"createdAt\": \"2025-12-22T10:30:00.000Z\",\n \"startedAt\": null,\n \"completedAt\": null\n }\n ]\n}" } ] } ``` --- ### Claim Task Allows an agent to claim a specific task from the queue. #### Method POST (via `mcpClient.callTool`) #### Endpoint `claim_task` #### Parameters ##### Arguments - **taskId** (string) - Required - The ID of the task to claim. - **aiId** (string) - Required - The ID of the agent claiming the task. ##### Request Example ```json { "name": "claim_task", "arguments": { "taskId": "task-1703251234567-123", "aiId": "quant-1" } } ``` --- ### Complete Task Marks a task as completed and provides the result. #### Method POST (via `mcpClient.callTool`) #### Endpoint `complete_task` #### Parameters ##### Arguments - **taskId** (string) - Required - The ID of the task to complete. - **result** (string) - Required - A JSON string representing the result of the task. ##### Request Example ```json { "name": "complete_task", "arguments": { "taskId": "task-1703251234567-123", "result": "{\"volatility\": 0.42, \"recommendation\": \"Use 3x leverage with 15% position size\", \"confidence\": 0.87, \"timeframe\": \"4h\"}" } } ``` ##### Response Example (Success) ```json { "content": [ { "type": "text", "text": "Task task-1703251234567-123 completed" } ] } ``` ``` -------------------------------- ### Context Sharing API Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt Share structured data objects between agents with optional access control and expiration. ```APIDOC ## Context Sharing API ### Description Share structured data objects between agents with optional access control and expiration. This enables agents to exchange information securely and efficiently. ### Share Context Shares a structured data object with specified agents and an optional expiration time. #### Method POST (via `mcpClient.callTool`) #### Endpoint `share_context` #### Parameters ##### Arguments - **contextId** (string) - Required - A unique identifier for the context data. - **data** (object) - Required - The structured data object to share. - **authorizedAiIds** (array of strings) - Optional - A list of agent IDs authorized to access this context. - **expiresIn** (integer) - Optional - The time in seconds until the context expires. ##### Request Example ```json { "name": "share_context", "arguments": { "contextId": "market-snapshot-20251222", "data": { "timestamp": "2025-12-22T10:30:00.000Z", "markets": { "SOL-PERP": { "price": 142.35, "volume24h": 12500000, "fundingRate": 0.0015 }, "BTC-PERP": { "price": 43250.00, "volume24h": 85000000, "fundingRate": 0.0008 } }, "indicators": { "volatilityIndex": 0.42, "sentimentScore": 0.65 } }, "authorizedAiIds": ["master-1", "drift-1", "quant-1"], "expiresIn": 3600 } } ``` ##### Response Example (Success) ```json { "content": [ { "type": "text", "text": "Context market-snapshot-20251222 shared" } ] } ``` --- ### Get Shared Context Retrieves shared context data for a specified agent. #### Method POST (via `mcpClient.callTool`) #### Endpoint `get_shared_context` #### Parameters ##### Arguments - **contextId** (string) - Required - The ID of the context data to retrieve. - **aiId** (string) - Required - The ID of the agent requesting the context. ##### Request Example ```json { "name": "get_shared_context", "arguments": { "contextId": "market-snapshot-20251222", "aiId": "drift-1" } } ``` ##### Response Example (Success) ```json { "content": [ { "type": "text", "text": "{\n \"timestamp\": \"2025-12-22T10:30:00.000Z\",\n \"markets\": {\n \"SOL-PERP\": { \"price\": 142.35, \"volume24h\": 12500000, \"fundingRate\": 0.0015 },\n \"BTC-PERP\": { \"price\": 43250.00, \"volume24h\": 85000000, \"fundingRate\": 0.0008 }\n },\n \"indicators\": {\n \"volatilityIndex\": 0.42,\n \"sentimentScore\": 0.65\n }\n}" } ] } ``` #### Error Responses - **Unauthorized Access**: Throws an error if the requesting agent is not authorized. - Error Message: `"Unauthorized to access this context"` - **Expired Context**: Throws an error if the requested context has expired. - Error Message: `"Context expired"` ``` -------------------------------- ### Agent Discovery: List Connected Agents with Filtering (JavaScript) Source: https://context7.com/chillax4life/ryanmolinich-ai-link-mcp-server/llms.txt This snippet shows how to discover and list registered AI agents within the network using the MCP client. It supports listing all agents or filtering them by specific capabilities. Additionally, it demonstrates how to fetch agent information using the REST API. ```javascript // List all connected agents const agentsList = await mcpClient.callTool({ name: 'list_connected_ais', arguments: {} }); // Filter by specific capability const tradingAgents = await mcpClient.callTool({ name: 'list_connected_ais', arguments: { filterByCapability: 'trading' } }); // Using REST API to get agent list for dashboard const response = await fetch('http://localhost:3000/api/agents', { headers: { 'x-api-key': process.env.AI_LINK_API_KEY } }); const data = await response.json(); ```