GLM-4.7 MCP Server

GLM-4.7 MCP Server

A Model Context Protocol server that routes tasks to Z.ai's GLM-4.7 model, enabling Claude Code to delegate work to a more cost-efficient AI model without sacrificing quality.

Category
访问服务器

README

GLM-4.7 MCP Server

<div align="center">

Version Python License MCP

Cost-efficient AI delegation for Claude Code

FeaturesInstallationUsageToolsConfiguration

</div>


Overview

87% cost savings compared to Claude Opus while maintaining comparable quality for coding tasks.

The GLM-4.7 MCP Server is a Model Context Protocol server that routes tasks to Z.ai's GLM-4.7 model. It enables Claude Code to delegate work to a more cost-efficient AI model without sacrificing quality.

Why GLM-4.7?

Feature Claude Opus GLM-4.7
Cost per 1M tokens (input) $15.00 ~$2.00
SWE-Bench Verified 72.4% 73.8%
Terminal Bench 2.0 38.2 41.0
Savings ~87%

Features

  • 13 specialized tools for common development tasks
  • Read-only and write-capable agents for safe delegation
  • Automatic model selection (haiku for quick tasks, sonnet/opus for complex)
  • Seamless Claude Code integration via MCP
  • Cost tracking with built-in comparison tools

Installation

Prerequisites

  1. Claude Code CLI - Install from claude.ai/download

    npm install -g @anthropic-ai/claude-code
    
  2. Z.ai API Key - Get your key at z.ai/subscribe

    • GLM Coding Plan starts at ~1/7th the cost of Claude tiers
    • 3x the usage limits compared to Claude

Install the Server

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

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -e .

Configuration

1. Set Your API Key

Edit .env in the server directory:

ZAI_API_KEY=your_api_key_here

Or set as environment variable:

export ZAI_API_KEY=your_api_key_here

2. Add to Claude Desktop Config

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "glm": {
      "command": "/path/to/glm-mcp-server/.venv/bin/python",
      "args": ["/path/to/glm-mcp-server/server.py"],
      "env": {
        "ZAI_API_KEY": "your_api_key_here"
      }
    }
  }
}

On Windows: %APPDATA%\Claude\claude_desktop_config.json On Linux: ~/.config/Claude/claude_desktop_config.json

3. Restart Claude Code

Restart Claude Code to load the new MCP server.


Usage

Once configured, the GLM tools are available in Claude Code:

Quick Questions

Use glm_ask to explain what this React hook does

Code Analysis

Use glm_analyze to review the authentication flow in src/auth/

Implementation

Use glm_implement to add user profile editing to the settings page

Cost Comparison

Use glm_compare_costs with 50000 input tokens and 20000 output tokens

Tools

Tool Description Access Best For
glm_ask Quick questions None Explanations, brainstorming
glm_summarize Summarize text None Docs, meeting notes
glm_explain Explain code/concepts None Learning, understanding
glm_analyze Analyze codebase Read-only Architecture, patterns
glm_review Code review Read-only Quality, security, style
glm_find_bugs Find potential bugs Read-only Debugging, QA
glm_implement Implementation Write Features, refactoring
glm_refactor Refactor code Write Code cleanup
glm_write_tests Generate unit tests Write TDD, coverage
glm_document Add documentation Write Docstrings, API docs
glm_generate_readme Generate README.md Write Project docs
glm_status Server status Diagnostics
glm_compare_costs Cost comparison Budgeting

Examples

Code Review

Use glm_review with review_focus="security" on src/api/auth.ts

Generate Tests

Use glm_write_tests for src/utils/validation.js with test_framework="jest"

Documentation

Use glm_document for src/services/user.py with style="google"

Bug Hunt

Use glm_find_bugs on src/components/payment/checkout.tsx

Model Selection

The server automatically maps Claude model names to GLM models:

Claude GLM Use Case
haiku glm-4.5-air Quick tasks, summaries
sonnet glm-4.7 Balanced quality/speed
opus glm-4.7 Highest quality

You can specify the model parameter in any tool:

Use glm_ask with model="haiku" to quickly summarize this file

Development

Running the Server Directly

source .venv/bin/activate
python server.py

Running Tests

pip install pytest pytest-asyncio
pytest

Project Structure

glm-mcp-server/
├── server.py           # Main MCP server implementation
├── pyproject.toml      # Project configuration
├── .env                # API key (not in git)
├── .venv/              # Virtual environment
└── README.md           # This file

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see LICENSE for details.


Acknowledgments

  • Anthropic for Claude Code and the MCP protocol
  • Z.ai for the GLM-4.7 model and API
  • FastMCP for the excellent MCP framework

Support


<div align="center">

Made with ❤️ for cost-effective AI development

⬆ Back to top

</div>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选