MCP Geometry Server

  • Linux
  • Apple

@luorivergoddess/mcp-geo

一个使用 Asymptote 生成精确几何图像的 MCP(模型上下文协议)服务器。该服务器允许与 MCP 兼容的 AI 模型通过提供 Asymptote 代码来请求图像生成。

先决条件

在使用此服务器之前,请确保已安装以下软件:

  1. Node.js :建议使用 16.x 或更高版本。您可以从nodejs.org下载。
  2. Asymptote :这是一个关键依赖项。asy asy行工具必须已安装,并且可在系统 PATH 中访问。
    • 请访问Asymptote 官方网站获取下载和详细安装说明。
    • 常见安装方法:
      • macOS(通过 Homebrew): brew install asymptote
      • Debian/Ubuntu Linux: sudo apt-get install asymptote
      • **Windows:**通常作为 TeX 发行版(例如 MiKTeX 或 TeX Live)的一部分安装。请确保将 Asymptote 的bin目录添加到 PATH 中。
    • 服务器将在启动时尝试检查asy -version ,如果未找到则打印错误。

安装

要全局安装此包(如果您打算直接运行connect命令)或作为另一个项目中的依赖项:

npm install @luorivergoddess/mcp-geo

如果您已经克隆了存储库并希望在本地运行它以进行开发:

  1. 克隆存储库。
  2. 安装依赖项: npm install
  3. 构建项目: npm run build

用法

启动服务器

一旦软件包安装完毕(例如,全局安装或本地链接),您就可以使用软件包提供的connect命令启动 MCP 服务器。此命令旨在由 MCP 客户端调用。

npx @luorivergoddess/mcp-geo connect

或者,如果您已经克隆了存储库并构建了它:

node dist/cli.js

服务器将启动并使用@modelcontextprotocol/sdk监听 stdin/stdout 上的 JSON-RPC 消息。

MCP 客户端集成

配置兼容 MCP 的客户端(例如,带有 Copilot Agent 模式的 VS Code、Claude Desktop)以使用此服务器。这通常需要告诉客户端如何启动服务器,即npx @luorivergoddess/mcp-geo connect命令。

可用工具: renderGeometricImage

该服务器公开了一个主要工具:

  • 名称: renderGeometricImage
  • **描述:**从 Asymptote 代码渲染图像。
  • 输入模式:
    { "type": "object", "properties": { "asyCode": { "type": "string", "description": "A string containing complete and valid Asymptote code to be compiled. The server executes this code directly. Ensure necessary `import` statements (e.g., `import graph;`) and settings (e.g., `unitsize(1cm);`) are included within this code block if needed." }, "outputParams": { "type": "object", "description": "Optional parameters to control the output image.", "properties": { "format": { "type": "string", "enum": ["svg", "png"], "description": "The desired output image format. \"svg\" for scalable vector graphics (recommended for diagrams and plots), \"png\" for raster graphics. Defaults to \"svg\" if not specified." }, "renderLevel": { "type": "number", "description": "For PNG output only. Specifies the rendering quality (supersampling level for antialiasing). Higher values (e.g., 4 or 8) produce smoother images but take longer to render and result in larger files. Asymptote default is 2. This server defaults to 4 if not specified and format is \"png\". Ignored for SVG output." } } } }, "required": ["asyCode"] }
  • **输出:**该工具返回一个包含内容部分数组的CallToolResult
    • 如果成功,它将包含一个ImageContent部分:
      • type: "image"
      • mimeType: "image/svg+xml""image/png"
      • data: "<base64_encoded_image_data>"
    • 它还可能包括来自 Asymptote 的日志的TextContent部分。
    • 如果发生错误,它会抛出McpError

renderGeometricImage调用示例( arguments字段为 JSON):

{ "asyCode": "draw(unitsquare); fill(unitsquare, lightblue);", "outputParams": { "format": "png", "renderLevel": 4 } }

客户端兼容性说明:

  • 一些 MCP 客户端可能对支持的图像 MIME 类型有限制。
  • 例如,如果您将此服务器与不支持image/svg+xml的客户端(例如,据报道“Cherry Studio”的某些版本或配置)一起使用,请确保通过在工具调用参数中包含"outputParams": { "format": "png" }来请求png格式。如果未指定格式,服务器默认为svg

作者

罗河女神

执照

国际学习中心

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

MCP 服务器通过提供 Asymptote 代码使 AI 模型能够生成精确的几何图像,支持 SVG 和 PNG 输出格式。

  1. 先决条件
    1. 安装
      1. 用法
        1. 启动服务器
        2. MCP 客户端集成
        3. 可用工具: renderGeometricImage
      2. 作者
        1. 执照

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            Enables the generation of images using Together AI's models through an MCP server, supporting customizable parameters such as model selection, image dimensions, and output directory.
            Last updated -
            1
            4
            JavaScript
            MIT License
            • Apple
            • Linux
          • A
            security
            F
            license
            A
            quality
            An advanced MCP server for Cline that leverages EverArt's AI models to generate vector and raster images, supporting flexible storage, multiple formats, and robust image generation capabilities.
            Last updated -
            3
            1
            JavaScript
          • A
            security
            A
            license
            A
            quality
            A MCP server that enables Claude and other MCP-compatible assistants to generate images from text prompts using Together AI's image generation models.
            Last updated -
            1
            2
            TypeScript
            MIT License
            • Apple
            • Linux
          • -
            security
            A
            license
            -
            quality
            A FastMCP server implementation that provides a standardized interface for accessing AI models hosted on Replicate's API, currently supporting image generation with customizable parameters.
            Last updated -
            2
            Python
            MIT License

          View all related MCP servers

          ID: 6ukap1bpd0