open-index/open-npm huggingface dataset:
npm package: @ginkosafe/mcp
Description: A Model Context Protocol server
Latest version: 0.1.0

# Ginko MCP Server

A Model Context Protocol server for interacting with the Ginko Protocol on Solana.

This TypeScript-based MCP server provides tools to access and interact with Ginko Protocol functionality, allowing LLMs to query data and perform operations on the Solana blockchain.

## Features

### Tools
- `fetch_token_balance` - Fetch token balance for a given owner and token mint
- `place_order` - Place an order to buy or sell an asset
- `cancel_order` - Cancel an existing order
- `get_active_orders` - Get all active orders for a user
- `get_asset_balance` - Fetch balance of an asset by symbol for a given owner
- `get_asset` - Get asset information by symbol

## Development

### Installation

Install dependencies:
```bash
npm install
```

Build the server:
```bash
npm run build
```

For development with auto-rebuild:
```bash
npm run watch
```

### Configuration

Create a `.env` file based on the `.env.example` template:

```bash
cp .env.example .env
```

Configure the following environment variables:

- `SOLANA_RPC_URL`: The Solana RPC URL to connect to (required)
- `WALLET_PRIVATE_KEY`: Private key for a Solana wallet (optional)
- `SOLANA_RPC_COMMITMENT`: Commitment level for Solana RPC (optional, defaults to "confirmed")

## Installation with Claude

To use with Claude Desktop, add the server configuration to the Claude Desktop config file:

- On MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
- On Windows: `%APPDATA%/Claude/claude_desktop_config.json`

Add the following configuration to the `mcp_servers` section of the config file:

```json
{
  "mcp_servers": {
    "ginko-mcp": {
      "command": "node",
      "args": [
        "/path/to/ginko-mcp/build/index.js"
      ],
      "env": {
        "SOLANA_RPC_URL": "https://solana-mainnet.api.syndica.io/api-key/your-api-key",
        "WALLET_PRIVATE_KEY": "your-wallet-private-key"
      }
    }
  }
}
```

Replace:
- `/path/to/ginko-mcp/build/index.js` with the absolute path to the built index.js file
- `your-api-key` with your Solana RPC API key
- `your-wallet-private-key` with your Solana wallet private key

After adding the configuration, restart Claude Desktop to apply the changes.

### Testing

You can test the server locally using the MCP Inspector tool, which is available as a package script:

```bash
npm run inspector
```

The Inspector will provide a URL to access debugging tools in your browser where you can:

1. Inspect available tools
2. Test tool execution with custom parameters
3. View logs and debug messages

Example usage of `fetch_token_balance`:

```json
{
  "owner": "FriELggez3BEbiJbj4Je7qkM2nZXfkmY9G7VrA8hgLSi",
  "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "decimals": 6
}
```

### Debugging

Since MCP servers communicate over stdio, debugging can be challenging. Here are some tips:

- Use `console.error()` for logging (not `console.log()` which interferes with stdio)
- Run the server with the Inspector to see logs and requests
- Enable verbose logging by setting `DEBUG=1` in your environment