@myronkoch/andromeda-mcp-queries
Version:
Andromeda MCP Server - Queries Package: 12 read-only tools for safe Andromeda blockchain exploration and discovery
157 lines • 6.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
// Import the new modular components
const serialization_js_1 = require("./utils/serialization.js");
const server_js_1 = require("./server.js");
const tools_js_1 = require("./tools.js");
// Setup BigInt serialization
(0, serialization_js_1.setupBigIntSerialization)();
// Initialize server
const server = new index_js_1.Server({
name: 'andromeda-mcp-queries',
version: '1.0.0',
description: 'Andromeda MCP Server - Queries Package: 12 read-only tools for safe blockchain exploration'
}, {
capabilities: {
tools: {},
},
});
const andromedaServer = new server_js_1.AndromedaMCPServer();
// Initialize connection on startup
andromedaServer.initialize().catch(console.error);
// Handle tool listing
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
return { tools: tools_js_1.tools };
});
// Handle tool execution
server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
const { name, arguments: args } = request.params;
try {
switch (name) {
// Blockchain Infrastructure Queries (6 tools)
case 'get_chain_info': {
const result = await andromedaServer.getChainInfo();
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'get_block_info': {
const result = await andromedaServer.getBlockInfo(args?.height);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'get_account_info': {
const result = await andromedaServer.getAccountInfo(args?.address);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'get_account_balance': {
const result = await andromedaServer.getAccountBalance(args?.address);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'get_validators': {
const result = await andromedaServer.getValidators();
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'get_recent_transactions': {
const result = await andromedaServer.getRecentTransactions(args?.limit);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
// Contract & Code Queries (5 tools)
case 'query_ado': {
const result = await andromedaServer.queryADO(args?.contractAddress, args?.query);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'get_contract_info': {
const result = await andromedaServer.getContractInfo(args?.contractAddress);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'get_code_info': {
const result = await andromedaServer.getCodeInfo(args?.codeId);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'get_contracts': {
const result = await andromedaServer.getContracts(args?.codeId);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'get_transaction': {
const result = await andromedaServer.getTransaction(args?.txHash);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
// ADO Database Queries (3 tools)
case 'query_adodb': {
const result = await andromedaServer.queryADODB(args?.adoType, args?.startAfter);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'get_ado_code_id': {
const result = await andromedaServer.getADOCodeId(args?.adoType, args?.version);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'list_ado_versions': {
const result = await andromedaServer.listADOVersions(args?.adoType);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
// Exchange & Airdrop Status Queries (2 tools)
case 'query_cw20_sale': {
const result = await andromedaServer.queryCW20Sale(args?.exchangeAddress, args?.asset);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
case 'query_airdrop_claim': {
const result = await andromedaServer.queryAirdropClaim(args?.airdropAddress, args?.address);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
}
default:
throw new Error(`Unknown tool: ${name}`);
}
}
catch (error) {
return {
content: [
{
type: 'text',
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
},
],
isError: true,
};
}
});
// Start the server
async function main() {
const transport = new stdio_js_1.StdioServerTransport();
await server.connect(transport);
console.error('Andromeda MCP Queries Server running on stdio');
}
main().catch(console.error);
//# sourceMappingURL=index.js.map