leanix-mcp-integration
This project is a Model Context Protocol server that integrates LeanIX with AI assistants by exposing LeanIX's GraphQL API as MCP tools. It provides several functionalities such as searching, creating, and updating fact sheets, and is compatible with MCP clients like Claude.
LeanIX MCP Integration
A Model Context Protocol (MCP) server that connects LeanIX to AI assistants. It exposes LeanIX's GraphQL API as MCP tools that AI assistants can use.
Core Functionality
This integration provides five MCP tools for LeanIX operations:
- Fact Sheet Overview: Get counts and statistics of fact sheets in your workspace
- Search: Find fact sheets by their names
- Subscription Management: View who is subscribed to specific fact sheets
- Create Fact Sheets: Add new fact sheets to your workspace
- Update Fact Sheets: Modify existing fact sheet information
Prerequisites
- Node.js (v14 or higher)
- A LeanIX workspace and API token
- Basic understanding of GraphQL and MCP
Getting Started
- Clone this repository
- Install dependencies:
npm install
- Create a
.env
file in the root directory with your LeanIX credentials:LEANIX_SUBDOMAIN=your-workspace-subdomain LEANIX_TOKEN=your-api-token
Project Structure
├── server.js # Main MCP server setup and initialization
├── leanix-client.js # LeanIX API client implementation
├── api # LeanIX API definitions and endpoints
├── mutation # GraphQL mutation definitions
├── datamodel # Data models and type definitions
├── .env # Environment configuration
└── src/
├── config/
│ └── config.js # Loads and validates environment variables for LeanIX credentials
├── graphql/
│ └── queries/ # GraphQL queries and mutations for LeanIX API
│ ├── factSheetQueries.js # Queries for fact sheet operations
│ └── workspaceQueries.js # Queries for workspace-level operations
├── tools/
│ └── workspaceTools.js # Defines and registers the five MCP tools
├── types/
│ └── schemas.js # Zod schemas for validating tool parameters
└── utils/
└── responseHandler.js # Formats responses in MCP-compatible structure
Common Pitfalls and Solutions
-
GraphQL Schema Mismatch: Always check the current LeanIX API schema in their documentation or GraphiQL interface. The schema may change over time.
-
Response Formatting: All MCP tool responses must follow this format:
{ content: [{ type: "text", text: "your response here" }] }
-
Error Handling: Always wrap your tool implementations with
withErrorHandling
to ensure proper error responses. -
Environment Variables: Make sure to properly load and validate environment variables before making any API calls.
Claude Desktop Configuration
To use this MCP server with Claude Desktop, you need to add the server configuration to Claude's config file. The config file is typically located at:
- Mac:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add the following configuration:
{
"mcpServers": {
"myserver": {
"command": "node",
"args": [
"/path/to/your/lean/server.js"
]
}
}
}
Replace /path/to/your/lean/server.js
with the absolute path to your server.js file. This tells Claude Desktop to:
- Start this MCP server when needed
- Connect to it for LeanIX operations
- Run it using Node.js
Testing Your Integration
-
Start the server:
node server.js
-
The server will connect to your LeanIX workspace and make the tools available through MCP.
-
You can test your tools through any MCP-compatible client (like Claude).
Debugging Tips
-
Enable debug logging in your configuration file to verify environment variables are loaded correctly.
-
Use the LeanIX GraphiQL interface to test your queries before implementing them in your tools.
-
Check the server console for detailed error messages when tools fail.
Resources
License
MIT