Skip to main content
Glama

NIX MCP Server - Simplified Version

A simplified MCP (Model Context Protocol) server for querying NIX blockchain data using JSON and ABI, without protobuf dependencies.

Features

  • Simple JSON-based queries - No protobuf compilation required

  • Dynamic ABI discovery - Automatically fetches available queries from contracts

  • Automatic ABI caching - Caches ABIs from cdev environment on startup

  • Environment switching - Query different environments (dev, uat, prod, etc.)

  • JSON file support - Pass query parameters via JSON files

  • Three core tools:

    • list_queries - List all available queries from contract ABI

    • get_query_abi - Get query structure with JSON examples

    • query - Execute queries with JSON parameters

Prerequisites

  • Python 3.11+

  • cleos command-line tool (for blockchain queries)

  • Access to Rodeos and Nodeos endpoints

Quick Start

1. Clone and Initialize

# Clone the repository
git clone <repository-url>
cd nix-mcp

# Run initialization script (installs uv and dependencies)
./init.sh

# Or manually with uv
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync

2. Configure

# Copy environment template
cp .env.example .env

# Edit .env with your endpoints:
# RODEOS_API=http://your-rodeos-endpoint:8880
# NODEOS_API=http://your-nodeos-endpoint:8888

3. Run the Server

# Using make
make run

# Or directly
uv run python main.py

# Or with the run script
./run.sh

Available Tools

1. List Queries

Lists all available query actions from the contract ABI.

{
  "tool": "list_queries",
  "params": {
    "contract": "nix.q",
    "filter_pattern": "global",
    "environment": "dev"
  }
}

2. Get Query ABI

Returns the structure and JSON template for a specific query.

{
  "tool": "get_query_abi",
  "params": {
    "query_name": "globalconfn",
    "contract": "nix.q",
    "include_example": true,
    "environment": "dev"
  }
}

3. Execute Query

Executes a NIX query with JSON parameters.

{
  "tool": "query",
  "params": {
    "action": "globalconfn",
    "params": {
      "blockchain": "ETH",
      "network": "testnet"
    },
    "contract": "nix.q",
    "environment": "dev"
  }
}

Environment Support

The MCP server now supports dynamic environment switching without restarting. You can specify the target environment for each query:

Available Environments

  • dev - Development environment (default)

  • uat - User Acceptance Testing

  • cdev - Custody Development

  • perf - Performance testing

  • perf2 - Secondary performance testing

  • simnext - Simulation/Next environment

  • prod - Production environment

  • local - Local development

  • snapshot - Snapshot environment

Example: Query Different Environments

# Query SOL mainnet configuration from production
result = await client.query(
    contract="nix.q",
    action="globalconfn",
    params={
        "blockchain": "SOL",
        "network": "mainnet"
    },
    environment="prod"  # Specify production environment
)

# List queries available in UAT
queries = await list_queries(
    contract="nix.q",
    environment="uat"
)

Usage Examples

Python Client

from nix_mcp import SimpleNixClient
import asyncio

async def example():
    # Create client for specific environment
    client = SimpleNixClient(environment="prod")
    
    # Query all global configs
    result = await client.query(
        contract="nix.q",
        action="globalconfs",
        params={}
    )
    print(result)
    
    # Query specific network
    result = await client.query(
        contract="nix.q",
        action="globalconfn",
        params={
            "blockchain": "ETH",
            "network": "testnet"
        }
    )
    print(result)

    # Create client for different environment
    dev_client = SimpleNixClient(environment="dev")
    dev_result = await dev_client.query(
        contract="nix.q",
        action="globalconfs",
        params={}
    )
    print(f"Dev environment result: {dev_result}")

asyncio.run(example())

Discover Available Queries

from nix_mcp import ABIFetcher

fetcher = ABIFetcher()
actions = fetcher.get_actions("nix.q")
print(f"Available queries: {actions}")

Testing

# Run basic tests
uv run python test_simple.py

# Test environment switching
uv run python test_env_switching.py

# Test the complete expected flow
uv run python test_expected_flow.py

Claude Desktop Integration

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "nix-mcp": {
      "command": "uv",
      "args": ["run", "python", "/full/path/to/nix-mcp/main.py"]
    }
  }
}

Project Structure

nix-mcp/
├── src/nix_mcp/
│   ├── simple_client.py    # Core client using cleos
│   ├── abi_fetcher.py       # ABI fetching and parsing
│   ├── tools.py             # MCP tool handlers
│   ├── server_fastmcp.py    # FastMCP server
│   └── json_templates.py    # Query templates
├── main.py                  # Entry point
├── test_simple.py           # Test script
├── .env.example             # Environment template
└── README.md                # This file

Environment Variables

  • NODEOS_ENV - Default environment to use when not specified (dev, uat, cdev, prod, etc.)

  • RODEOS_API - Override Rodeos endpoint for all environments

  • NODEOS_API - Override Nodeos endpoint for all environments

  • CLEOS_PATH - Path to cleos binary (optional if in PATH)

You can also set environment-specific overrides:

  • RODEOS_API_DEV, RODEOS_API_UAT, RODEOS_API_PROD, etc.

  • NODEOS_API_DEV, NODEOS_API_UAT, NODEOS_API_PROD, etc.

Transaction Query Example

Here's a complete example of querying a raw transaction as described in the expected flow:

Step 1: Find the appropriate query

# List all available queries
result = await list_queries(
    contract="nix.q",
    filter_pattern="raw",  # Filter for transaction-related queries
    environment="cdev"
)
# This will show queries like: rawtrxspb, rawtransaction, etc.

Step 2: Get the query ABI structure

# Get the ABI for rawtrxspb query
result = await get_query_abi(
    query_name="rawtrxspb",
    contract="nix.q",
    environment="cdev"
)
# Shows the expected input structure

Step 3: Execute the query

# Query for ETH mainnet transaction in cdev
result = await query(
    action="rawtrxspb",
    params={
        "network": {
            "blockchain": "ETH",
            "network": "mainnet"
        },
        "transaction_identifier": {
            "hash": "0abe152ba84b35026451d68a55310ec58450a167a82a55fae2ff691ebc7236bf"
        }
    },
    contract="nix.q",
    environment="cdev"
)

Or using a JSON file:

# Using pre-built JSON file
result = await query(
    action="rawtrxspb",
    params="examples/raw_transaction_query.json",
    contract="nix.q",
    environment="cdev"
)

The actual cleos command executed:

cleos -u $RODEOS_API push action --use-old-send-rpc --return-failure-trace 0 nix.q rawtrxspb '{"network":{"blockchain":"ETH","network":"mainnet"},"transaction_identifier":{"hash":"0abe152ba84b35026451d68a55310ec58450a167a82a55fae2ff691ebc7236bf"}}' -sj

Common Query Templates

Example JSON files in examples/ directory:

  • raw_transaction_query.json - Query raw transaction details

  • global_config_query.json - Query global configuration for a network

  • network_status_query.json - Query network status

Additional query types:

  • Global configurations (globalconfs, globalconfn)

  • Network status (nwstatus)

  • Account queries (accounts, balances)

  • Block queries (blocks)

  • Transaction queries (transaction, transactions, rawtrxspb)

Troubleshooting

cleos not found

Ensure cleos is installed and in your PATH, or set CLEOS_PATH in .env

Connection errors

Verify your RODEOS_API and NODEOS_API endpoints are accessible

Import errors

Run uv sync to ensure all dependencies are installed

License

[Your License]

Available Tools

3 tools
get_query_abiB

Get ABI structure and JSON template for a specific query

ParametersJSON Schema
NameRequiredDescriptionDefault
query_nameYesName of the query action
contractNoContract namenix.q
include_exampleNoInclude JSON example
environmentNoEnvironment (dev, uat, cdev, perf, simnext, prod, local)dev

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves information ('Get'), implying a read-only operation, but doesn't disclose other traits like authentication needs, rate limits, error handling, or what the output contains beyond 'ABI structure and JSON template.' For a tool with no annotations, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Get ABI structure and JSON template for a specific query.' It is front-loaded with the core purpose, has zero wasted words, and is appropriately sized for the tool's complexity. Every part of the sentence earns its place by conveying essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 parameters, 1 required), 100% schema coverage, and the presence of an output schema, the description is minimally adequate. It covers the purpose but lacks usage guidelines and behavioral details. The output schema likely explains return values, so the description doesn't need to detail them, but overall completeness is limited to the basic function.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so the schema already documents all parameters (query_name, contract, include_example, environment) with details like defaults and allowed values. The description adds no additional meaning beyond what the schema provides, such as explaining parameter interactions or usage examples. With high schema coverage, the baseline is 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get ABI structure and JSON template for a specific query.' It specifies the verb ('Get') and resource ('ABI structure and JSON template'), distinguishing it from sibling tools like 'list_queries' (which lists queries) and 'query' (which likely executes queries). However, it doesn't explicitly differentiate from siblings beyond the inherent action, so it's not a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, compare to sibling tools like 'list_queries' or 'query', or specify scenarios where this tool is appropriate. Usage is implied by the purpose but lacks explicit context or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_queriesB

List all available NIX query actions from the contract ABI

ParametersJSON Schema
NameRequiredDescriptionDefault
contractNoContract to list queries fromnix.q
filter_patternNoOptional filter pattern for query names
environmentNoEnvironment (dev, uat, cdev, perf, simnext, prod, local)dev

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It only states what the tool does ('List all available...') without mentioning any behavioral traits like whether it's read-only, has side effects, requires authentication, has rate limits, or describes the return format. This is inadequate for a tool with parameters and potential complexity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there's an output schema (which handles return values) and 100% schema coverage for parameters, the description's minimal approach is somewhat acceptable. However, for a tool with no annotations and sibling tools, it lacks context about behavioral traits and usage differentiation, making it incomplete for optimal agent guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already fully documents all three parameters. The description adds no additional meaning about parameters beyond what's in the schema, such as explaining how the filter pattern works or when to override defaults. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all available') and resource ('NIX query actions from the contract ABI'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_query_abi' or 'query', which would be needed for a score of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_query_abi' or 'query'. It doesn't mention prerequisites, exclusions, or comparative contexts, leaving the agent with no usage direction beyond the basic purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

queryC

Execute a NIX query with JSON parameters

ParametersJSON Schema
NameRequiredDescriptionDefault
actionYesQuery action name
paramsNoJSON parameters for the query
contractNoContract namenix.q
environmentNoEnvironment (dev, uat, cdev, perf, simnext, prod, local)dev

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions execution with JSON parameters but doesn't describe what the tool does behaviorally—whether it's read-only or mutative, what permissions are needed, what happens on success/failure, or any rate limits. This leaves significant gaps for a tool that appears to execute queries.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which reduces the need to describe return values) and 100% schema coverage, the description is somewhat complete. However, for a query execution tool with no annotations, it lacks critical behavioral context like safety, permissions, or error handling, making it minimally adequate but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional meaning beyond implying JSON parameters are used, which is already covered in the schema. This meets the baseline for high schema coverage without adding value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'Execute[s] a NIX query with JSON parameters', which provides a basic verb+resource combination. However, it doesn't specify what a 'NIX query' is or how it differs from the sibling tools 'get_query_abi' and 'list_queries', leaving the purpose somewhat vague and undifferentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus the sibling tools 'get_query_abi' or 'list_queries'. There's no mention of prerequisites, alternatives, or specific contexts for execution, leaving the agent with no usage direction beyond the basic purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 3 tool updates
    • First observedget_query_abi
    • First observedlist_queries
    • First observedquery

TDQS

B3.4/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: get_query_abi retrieves ABI structure, list_queries enumerates available queries, and query executes a query. There is no overlap in functionality, making tool selection straightforward for an agent.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (get_query_abi, list_queries, query) with clear and predictable naming. The verb styles are uniform and readable throughout the set.

Tool Count4/5

With 3 tools, the count is appropriate for the server's purpose of interacting with NIX queries, covering essential operations. It is slightly lean but reasonable, as it includes listing, describing, and executing queries without unnecessary bloat.

Completeness4/5

The tool set provides core CRUD-like coverage for query operations: list_queries for discovery, get_query_abi for details, and query for execution. A minor gap exists in lacking update or delete operations, but these may not be needed for read-only query workflows.

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/haiqiubullish/nix-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server