MCP Geometry Server

MCP Geometry Server

An MCP server that enables AI models to generate precise geometric images by providing Asymptote code, supporting both SVG and PNG output formats.

Category
访问服务器

Tools

renderGeometricImage

Renders an image from Asymptote code.

README

@luorivergoddess/mcp-geo

An MCP (Model Context Protocol) server for generating precise geometric images using Asymptote. This server allows AI models compatible with MCP to request image generation by providing Asymptote code.

Prerequisites

Before using this server, please ensure you have the following installed:

  1. Node.js: Version 16.x or higher is recommended. You can download it from nodejs.org.
  2. Asymptote: This is a critical dependency. The asy command-line tool must be installed and accessible in your system's PATH.
    • Visit the Asymptote official website for download and detailed installation instructions.
    • Common installation methods:
      • macOS (via Homebrew): brew install asymptote
      • Debian/Ubuntu Linux: sudo apt-get install asymptote
      • Windows: Often installed as part of TeX distributions like MiKTeX or TeX Live. Ensure the Asymptote bin directory is added to your PATH.
    • The server will attempt to check for asy -version on startup and print an error if it's not found.

Installation

To install this package globally (if you intend to run connect command directly) or as a dependency in another project:

npm install @luorivergoddess/mcp-geo

If you've cloned the repository and want to run it locally for development:

  1. Clone the repository.
  2. Install dependencies: npm install
  3. Build the project: npm run build

Usage

Starting the Server

Once the package is installed (e.g., globally or linked locally), you can start the MCP server using the connect command provided by this package. This command is intended to be invoked by an MCP client.

npx @luorivergoddess/mcp-geo connect

Or, if you have cloned the repository and built it:

node dist/cli.js

The server will start and listen for JSON-RPC messages on stdin/stdout, using the @modelcontextprotocol/sdk.

MCP Client Integration

Configure your MCP-compatible client (e.g., VS Code with Copilot Agent Mode, Claude Desktop) to use this server. This usually involves telling the client how to start the server, which would be the npx @luorivergoddess/mcp-geo connect command.

Available Tool: renderGeometricImage

The server exposes one primary tool:

  • Name: renderGeometricImage
  • Description: Renders an image from Asymptote code.
  • Input Schema:
    {
      "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"]
    }
    
  • Output: The tool returns a CallToolResult containing an array of content parts.
    • If successful, it includes an ImageContent part with:
      • type: "image"
      • mimeType: "image/svg+xml" or "image/png"
      • data: "<base64_encoded_image_data>"
    • It may also include a TextContent part with logs from Asymptote.
    • If an error occurs, it throws an McpError.

Example renderGeometricImage call (JSON for arguments field):

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

Client Compatibility Notes:

  • Some MCP clients may have limitations on supported image MIME types.
  • For instance, if you are using this server with a client that does not support image/svg+xml (e.g., certain versions or configurations of "Cherry Studio" as reported), please ensure you request the png format by including "outputParams": { "format": "png" } in your tool call arguments. The server defaults to svg if no format is specified.

Author

luorivergoddess

License

ISC

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选