ZAI MCP Server

Web search, content fetching, and AI-powered summarization using GLM-4.7-Flash.

README.md

ZAI MCP Server

A Model Context Protocol (MCP) server that provides web search, content fetching, and AI-powered summarization capabilities using ZAI's GLM-4.7-Flash model.

Features

  • Web Search: Search the web using DuckDuckGo
  • Content Fetching: Clean and extract text from any website
  • AI Summarization: Summarize web content using GLM-4.7-Flash
  • Combined Workflows: Search, fetch, and summarize in one operation
  • Fast & Efficient: Uses flash model for quick responses

Tools

`search_web`

Search the web for information.

Parameters:

  • query (string, required): Search query
  • num_results (number, optional): Number of results (1-10, default: 5)

Returns:

{
  "query": "search term",
  "count": 5,
  "results": [
    {
      "title": "Result Title",
      "url": "https://example.com",
      "snippet": "Brief snippet of the content..."
    }
  ]
}

`fetch_and_summarize`

Fetch a website URL and summarize its content.

Parameters:

  • url (string, required): Website URL to fetch
  • max_content_length (number, optional): Max content length to process (default: 10000)

Returns:

{
  "url": "https://example.com/article",
  "title": "Article Title",
  "summary": "AI-generated summary of the content...",
  "content_length": 5000
}

`search_and_summarize`

Search the web, fetch the top result, and summarize it.

Parameters:

  • query (string, required): Search query
  • result_index (number, optional): Which search result to fetch (1-10, default: 1)

Returns:

{
  "query": "search term",
  "result_index": 1,
  "url": "https://example.com/article",
  "title": "Article Title",
  "summary": "AI-generated summary...",
  "total_results": 10
}

Installation

Prerequisites

Install from source

# Clone the repository
git clone https://github.com/yourusername/zai-mcp-server.git
cd zai-mcp-server

# Install dependencies
pip install -r requirements.txt

# Make server executable
chmod +x src/server.py

Quick Start

# Set your API key
export ZAI_API_KEY="your-zai-api-key"

# Run the server
python src/server.py

Configuration

Environment Variables

Variable Description Required Default
ZAI_API_KEY Your ZAI API key Yes -

API Configuration

The server uses the following ZAI API configuration:

  • Base URL: https://api.z.ai/api/paas/v4
  • Model: glm-4.7-flash
  • Max Tokens: 1000
  • Temperature: 0.7

Usage

Standalone Testing

# Test initialization
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}}' | python src/server.py

# List available tools
echo '{"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {}}' | python src/server.py

# Search the web
echo '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "search_web", "arguments": {"query": "AI news", "num_results": 3}}}' | python src/server.py

Integration with Claude Desktop

Add to Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "zai": {
      "command": "python3",
      "args": ["/absolute/path/to/zai-mcp-server/src/server.py"],
      "env": {
        "ZAI_API_KEY": "your-zai-api-key"
      }
    }
  }
}

Integration with Cursor

Add to Cursor settings file (~/.cursor/mcp_config.json):

{
  "mcpServers": {
    "zai": {
      "command": "python3",
      "args": ["/absolute/path/to/zai-mcp-server/src/server.py"],
      "env": {
        "ZAI_API_KEY": "your-zai-api-key"
      }
    }
  }
}

Integration with Cline (VS Code)

Add to your MCP settings in VS Code:

{
  "mcpServers": [
    {
      "name": "zai",
      "command": "python3",
      "args": ["/absolute/path/to/zai-mcp-server/src/server.py"],
      "env": {
        "ZAI_API_KEY": "${env:ZAI_API_KEY}"
      }
    }
  ]
}

Integration with Continue

Add to ~/.continue/config.json:

{
  "mcpServers": {
    "zai": {
      "command": "python3",
      "args": ["/absolute/path/to/zai-mcp-server/src/server.py"],
      "env": {
        "ZAI_API_KEY": "your-zai-api-key"
      }
    }
  }
}

Integration with Roo Code

Add to Roo Code's MCP configuration:

{
  "mcpServers": {
    "zai": {
      "command": "python3",
      "args": ["/absolute/path/to/zai-mcp-server/src/server.py"],
      "env": {
        "ZAI_API_KEY": "your-zai-api-key"
      }
    }
  }
}

OpenCode Native Integration

Setup

OpenCode supports MCP servers natively. To configure:

  1. Create/Update the MCP configuration file:
    # Default location: ~/.config/opencode/m
    

Tools 3

search_webSearch the web for information.
fetch_and_summarizeFetch a website URL and summarize its content.
search_and_summarizeSearch the web, fetch the top result, and summarize it.

Environment Variables

ZAI_API_KEYrequiredYour ZAI API key

Try it

Search the web for the latest developments in AI technology.
Fetch the content from https://example.com and provide a concise summary.
Search for 'current state of quantum computing' and summarize the top result.
Find recent news about climate change and summarize the most relevant article.

Frequently Asked Questions

What are the key features of ZAI MCP Server?

Web search integration using DuckDuckGo. Clean text extraction from any website URL. AI-powered content summarization using GLM-4.7-Flash. Combined search, fetch, and summarize workflows.

What can I use ZAI MCP Server for?

Quickly gathering and summarizing research from multiple web sources.. Extracting clean text from cluttered websites for easier reading.. Automating the process of finding and summarizing news articles on specific topics..

How do I install ZAI MCP Server?

Install ZAI MCP Server by running: git clone https://github.com/yourusername/zai-mcp-server.git && cd zai-mcp-server && pip install -r requirements.txt && chmod +x src/server.py

What MCP clients work with ZAI MCP Server?

ZAI MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep ZAI MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare