liara-mcp 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -35
- package/bin/setup.js +175 -0
- package/dist/index.js +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
A Model Context Protocol (MCP) server for the Liara cloud platform. This server enables AI assistants to deploy and manage applications, databases, and infrastructure on Liara through natural language.
|
|
6
6
|
|
|
7
|
+
<div align="center">
|
|
8
|
+
<img src="assets/liara-mcp-logo.jpg" alt="Liara MCP Server" width="600">
|
|
9
|
+
</div>
|
|
10
|
+
|
|
7
11
|
## Features
|
|
8
12
|
|
|
9
13
|
### Current Capabilities
|
|
@@ -32,31 +36,21 @@ MariaDB, MySQL, PostgreSQL, MSSQL, MongoDB, Redis, ElasticSearch, RabbitMQ
|
|
|
32
36
|
|
|
33
37
|
## Installation
|
|
34
38
|
|
|
35
|
-
### Via npm (Recommended)
|
|
36
|
-
|
|
37
39
|
```bash
|
|
38
|
-
# Install globally
|
|
39
40
|
npm install -g liara-mcp
|
|
40
|
-
|
|
41
|
-
# Or install locally in your project
|
|
42
|
-
npm install liara-mcp
|
|
43
41
|
```
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
Or use directly with npx (no installation required).
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
# Clone the repository
|
|
49
|
-
git clone https://github.com/razavioo/liara-mcp.git
|
|
50
|
-
cd liara-mcp
|
|
45
|
+
## Configuration
|
|
51
46
|
|
|
52
|
-
|
|
53
|
-
npm install
|
|
47
|
+
The server supports multiple ways to configure your API token:
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
npm run build
|
|
57
|
-
```
|
|
49
|
+
### Option 1: Environment Variables (Recommended for MCP clients)
|
|
58
50
|
|
|
59
|
-
|
|
51
|
+
Set the token directly in your MCP client configuration (see Usage section below).
|
|
52
|
+
|
|
53
|
+
### Option 2: .env File (For local development)
|
|
60
54
|
|
|
61
55
|
1. Copy the example environment file:
|
|
62
56
|
```bash
|
|
@@ -70,6 +64,8 @@ LIARA_TEAM_ID=optional_team_id
|
|
|
70
64
|
LIARA_API_BASE_URL=https://api.iran.liara.ir
|
|
71
65
|
```
|
|
72
66
|
|
|
67
|
+
The server automatically loads `.env` files using dotenv, so no additional setup is required.
|
|
68
|
+
|
|
73
69
|
### Getting Your API Token
|
|
74
70
|
|
|
75
71
|
1. Go directly to the [API section](https://console.liara.ir/API) in Liara Console (or log in to [Liara Console](https://console.liara.ir) and navigate to the API section)
|
|
@@ -83,17 +79,18 @@ If you're working with a team account, you can find your Team ID in the API sect
|
|
|
83
79
|
|
|
84
80
|
## Usage
|
|
85
81
|
|
|
86
|
-
### With
|
|
87
|
-
|
|
88
|
-
#### If installed globally via npm:
|
|
82
|
+
### With Claude Desktop / Cursor / VS Code
|
|
89
83
|
|
|
90
|
-
Add to your MCP
|
|
84
|
+
Add the following to your MCP configuration file:
|
|
85
|
+
- **Claude Desktop:** `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows)
|
|
86
|
+
- **Cursor:** `.cursor/mcp.json`
|
|
91
87
|
|
|
92
88
|
```json
|
|
93
89
|
{
|
|
94
90
|
"mcpServers": {
|
|
95
91
|
"liara": {
|
|
96
|
-
"command": "
|
|
92
|
+
"command": "npx",
|
|
93
|
+
"args": ["-y", "liara-mcp"],
|
|
97
94
|
"env": {
|
|
98
95
|
"LIARA_API_TOKEN": "your_api_token_here"
|
|
99
96
|
}
|
|
@@ -102,22 +99,16 @@ Add to your MCP client configuration (e.g., Claude Desktop):
|
|
|
102
99
|
}
|
|
103
100
|
```
|
|
104
101
|
|
|
105
|
-
|
|
102
|
+
### Troubleshooting: PATH Issues (nvm/nodenv users)
|
|
106
103
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"command": "node",
|
|
112
|
-
"args": ["/path/to/liara-mcp/dist/index.js"],
|
|
113
|
-
"env": {
|
|
114
|
-
"LIARA_API_TOKEN": "your_api_token_here"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
104
|
+
If you see `spawn npx ENOENT` error, run the setup wizard:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npx liara-mcp-setup
|
|
119
108
|
```
|
|
120
109
|
|
|
110
|
+
This will generate the correct configuration with absolute paths for your system.
|
|
111
|
+
|
|
121
112
|
### Available Tools
|
|
122
113
|
|
|
123
114
|
#### App Management
|
package/bin/setup.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync, spawn } from 'child_process';
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, copyFileSync } from 'fs';
|
|
5
|
+
import { dirname, join } from 'path';
|
|
6
|
+
import { createInterface } from 'readline';
|
|
7
|
+
import { homedir, platform } from 'os';
|
|
8
|
+
|
|
9
|
+
const rl = createInterface({
|
|
10
|
+
input: process.stdin,
|
|
11
|
+
output: process.stdout
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
function question(prompt) {
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
rl.question(prompt, resolve);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getNodePath() {
|
|
21
|
+
try {
|
|
22
|
+
return execSync('which node', { encoding: 'utf8' }).trim();
|
|
23
|
+
} catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getLiaraMcpPath(nodeDir) {
|
|
29
|
+
const nodeModulesDir = join(dirname(nodeDir), 'lib', 'node_modules');
|
|
30
|
+
const liaraMcpPath = join(nodeModulesDir, 'liara-mcp', 'dist', 'index.js');
|
|
31
|
+
|
|
32
|
+
if (existsSync(liaraMcpPath)) {
|
|
33
|
+
return liaraMcpPath;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getCursorConfigPath() {
|
|
39
|
+
const home = homedir();
|
|
40
|
+
return join(home, '.cursor', 'mcp.json');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getClaudeConfigPath() {
|
|
44
|
+
const home = homedir();
|
|
45
|
+
if (platform() === 'darwin') {
|
|
46
|
+
return join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
47
|
+
}
|
|
48
|
+
return join(home, '.config', 'Claude', 'claude_desktop_config.json');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function main() {
|
|
52
|
+
console.log('🚀 Liara MCP Setup');
|
|
53
|
+
console.log('==================');
|
|
54
|
+
console.log('');
|
|
55
|
+
|
|
56
|
+
// Check Node.js
|
|
57
|
+
const nodePath = getNodePath();
|
|
58
|
+
if (!nodePath) {
|
|
59
|
+
console.log('❌ Node.js is not installed. Please install Node.js first.');
|
|
60
|
+
console.log(' Visit: https://nodejs.org/');
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
console.log(`✅ Found Node.js at: ${nodePath}`);
|
|
64
|
+
|
|
65
|
+
const nodeDir = dirname(nodePath);
|
|
66
|
+
|
|
67
|
+
// Check liara-mcp
|
|
68
|
+
let liaraMcpPath = getLiaraMcpPath(nodeDir);
|
|
69
|
+
|
|
70
|
+
if (!liaraMcpPath) {
|
|
71
|
+
console.log('');
|
|
72
|
+
console.log('📦 Installing liara-mcp globally...');
|
|
73
|
+
try {
|
|
74
|
+
execSync('npm install -g liara-mcp', { stdio: 'inherit' });
|
|
75
|
+
liaraMcpPath = getLiaraMcpPath(nodeDir);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.log('❌ Failed to install liara-mcp');
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!liaraMcpPath) {
|
|
83
|
+
console.log('❌ liara-mcp not found. Please run: npm install -g liara-mcp');
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
console.log(`✅ Found liara-mcp at: ${liaraMcpPath}`);
|
|
88
|
+
console.log('');
|
|
89
|
+
|
|
90
|
+
// Get API token
|
|
91
|
+
const apiToken = await question('🔑 Enter your Liara API token (get it from https://console.liara.ir/API): ');
|
|
92
|
+
|
|
93
|
+
if (!apiToken || apiToken.trim() === '') {
|
|
94
|
+
console.log('❌ API token is required');
|
|
95
|
+
rl.close();
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Generate config
|
|
100
|
+
const config = {
|
|
101
|
+
mcpServers: {
|
|
102
|
+
liara: {
|
|
103
|
+
command: nodePath,
|
|
104
|
+
args: [liaraMcpPath],
|
|
105
|
+
env: {
|
|
106
|
+
LIARA_API_TOKEN: apiToken.trim()
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
console.log('');
|
|
113
|
+
console.log('📝 Your MCP configuration:');
|
|
114
|
+
console.log('');
|
|
115
|
+
console.log('━'.repeat(60));
|
|
116
|
+
console.log(JSON.stringify(config, null, 2));
|
|
117
|
+
console.log('━'.repeat(60));
|
|
118
|
+
console.log('');
|
|
119
|
+
|
|
120
|
+
const cursorConfigPath = getCursorConfigPath();
|
|
121
|
+
const claudeConfigPath = getClaudeConfigPath();
|
|
122
|
+
|
|
123
|
+
console.log('📁 Configuration file locations:');
|
|
124
|
+
console.log(` Cursor: ${cursorConfigPath}`);
|
|
125
|
+
console.log(` Claude Desktop: ${claudeConfigPath}`);
|
|
126
|
+
console.log('');
|
|
127
|
+
|
|
128
|
+
const autoConfig = await question('Would you like to automatically configure Cursor? (y/n): ');
|
|
129
|
+
|
|
130
|
+
if (autoConfig.toLowerCase() === 'y') {
|
|
131
|
+
try {
|
|
132
|
+
const configDir = dirname(cursorConfigPath);
|
|
133
|
+
if (!existsSync(configDir)) {
|
|
134
|
+
mkdirSync(configDir, { recursive: true });
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
let finalConfig = config;
|
|
138
|
+
|
|
139
|
+
// Merge with existing config if present
|
|
140
|
+
if (existsSync(cursorConfigPath)) {
|
|
141
|
+
console.log('⚠️ Existing config found. Creating backup...');
|
|
142
|
+
copyFileSync(cursorConfigPath, `${cursorConfigPath}.backup`);
|
|
143
|
+
|
|
144
|
+
try {
|
|
145
|
+
const existing = JSON.parse(readFileSync(cursorConfigPath, 'utf8'));
|
|
146
|
+
existing.mcpServers = existing.mcpServers || {};
|
|
147
|
+
existing.mcpServers.liara = config.mcpServers.liara;
|
|
148
|
+
finalConfig = existing;
|
|
149
|
+
} catch {
|
|
150
|
+
// Use new config if parsing fails
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
writeFileSync(cursorConfigPath, JSON.stringify(finalConfig, null, 2));
|
|
155
|
+
console.log(`✅ Configuration written to ${cursorConfigPath}`);
|
|
156
|
+
console.log('');
|
|
157
|
+
console.log('🎉 Setup complete! Please restart Cursor to apply changes.');
|
|
158
|
+
} catch (error) {
|
|
159
|
+
console.log(`❌ Failed to write config: ${error.message}`);
|
|
160
|
+
console.log(' Please copy the configuration manually.');
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
console.log('');
|
|
164
|
+
console.log('📋 Copy the configuration above and add it to your MCP client config file.');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
console.log('');
|
|
168
|
+
console.log('📚 Documentation: https://github.com/razavioo/liara-mcp');
|
|
169
|
+
console.log('🆘 Issues: https://github.com/razavioo/liara-mcp/issues');
|
|
170
|
+
|
|
171
|
+
rl.close();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
main().catch(console.error);
|
|
175
|
+
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "liara-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "MCP server for Liara cloud platform - deploy and manage apps, databases, and infrastructure",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"liara-mcp": "./dist/index.js"
|
|
8
|
+
"liara-mcp": "./dist/index.js",
|
|
9
|
+
"liara-mcp-setup": "./bin/setup.js"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|
|
11
12
|
"dist",
|
|
13
|
+
"bin",
|
|
12
14
|
"README.md",
|
|
13
15
|
"LICENSE"
|
|
14
16
|
],
|