# MCP Tools Reference

## MCP Tools Reference

The ChainGPT Claude Code plugin includes an MCP (Model Context Protocol) server that gives Claude **direct API access** to ChainGPT services. This is not code generation -- Claude actually calls the APIs in real time, returning live results within your conversation.

### Available Tools

The MCP server exposes 12 tools across 5 product categories:

#### AI Chatbot

| Tool                    | Description                                                                                              |
| ----------------------- | -------------------------------------------------------------------------------------------------------- |
| `chaingpt_chat_ask`     | Ask the Web3 AI chatbot anything -- blockchain concepts, token analysis, protocol mechanics, market data |
| `chaingpt_chat_history` | Retrieve past conversations for context continuity                                                       |

#### NFT Generator

| Tool                             | Description                                                                  |
| -------------------------------- | ---------------------------------------------------------------------------- |
| `chaingpt_nft_generate_image`    | Generate AI art from text prompts                                            |
| `chaingpt_nft_enhance_prompt`    | AI-improve your prompts for higher quality results                           |
| `chaingpt_nft_generate_and_mint` | Full pipeline: generate image, queue transaction, poll status, mint on-chain |
| `chaingpt_nft_get_chains`        | List supported blockchains for NFT minting                                   |

#### Smart Contract Tools

| Tool                         | Description                                                                                                    |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `chaingpt_audit_contract`    | Run an AI security audit on Solidity code -- detects vulnerabilities, gas issues, and best-practice violations |
| `chaingpt_generate_contract` | Generate smart contracts from natural language descriptions                                                    |

#### Crypto News

| Tool                       | Description                                                   |
| -------------------------- | ------------------------------------------------------------- |
| `chaingpt_news_fetch`      | Fetch the latest crypto news with optional category filtering |
| `chaingpt_news_categories` | List all available news categories for filtering              |

#### Account Management

| Tool                          | Description                                                  |
| ----------------------------- | ------------------------------------------------------------ |
| `chaingpt_get_credit_balance` | Check your remaining API credits                             |
| `chaingpt_estimate_cost`      | Estimate the credit cost of an operation before executing it |

### Setup

#### Plugin Install (Automatic)

If you installed the ChainGPT plugin through Claude Code's plugin system, the MCP server is configured automatically. No additional setup is needed -- the `.mcp.json` file at the plugin root handles everything.

The `.mcp.json` file uses the `${CLAUDE_PLUGIN_ROOT}` variable to resolve paths portably, so the configuration works regardless of where the plugin is installed on disk.

#### Manual Install

If you need to set up the MCP server manually:

```bash
cd mcp-server
npm install
npm run build
```

Then add the server configuration to your `.claude/settings.json`:

```json
{
  "mcpServers": {
    "chaingpt": {
      "command": "node",
      "args": ["<path-to-plugin>/mcp-server/dist/index.js"],
      "env": {
        "CHAINGPT_API_KEY": "your-api-key-here"
      }
    }
  }
}
```

### Usage Examples

Once the MCP server is running, you interact with ChainGPT services by simply asking Claude in natural language. Claude selects the appropriate tool automatically.

#### AI Chatbot

> "Ask ChainGPT what the top DeFi protocols by TVL are right now."

> "What does ChainGPT know about the latest Ethereum upgrade?"

#### NFT Generation

> "Generate an NFT image of a cyberpunk samurai in a neon city."

> "Enhance my prompt 'cool dragon' and then generate the image."

> "Mint an NFT of a galaxy whale on Polygon."

#### Smart Contracts

> "Audit this Solidity contract for vulnerabilities." *(paste your code)*

> "Generate an ERC-20 token contract with a 2% burn tax and 100M supply."

#### Crypto News

> "Fetch the latest DeFi news."

> "What news categories are available? Then get me the top Bitcoin stories."

#### Account Management

> "How many credits do I have left?"

> "How much would it cost to generate and mint an NFT?"

### How It Works

When you make a request, Claude:

1. Identifies the relevant MCP tool based on your intent
2. Calls the ChainGPT API directly through the MCP server
3. Processes the response and presents the results in your conversation
4. Can chain multiple tools together for complex workflows (e.g., estimate cost, check balance, then execute)

All API calls consume credits from your ChainGPT account. Use `chaingpt_estimate_cost` to check pricing before expensive operations, and `chaingpt_get_credit_balance` to monitor your remaining balance.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chaingpt.org/dev-docs-b2b-saas-api-and-sdk/chaingpt-claude-skill-and-plugin/features/mcp-tools-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
