@last9/mcp-server 0.0.9
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 +77 -0
- package/bin/cli.js +19 -0
- package/bin/download-binary.js +90 -0
- package/dist/last9-mcp-server +0 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Last9 MCP Server
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io/) server implementation for [Last9](https://last9.io) that enables AI agents to query your data using Last9.
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
Works with Claude desktop app. Implements two MCP [tools](https://modelcontextprotocol.io/docs/concepts/tools):
|
|
8
|
+
|
|
9
|
+
- get_exceptions: Get list of execeptions
|
|
10
|
+
- get_servicegraph: Get Service graph for an endpoint from the exception
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
You can install the Last9 MCP server using either
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
# Add the Last9 tap
|
|
19
|
+
brew tap last9/tap
|
|
20
|
+
|
|
21
|
+
# Install the Last9 MCP CLI
|
|
22
|
+
brew install last9-mcp
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
### Environment Variables
|
|
28
|
+
|
|
29
|
+
The service requires the following environment variables:
|
|
30
|
+
|
|
31
|
+
- `LAST9_AUTH_TOKEN`: Authentication token for Last9 MCP server (required)
|
|
32
|
+
- `LAST9_BASE_URL`: Last9 API URL (required)
|
|
33
|
+
|
|
34
|
+
## Usage with Claude Desktop
|
|
35
|
+
|
|
36
|
+
Configure the Claude app to use the MCP server:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"mcpServers": {
|
|
45
|
+
"last9": {
|
|
46
|
+
"command": "/opt/homebrew/bin/last9-mcp",
|
|
47
|
+
"env": {
|
|
48
|
+
"LAST9_AUTH_TOKEN": "your_auth_token",
|
|
49
|
+
"LAST9_BASE_URL": "https://otlp.last9.io"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Usage with Cursor
|
|
57
|
+
|
|
58
|
+
Configure Cursor to use the MCP server:
|
|
59
|
+
|
|
60
|
+
1. Open Cursor settings
|
|
61
|
+
2. Navigate to MCP
|
|
62
|
+
3. Click Add New Global Configuration
|
|
63
|
+
4. Add following stanza. If you already have a MCP server configured, only add the last9 stanza.
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"last9": {
|
|
69
|
+
"command": "/opt/homebrew/bin/last9-mcp",
|
|
70
|
+
"env": {
|
|
71
|
+
"LAST9_AUTH_TOKEN": "your_auth_token",
|
|
72
|
+
"LAST9_BASE_URL": "https://otlp.last9.io"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// Get the path to the binary
|
|
7
|
+
const binaryName = process.platform === 'win32' ? 'last9-mcp-server.exe' : 'last9-mcp-server';
|
|
8
|
+
const binaryPath = path.join(__dirname, '..', 'dist', binaryName);
|
|
9
|
+
|
|
10
|
+
// Spawn the binary with all arguments passed through
|
|
11
|
+
const proc = spawn(binaryPath, process.argv.slice(2), {
|
|
12
|
+
stdio: 'inherit',
|
|
13
|
+
env: process.env
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Handle process exit
|
|
17
|
+
proc.on('exit', (code) => {
|
|
18
|
+
process.exit(code);
|
|
19
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { execSync } = require('child_process');
|
|
5
|
+
|
|
6
|
+
// Get version from package.json
|
|
7
|
+
const version = require('../package.json').version;
|
|
8
|
+
const platform = process.platform;
|
|
9
|
+
const arch = process.arch;
|
|
10
|
+
|
|
11
|
+
// Map Node.js arch to Go arch
|
|
12
|
+
const archMap = {
|
|
13
|
+
'x64': 'x86_64', // Changed to match .goreleaser.yml naming
|
|
14
|
+
'arm64': 'arm64',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Map platform to GoReleaser OS naming
|
|
18
|
+
const osMap = {
|
|
19
|
+
'darwin': 'Darwin',
|
|
20
|
+
'linux': 'Linux',
|
|
21
|
+
'win32': 'Windows'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const binaryName = platform === 'win32' ? 'last9-mcp-server.exe' : 'last9-mcp-server';
|
|
25
|
+
const distDir = path.join(__dirname, '..', 'dist');
|
|
26
|
+
const binaryPath = path.join(distDir, binaryName);
|
|
27
|
+
|
|
28
|
+
// Create dist directory if it doesn't exist
|
|
29
|
+
if (!fs.existsSync(distDir)) {
|
|
30
|
+
fs.mkdirSync(distDir, { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Match the format in .goreleaser.yml name_template
|
|
34
|
+
const downloadUrl = `https://github.com/last9/last9-mcp-server/releases/download/v${version}/last9-mcp-server_${osMap[platform]}_${archMap[arch]}${platform === 'win32' ? '.zip' : '.tar.gz'}`;
|
|
35
|
+
|
|
36
|
+
console.log(`Downloading from: ${downloadUrl}`);
|
|
37
|
+
console.log(`Saving to: ${binaryPath}`);
|
|
38
|
+
|
|
39
|
+
const file = fs.createWriteStream(binaryPath);
|
|
40
|
+
|
|
41
|
+
const download = (url) => {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
https.get(url, (response) => {
|
|
44
|
+
if (response.statusCode === 302) {
|
|
45
|
+
// Handle redirect
|
|
46
|
+
download(response.headers.location)
|
|
47
|
+
.then(resolve)
|
|
48
|
+
.catch(reject);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (response.statusCode !== 200) {
|
|
53
|
+
reject(new Error(`Failed to download: ${response.statusCode} ${response.statusMessage}`));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
response.pipe(file);
|
|
58
|
+
|
|
59
|
+
file.on('finish', () => {
|
|
60
|
+
file.close();
|
|
61
|
+
console.log('Download completed');
|
|
62
|
+
|
|
63
|
+
// Make binary executable on Unix-like systems
|
|
64
|
+
if (platform !== 'win32') {
|
|
65
|
+
try {
|
|
66
|
+
execSync(`chmod +x ${binaryPath}`);
|
|
67
|
+
console.log('Made binary executable');
|
|
68
|
+
} catch (err) {
|
|
69
|
+
reject(new Error(`Failed to make binary executable: ${err.message}`));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
resolve();
|
|
75
|
+
});
|
|
76
|
+
}).on('error', (err) => {
|
|
77
|
+
fs.unlink(binaryPath, () => {}); // Delete the file async
|
|
78
|
+
reject(new Error(`Download failed: ${err.message}`));
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
download(downloadUrl)
|
|
84
|
+
.then(() => {
|
|
85
|
+
console.log('Installation completed successfully');
|
|
86
|
+
})
|
|
87
|
+
.catch((err) => {
|
|
88
|
+
console.error('Installation failed:', err.message);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
});
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@last9/mcp-server",
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"description": "Last9 MCP Server - Model Context Protocol server implementation for Last9",
|
|
5
|
+
"bin": {
|
|
6
|
+
"last9-mcp": "./bin/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/",
|
|
10
|
+
"dist/",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"postinstall": "node bin/download-binary.js",
|
|
16
|
+
"preversion": "go run main.go --version",
|
|
17
|
+
"postversion": "git push && git push --tags"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/last9/last9-mcp-server.git"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=14"
|
|
25
|
+
},
|
|
26
|
+
"preferGlobal": true,
|
|
27
|
+
"keywords": ["last9", "mcp", "ai", "claude"],
|
|
28
|
+
"author": "Last9",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/last9/last9-mcp-server/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://last9.io/mcp",
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
}
|
|
37
|
+
}
|