Skip to content

MCP Server

LikeC4 MCP Server provides knowledge of your LikeC4 model to LLMs.
This enables you to query your model in natural language:

“Lookup LikeC4 model and list all incoming relationships of the backend api”

“What nested elements of the ‘Backend’ have relations with the legacy api”

“List all elements tagged legacy from team1 project”

“What technologies are used for ui (consider all elements with browser shape)”

“Export to CSV all relationships between Backend and Amazon SQS”

Three options are available:

  • Use extension’s built-in MCP Server
  • Use likec4 mcp CLI
  • Use @likec4/mcp package

When LikeC4 extension is installed, MCP Server can be enabled from the extension settings.

To configure MCP Server:

Create .vscode/mcp.json:

{
"servers": {
"likec4": {
"type": "sse",
"url": "http://localhost:33335/mcp"
}
}
}

You can change port in the settings.

If you have installed likec4 CLI, you can start MCP server with stdio transport:

Terminal window
likec4 mcp
# or
likec4 mcp --stdio

Start MCP server with http transport on port 33335 (default) at ./src folder:

Terminal window
likec4 mcp --http ./src

Start MCP server with http transport on port 1234:

Terminal window
likec4 mcp -p 1234

Example configuration:

{
"mcpServers": {
"likec4": {
"command": "npx",
"args": [
"-y",
"@likec4/mcp"
],
"env": {
"LIKEC4_WORKSPACE": "${workspaceFolder}"
}
}
}
}

This package starts MCP server using stdio transport.

If LIKEC4_WORKSPACE environment variable is not set, the current directory will be used as workspace.

ToolDescription
list-projectsList all LikeC4 projects in the workspace
read-project-summaryProject specification, configuration, all elements, deployment nodes and views
search-elementSearch elements and deployment nodes by id/title/kind/shape/tags/metadata
read-elementFull element details including relationships, views, deployments, metadata
read-deploymentDetails of a deployment node or deployed instance
read-viewFull view details (nodes/edges) and source location
find-relationshipsDirect and indirect relationships between two elements
query-graphQuery element hierarchy (ancestors, descendants, siblings, children, parent) and single-hop relationships (incomers, outgoers)
query-incomers-graphRecursive BFS graph of all upstream dependencies/producers
query-outgoers-graphRecursive BFS graph of all downstream consumers/dependents
query-by-metadataSearch elements by metadata key-value pairs (exact/contains/exists)
query-by-tagsTag filtering with boolean logic (allOf, anyOf, noneOf)
query-by-tag-patternSearch elements by tag patterns using prefix, contains, or suffix matching
find-relationship-pathsDiscover all multi-hop relationship chains between two elements via BFS
batch-read-elementsRead full details for multiple elements in a single request
subgraph-summarySummarize descendants of an element with depth, metadata, and relationship counts
element-diffCompare two elements and show differences in properties, tags, metadata, and relationships
open-viewOpens the LikeC4 view panel (editor only)

Check out README for more details.