Skip to main content
Glama

@cocrates/elk-mcp

elkjs 기반 그래프 레이아웃MCP로 제공하는 TypeScript 패키지입니다.

에이전트는 노드/엣지 구조만 넘기고, 좌표·엣지 경로는 이 서버가 계산합니다. 렌더링은 포함하지 않습니다.

패키지

@cocrates/elk-mcp

바이너리

elk-mcp

런타임

Node.js 18+

전송

MCP stdio (JSON-RPC)


MCP 도구

Tool

설명

layout_graph

graph + options로 레이아웃 → 노드 좌표·엣지 sections

validate_graph

레이아웃 전 검증 (중복 id, parent, endpoint 등)

list_algorithms

등록된 ELK 알고리즘 목록

list_layout_options

알려진 레이아웃 옵션 (query로 필터)

list_layout_categories

레이아웃 카테고리

layout_graph 입력

  • graph: 구조만 (nodes, edges)

  • options: algorithm, direction, layoutOptions 등 (그래프와 분리)

options.algorithm은 ELK layout algorithm id(예: layered, mrtree, force)이고, options.directionRIGHT/LEFT/UP/DOWN 형태 문자열입니다.

계층은 둘 중 하나:

  • flat: node.parent

  • nested: node.children
    (같은 노드에 둘 다 쓰지 말 것)

  • leaf 노드(자식이 없는 노드)의 width/height는 가능하면 제공하세요. 미제공이면 서버에서 기본값 80x40을 사용합니다.

  • edges의 엔드포인트는 노드 id 또는 포트 id가 될 수 있습니다(노드의 ports[]로 포트를 선언한 경우).

  • edges[]graph.edges에 모두 모아도 됩니다. 서버가 엣지 양끝의 LCA(최저 공통 조상) 노드 아래에 배치합니다.

  • edges[]id가 필요합니다. 또한 source/target 또는 sources/targets 형태로 엔드포인트를 줄 수 있습니다.

{
  "graph": {
    "nodes": [
      { "id": "svc", "label": "Service" },
      { "id": "A", "parent": "svc", "label": "API", "width": 120, "height": 40 },
      { "id": "B", "parent": "svc", "label": "DB", "width": 100, "height": 40 },
      { "id": "C", "label": "Client", "width": 90, "height": 40 }
    ],
    "edges": [
      { "id": "e1", "source": "A", "target": "B" },
      { "id": "e2", "source": "C", "target": "A" }
    ]
  },
  "options": {
    "algorithm": "layered",
    "direction": "RIGHT"
  }
}

출력

출력은 options.absoluteCoordinates에 따라 좌표계가 달라집니다.

  • options.absoluteCoordinatestrue(기본): nodes[].x/yedges[].sections[].startPoint/endPoint/bendPoints가 모두 단일(전역) 좌표계 기준입니다.

  • options.absoluteCoordinatesfalse: 값들은 렌더링 프레임에서 바로 쓰기 어렵습니다(노드/엣지의 로컬 좌표계 기준으로 내려옵니다). 일반적인 캔버스 렌더링에는 기본값인 true를 권장합니다.

절대좌표(기본) 기준 flat JSON의 주요 필드:

  • nodes[]: id, label?, x, y, width, height, parent?, children?

    • x,y: 노드 바운딩박스의 좌상단 기준 좌표(ELK 결과 기준)

    • ports?: 각 포트의 id, x,y, width,height

    • labels?: 각 라벨의 id?, text?, x,y, width,height

  • edges[]: id, sources, targets, sections[], junctionPoints?

    • sections[]는 ELK extended edge 라우팅이 분해된 구간 목록입니다.

    • sections[] 항목은 startPoint, endPoint, bendPoints[]로 구성되며, bendPoints는 폴리라인 중간 정점(순서대로 연결)입니다.

    • junctionPoints는 하이퍼엣지 등에서 분기/합류점이 계산된 경우에만 내려옵니다.


Related MCP server: Playwright MCP

클라이언트 설정

{
  "mcpServers": {
    "elk": {
      "command": "npx",
      "args": ["-y", "@cocrates/elk-mcp"]
    }
  }
}

로컬 빌드:

{
  "mcpServers": {
    "elk": {
      "command": "node",
      "args": ["/path/to/elk-mcp/dist/mcp/index.js"]
    }
  }
}

개발

npm install
npm run build
npm test
npm run start:mcp

프로그램에서 코어 API를 직접 쓸 수도 있습니다:

import { layoutGraph } from "@cocrates/elk-mcp";

const result = await layoutGraph(
  {
    nodes: [
      { id: "A", width: 120, height: 40 },
      { id: "B", width: 100, height: 40 },
    ],
    edges: [{ id: "e1", source: "A", target: "B" }],
  },
  { algorithm: "layered", direction: "RIGHT" },
);

GitHub Release · npm 배포

패키지 이름: @cocrates/elk-mcp (scoped). npm에 퍼블리시하려면 해당 scope 권한이 필요합니다.

1. 버전 올리기

npm version patch   # 0.1.0 → 0.1.1
# 또는 minor / major
npm run build

2. npm 배포

npm login
npm publish --access public

files 필드에 dist, README.md, LICENSE만 포함되므로 publish 전에 반드시 npm run build 하세요. (dist/는 gitignore일 수 있습니다.)

3. GitHub Release

git push origin main --follow-tags

gh release create v0.1.1 \
  --title "v0.1.1" \
  --notes "$(cat <<'EOF'
## Changes
- …

## Install
npm install -g @cocrates/elk-mcp@0.1.1
EOF
)"

태그/릴리스는 npm version이 만든 git tag와 버전을 맞추면 됩니다.

권장 순서

  1. PR 머지 → main

  2. npm version + npm run build + npm publish

  3. git push --follow-tags + gh release create

CI에서 publish하려면 Node 18+, NPM_TOKEN, (선택) GITHUB_TOKEN을 시크릿으로 두면 됩니다.


참고

Available Tools

5 tools
layout_graphA

Compute graph layout with elkjs and return node positions (x,y,width,height) and edge routing (sections with start/end/bend points). Pass graph structure in graph and layout settings in options separately. Hierarchy: use node.parent (flat) or node.children (nested), not both on one node. Put all edges in graph.edges; they are placed under the lowest common ancestor (LCA). Coordinates: defaults to absolute mode. When options.absoluteCoordinates=true, all returned node x/y and edge section points are in one global coordinate system. When options.absoluteCoordinates=false, values are returned in local coordinate systems (nodes/ports/labels relative to their containing node), so for typical rendering you should keep the default true. Node x/y are the top-left corner of the node bounding box (ELK semantics). edge.sections[] is an ordered list of routed polyline segments; each section has startPoint/endPoint and optional bendPoints (intermediate polyline vertices). edge.junctionPoints? may be present when ELK computes junction points (e.g. hyperedges).

ParametersJSON Schema
NameRequiredDescriptionDefault
graphYesGraph with nodes and edges
optionsNoLayout options (algorithm, direction, ...)

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description fully discloses behavior: absolute vs local coordinate modes, node x/y as top-left corner, edge sections as polyline segments, optional junctionPoints, and the effect of absoluteCoordinates. It also clarifies that all edges go under LCA.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is thorough and well-structured, starting with the overall result and then detailing each aspect. It is somewhat lengthy but every sentence contributes useful information. Could be slightly more concise, but still effective.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of graph layout and the absence of an output schema, the description covers all essential aspects: input structure, hierarchy rules, coordinate modes, edge routing details, and the distinction between graph data and layout options. No obvious gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds significant value by explaining the relationship between the two parameters (graph vs options), hierarchy constraints, LCA placement of edges, and details about the output coordinate system and edge routing structure.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it computes graph layout using elkjs and returns node positions (x,y,width,height) and edge routing (sections with start/end/bend points). It distinguishes itself from siblings like validate_graph and list_algorithms by being the primary layout computation tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit guidance on how to pass graph structure and options separately, hierarchy rules (parent vs children), edge placement (LCA), and coordinate modes (absolute vs local). However, it doesn't explicitly state when to use this tool versus alternatives like validate_graph, which could be helpful.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_algorithmsA

List registered elkjs layout algorithms with metadata. Use before layout_graph to pick algorithm (layered, mrtree, force, ...).

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, but description implies a safe read-only operation. Provides examples of algorithms (layered, mrtree, force) to set expectations. No need for additional behavioral details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, zero waste. Front-loaded with purpose and actionable context (use before layout_graph). Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero parameters, no output schema, and simple tool nature, the description is fully complete. It explains what the tool lists, why to use it, and gives examples.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters; schema coverage is 100% (trivially). Description adds context (elkjs layout algorithms) beyond the empty schema, earning a baseline of 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb+resource: 'List registered elkjs layout algorithms with metadata'. Distinguishes from sibling 'layout_graph' by specifying its preparatory role.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says 'Use before layout_graph to pick algorithm', providing clear usage context. Does not mention when not to use, but for a listing tool this is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_layout_categoriesA

List elkjs layout categories.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. Description only states the action; does not disclose any behavioral traits such as idempotency, safety, or side effects. For a list tool, read-only nature is implied but not explicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single concise sentence with no redundancy. Every word contributes to the purpose. Ideal length for a simple tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema. Description does not specify the format or structure of the returned layout categories (e.g., list of strings, objects). Adequate for a trivial list tool but could improve by hinting at output shape.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has zero parameters, so schema provides no semantic information. Description adds minimal but sufficient meaning: it names the resource being listed. Baseline for 0 params is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description uses specific verb 'list' and clear resource 'elkjs layout categories'. Distinguishes from sibling tools like list_algorithms and list_layout_options by naming a distinct entity (categories).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus siblings like list_algorithms or list_layout_options. No mention of prerequisites or context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_layout_optionsA

List known ELK layout options (id, group, etc.). Optional query filters by substring match on id or name.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryNoCase-insensitive substring filter on option id/name

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool lists options and filters, which is straightforward. However, it does not disclose whether it is read-only, performance, or access implications. For a simple list tool, this is adequate but not detailed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no wasted words. The first sentence states the core function, the second adds the filter. Efficient and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given one parameter, no output schema, and no annotations, the description covers the core purpose and filter behavior. It might benefit from mentioning the return format or default behavior (e.g., returns all options if no query), but it is largely complete for its complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for the single parameter. The tool description adds context by mentioning fields like 'id, group, etc.' but largely repeats the schema. Additional meaning is minimal.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'List known ELK layout options' with a specific verb and resource. It distinguishes from sibling tools like list_algorithms and list_layout_categories by naming the scope. The optional query filter is explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description indicates when to use the tool (listing layout options) and the optional filter. It does not explicitly exclude use cases or compare to sibling tools, but the context signals and names imply differentiation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

validate_graphA

Validate a graph before layout: duplicate ids, unknown parents/endpoints, parent cycles, missing leaf sizes (warnings). Does not run layout.

ParametersJSON Schema
NameRequiredDescriptionDefault
graphYesGraph to validate

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It lists validations performed and mentions warnings, but does not explicitly state it is read-only or non-destructive. More detail on side effects would improve transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence that is front-loaded with purpose and enumerates checks efficiently. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, and description only mentions 'warnings' without detailing return format. With sibling tools, the context is clear, but more completeness on validation result would help.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Single parameter 'graph' has 100% schema coverage with detailed schema description. The tool description adds little beyond that, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool validates a graph before layout, listing specific checks (duplicate ids, unknown parents, cycles, missing leaf sizes). It distinguishes from sibling tool 'layout_graph' by saying 'Does not run layout'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description implies use before layout_graph with 'Validate a graph before layout' and explicitly says not to run layout. It could more directly state when not to use, but the sibling context makes it clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv0.1.0
    • First observedlayout_graph
    • First observedlist_algorithms
    • First observedlist_layout_categories
    • First observedlist_layout_options
    • First observedvalidate_graph

TDQS

A4.2/5.0
Disambiguation5/5

Each tool has a distinct purpose: layout_graph computes layout, validate_graph checks validity, list_algorithms lists algorithms, list_layout_options lists options, and list_layout_categories lists categories. No overlap in functionality.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (e.g., layout_graph, list_algorithms). No mixing of conventions.

Tool Count5/5

5 tools is well-scoped for an ELK layout server. It covers layout computation, validation, and exploration of algorithms/options without being excessive or insufficient.

Completeness4/5

The set covers core layout operations (validation, layout computation) and discovery (algorithms, options, categories). Minor gap: no tool to retrieve default options for a specific algorithm, but not critical.

Maintenance

ActivitySlowing
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    A graph-based MCP server that provides AI coding agents with persistent memory to store patterns, track complex relationships, and retrieve knowledge across sessions. It leverages graph structures to handle temporal queries and relational paths that traditional vector stores often miss.
    244
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    A Compact Knowledge Graph MCP server providing pre-structured domain knowledge as a routing layer for agent stacks, enabling efficient structural queries (e.g., prerequisites, dependency chains) without hallucinations.
    4
    4
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cocrates/elk-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server