langflow-mcp-server 1.0.0
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/.env.example +42 -0
- package/LICENSE +21 -0
- package/README.md +204 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +107 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +9 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +172 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +3 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +142 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/services/langflow-client.d.ts +18 -0
- package/dist/services/langflow-client.d.ts.map +1 -0
- package/dist/services/langflow-client.js +122 -0
- package/dist/services/langflow-client.js.map +1 -0
- package/dist/types/index.d.ts +65 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +24 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +72 -0
package/.env.example
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Langflow MCP Server Configuration
|
|
2
|
+
|
|
3
|
+
# ====================
|
|
4
|
+
# LANGFLOW API CONFIGURATION
|
|
5
|
+
# ====================
|
|
6
|
+
|
|
7
|
+
# Langflow instance base URL (without /api/v1 suffix)
|
|
8
|
+
# Example: http://localhost:7860 or https://your-langflow-instance.com
|
|
9
|
+
LANGFLOW_BASE_URL=http://localhost:7860
|
|
10
|
+
|
|
11
|
+
# Langflow API Key
|
|
12
|
+
# Get this from your Langflow instance settings
|
|
13
|
+
LANGFLOW_API_KEY=your-api-key-here
|
|
14
|
+
|
|
15
|
+
# API request timeout in milliseconds (default: 30000)
|
|
16
|
+
LANGFLOW_TIMEOUT=30000
|
|
17
|
+
|
|
18
|
+
# ====================
|
|
19
|
+
# MCP SERVER CONFIGURATION
|
|
20
|
+
# ====================
|
|
21
|
+
|
|
22
|
+
# Server mode: stdio (local) or http (remote)
|
|
23
|
+
MCP_MODE=stdio
|
|
24
|
+
|
|
25
|
+
# Logging Level (debug, info, warn, error)
|
|
26
|
+
LOG_LEVEL=info
|
|
27
|
+
|
|
28
|
+
# Node Environment (development, production)
|
|
29
|
+
NODE_ENV=development
|
|
30
|
+
|
|
31
|
+
# ====================
|
|
32
|
+
# HTTP MODE CONFIGURATION
|
|
33
|
+
# ====================
|
|
34
|
+
# Only used when MCP_MODE=http
|
|
35
|
+
|
|
36
|
+
# HTTP Server Configuration
|
|
37
|
+
PORT=3000
|
|
38
|
+
HOST=0.0.0.0
|
|
39
|
+
|
|
40
|
+
# Authentication token for HTTP mode
|
|
41
|
+
# Generate with: openssl rand -base64 32
|
|
42
|
+
AUTH_TOKEN=your-secure-token-here
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Aras
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# langflow-mcp-server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to Langflow workflow automation platform. Inspired by [czlonkowski/n8n-mcp](https://github.com/czlonkowski/n8n-mcp).
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
langflow-mcp-server serves as a bridge between Langflow's workflow automation platform and AI models, enabling them to understand and work with Langflow flows effectively. It provides structured access to:
|
|
8
|
+
|
|
9
|
+
- **Flow Management** - Create, read, update, and delete Langflow flows
|
|
10
|
+
- **Component Discovery** - List all available Langflow components
|
|
11
|
+
- **Workflow Automation** - Integrate Langflow with AI assistants like Claude
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Prerequisites
|
|
16
|
+
|
|
17
|
+
- Node.js installed on your system
|
|
18
|
+
- A running Langflow instance
|
|
19
|
+
- Langflow API key
|
|
20
|
+
|
|
21
|
+
### Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Install from npm
|
|
25
|
+
npm install -g langflow-mcp-server
|
|
26
|
+
|
|
27
|
+
# OR clone the repository
|
|
28
|
+
git clone https://github.com/nobrainer-tech/langflow-mcp.git
|
|
29
|
+
cd langflow-mcp
|
|
30
|
+
|
|
31
|
+
# Install dependencies
|
|
32
|
+
npm install
|
|
33
|
+
|
|
34
|
+
# Build the project
|
|
35
|
+
npm run build
|
|
36
|
+
|
|
37
|
+
# Configure environment
|
|
38
|
+
cp .env.example .env
|
|
39
|
+
# Edit .env with your Langflow instance URL and API key
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Configuration
|
|
43
|
+
|
|
44
|
+
Edit `.env` file:
|
|
45
|
+
|
|
46
|
+
```env
|
|
47
|
+
LANGFLOW_BASE_URL=http://localhost:7860
|
|
48
|
+
LANGFLOW_API_KEY=your-api-key-here
|
|
49
|
+
MCP_MODE=stdio
|
|
50
|
+
LOG_LEVEL=info
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Claude Desktop Setup
|
|
54
|
+
|
|
55
|
+
Add to your Claude Desktop config file:
|
|
56
|
+
|
|
57
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
58
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
59
|
+
**Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"mcpServers": {
|
|
64
|
+
"langflow": {
|
|
65
|
+
"command": "npx",
|
|
66
|
+
"args": ["-y", "langflow-mcp-server"],
|
|
67
|
+
"env": {
|
|
68
|
+
"LANGFLOW_BASE_URL": "http://localhost:7860",
|
|
69
|
+
"LANGFLOW_API_KEY": "your-api-key-here",
|
|
70
|
+
"MCP_MODE": "stdio",
|
|
71
|
+
"LOG_LEVEL": "error"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Alternative (local installation):**
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"langflow": {
|
|
83
|
+
"command": "node",
|
|
84
|
+
"args": ["/absolute/path/to/langflow-mcp/dist/mcp/index.js"],
|
|
85
|
+
"env": {
|
|
86
|
+
"LANGFLOW_BASE_URL": "http://localhost:7860",
|
|
87
|
+
"LANGFLOW_API_KEY": "your-api-key-here",
|
|
88
|
+
"MCP_MODE": "stdio",
|
|
89
|
+
"LOG_LEVEL": "error"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Restart Claude Desktop after updating configuration.
|
|
97
|
+
|
|
98
|
+
## Available MCP Tools
|
|
99
|
+
|
|
100
|
+
Once connected, Claude can use these tools:
|
|
101
|
+
|
|
102
|
+
### Flow Management
|
|
103
|
+
- **`create_flow`** - Create a new Langflow flow
|
|
104
|
+
- **`list_flows`** - List all flows with pagination and filtering
|
|
105
|
+
- **`get_flow`** - Get details of a specific flow by ID
|
|
106
|
+
- **`update_flow`** - Update an existing flow
|
|
107
|
+
- **`delete_flow`** - Delete a single flow
|
|
108
|
+
- **`delete_flows`** - Delete multiple flows at once
|
|
109
|
+
|
|
110
|
+
### Component Discovery
|
|
111
|
+
- **`list_components`** - List all available Langflow components
|
|
112
|
+
|
|
113
|
+
## Example Usage
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
// Create a new flow
|
|
117
|
+
create_flow({
|
|
118
|
+
name: "My Automation Flow",
|
|
119
|
+
description: "A flow that processes data"
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
// List all flows
|
|
123
|
+
list_flows({
|
|
124
|
+
page: 1,
|
|
125
|
+
size: 50
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
// Get flow details
|
|
129
|
+
get_flow({
|
|
130
|
+
flow_id: "flow-uuid-here"
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
// Update a flow
|
|
134
|
+
update_flow({
|
|
135
|
+
flow_id: "flow-uuid-here",
|
|
136
|
+
name: "Updated Flow Name"
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
// List all components
|
|
140
|
+
list_components()
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Development
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Build
|
|
147
|
+
npm run build
|
|
148
|
+
|
|
149
|
+
# Run in development mode
|
|
150
|
+
npm run dev
|
|
151
|
+
|
|
152
|
+
# Run tests
|
|
153
|
+
npm test
|
|
154
|
+
|
|
155
|
+
# Type checking
|
|
156
|
+
npm run typecheck
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Project Structure
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
langflow-mcp/
|
|
163
|
+
├── src/
|
|
164
|
+
│ ├── mcp/
|
|
165
|
+
│ │ ├── index.ts # MCP server entry point
|
|
166
|
+
│ │ ├── server.ts # MCP server implementation
|
|
167
|
+
│ │ └── tools.ts # Tool definitions
|
|
168
|
+
│ ├── services/
|
|
169
|
+
│ │ └── langflow-client.ts # Langflow API client
|
|
170
|
+
│ ├── types/
|
|
171
|
+
│ │ └── index.ts # TypeScript types
|
|
172
|
+
│ └── utils/
|
|
173
|
+
│ └── logger.ts # Logging utility
|
|
174
|
+
├── .env.example # Example configuration
|
|
175
|
+
├── package.json
|
|
176
|
+
├── tsconfig.json
|
|
177
|
+
└── README.md
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Attribution
|
|
181
|
+
|
|
182
|
+
This project is inspired by and follows the structure of [n8n-mcp](https://github.com/czlonkowski/n8n-mcp) by Romuald Czlonkowski. Special thanks to the n8n-mcp project for the excellent MCP server architecture and implementation patterns.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT License - see LICENSE for details.
|
|
187
|
+
|
|
188
|
+
## Contributing
|
|
189
|
+
|
|
190
|
+
Contributions are welcome! Please:
|
|
191
|
+
1. Fork the repository
|
|
192
|
+
2. Create a feature branch
|
|
193
|
+
3. Run tests (`npm test`)
|
|
194
|
+
4. Submit a pull request
|
|
195
|
+
|
|
196
|
+
## Acknowledgments
|
|
197
|
+
|
|
198
|
+
- [Langflow](https://github.com/logspace-ai/langflow) team for the workflow automation platform
|
|
199
|
+
- [Anthropic](https://anthropic.com) for the Model Context Protocol
|
|
200
|
+
- [czlonkowski/n8n-mcp](https://github.com/czlonkowski/n8n-mcp) for the inspiration and architecture
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
Built with ❤️ for the Langflow community
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.LangflowMCPServer = exports.LangflowClient = void 0;
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
var langflow_client_1 = require("./services/langflow-client");
|
|
20
|
+
Object.defineProperty(exports, "LangflowClient", { enumerable: true, get: function () { return langflow_client_1.LangflowClient; } });
|
|
21
|
+
var server_1 = require("./mcp/server");
|
|
22
|
+
Object.defineProperty(exports, "LangflowMCPServer", { enumerable: true, get: function () { return server_1.LangflowMCPServer; } });
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,8DAA4D;AAAnD,iHAAA,cAAc,OAAA;AACvB,uCAAiD;AAAxC,2GAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
const server_1 = require("./server");
|
|
38
|
+
const logger_1 = require("../utils/logger");
|
|
39
|
+
const dotenv = __importStar(require("dotenv"));
|
|
40
|
+
dotenv.config();
|
|
41
|
+
process.on('uncaughtException', (error) => {
|
|
42
|
+
if (process.env.MCP_MODE !== 'stdio') {
|
|
43
|
+
console.error('Uncaught Exception:', error);
|
|
44
|
+
}
|
|
45
|
+
logger_1.logger.error('Uncaught Exception:', error);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
});
|
|
48
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
49
|
+
if (process.env.MCP_MODE !== 'stdio') {
|
|
50
|
+
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
|
|
51
|
+
}
|
|
52
|
+
logger_1.logger.error('Unhandled Rejection:', reason);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
});
|
|
55
|
+
async function main() {
|
|
56
|
+
try {
|
|
57
|
+
const mode = process.env.MCP_MODE || 'stdio';
|
|
58
|
+
if (mode === 'http') {
|
|
59
|
+
logger_1.logger.error('HTTP mode not yet implemented. Use stdio mode.');
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
const server = new server_1.LangflowMCPServer();
|
|
63
|
+
let isShuttingDown = false;
|
|
64
|
+
const shutdown = async (signal = 'UNKNOWN') => {
|
|
65
|
+
if (isShuttingDown)
|
|
66
|
+
return;
|
|
67
|
+
isShuttingDown = true;
|
|
68
|
+
try {
|
|
69
|
+
logger_1.logger.info(`Shutdown initiated by: ${signal}`);
|
|
70
|
+
await server.shutdown();
|
|
71
|
+
if (process.stdin && !process.stdin.destroyed) {
|
|
72
|
+
process.stdin.pause();
|
|
73
|
+
process.stdin.destroy();
|
|
74
|
+
}
|
|
75
|
+
setTimeout(() => {
|
|
76
|
+
logger_1.logger.warn('Shutdown timeout exceeded, forcing exit');
|
|
77
|
+
process.exit(0);
|
|
78
|
+
}, 1000).unref();
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
logger_1.logger.error('Error during shutdown:', error);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
86
|
+
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
87
|
+
process.on('SIGHUP', () => shutdown('SIGHUP'));
|
|
88
|
+
if (process.stdin.readable && !process.stdin.destroyed) {
|
|
89
|
+
try {
|
|
90
|
+
process.stdin.on('end', () => shutdown('STDIN_END'));
|
|
91
|
+
process.stdin.on('close', () => shutdown('STDIN_CLOSE'));
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
logger_1.logger.error('Failed to register stdin handlers:', error);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
await server.run();
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
logger_1.logger.error('Failed to start MCP server:', error);
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (require.main === module) {
|
|
105
|
+
main().catch(console.error);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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AAS,EAAE,CAAC;YACvD,IAAI,CAAC;gBACH,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;gBACrD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;YAC3D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,eAAM,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QAED,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAWA,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAA+B;;IAmC7C,OAAO,CAAC,aAAa;IA4If,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAMpB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAIhC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LangflowMCPServer = void 0;
|
|
4
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
5
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
7
|
+
const tools_1 = require("./tools");
|
|
8
|
+
const logger_1 = require("../utils/logger");
|
|
9
|
+
const langflow_client_1 = require("../services/langflow-client");
|
|
10
|
+
class LangflowMCPServer {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.client = null;
|
|
13
|
+
const baseUrl = process.env.LANGFLOW_BASE_URL;
|
|
14
|
+
const apiKey = process.env.LANGFLOW_API_KEY;
|
|
15
|
+
if (!baseUrl || !apiKey) {
|
|
16
|
+
throw new Error('LANGFLOW_BASE_URL and LANGFLOW_API_KEY must be set in environment');
|
|
17
|
+
}
|
|
18
|
+
const config = {
|
|
19
|
+
baseUrl,
|
|
20
|
+
apiKey,
|
|
21
|
+
timeout: parseInt(process.env.LANGFLOW_TIMEOUT || '30000', 10)
|
|
22
|
+
};
|
|
23
|
+
this.client = new langflow_client_1.LangflowClient(config);
|
|
24
|
+
logger_1.logger.info('Initializing Langflow MCP server');
|
|
25
|
+
this.server = new index_js_1.Server({
|
|
26
|
+
name: 'langflow-mcp',
|
|
27
|
+
version: '1.0.0',
|
|
28
|
+
}, {
|
|
29
|
+
capabilities: {
|
|
30
|
+
tools: {},
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
this.setupHandlers();
|
|
34
|
+
}
|
|
35
|
+
setupHandlers() {
|
|
36
|
+
this.server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
|
|
37
|
+
return {
|
|
38
|
+
tools: tools_1.langflowMCPTools.map(tool => ({
|
|
39
|
+
name: tool.name,
|
|
40
|
+
description: tool.description,
|
|
41
|
+
inputSchema: tool.inputSchema,
|
|
42
|
+
})),
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
46
|
+
if (!this.client) {
|
|
47
|
+
throw new Error('Langflow client not initialized');
|
|
48
|
+
}
|
|
49
|
+
const { name, arguments: args } = request.params;
|
|
50
|
+
if (!args) {
|
|
51
|
+
throw new Error('No arguments provided');
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
switch (name) {
|
|
55
|
+
case 'create_flow':
|
|
56
|
+
const created = await this.client.createFlow({
|
|
57
|
+
name: args.name,
|
|
58
|
+
description: args.description,
|
|
59
|
+
data: args.data,
|
|
60
|
+
folder_id: args.folder_id
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
type: 'text',
|
|
66
|
+
text: JSON.stringify(created, null, 2)
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
};
|
|
70
|
+
case 'list_flows':
|
|
71
|
+
const flows = await this.client.listFlows({
|
|
72
|
+
page: args.page,
|
|
73
|
+
size: args.size,
|
|
74
|
+
folder_id: args.folder_id,
|
|
75
|
+
components_only: args.components_only,
|
|
76
|
+
get_all: args.get_all
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: 'text',
|
|
82
|
+
text: JSON.stringify(flows, null, 2)
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
};
|
|
86
|
+
case 'get_flow':
|
|
87
|
+
const flow = await this.client.getFlow(args.flow_id);
|
|
88
|
+
return {
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
type: 'text',
|
|
92
|
+
text: JSON.stringify(flow, null, 2)
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
};
|
|
96
|
+
case 'update_flow':
|
|
97
|
+
const updated = await this.client.updateFlow(args.flow_id, {
|
|
98
|
+
name: args.name,
|
|
99
|
+
description: args.description,
|
|
100
|
+
data: args.data,
|
|
101
|
+
folder_id: args.folder_id
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: 'text',
|
|
107
|
+
text: JSON.stringify(updated, null, 2)
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
};
|
|
111
|
+
case 'delete_flow':
|
|
112
|
+
await this.client.deleteFlow(args.flow_id);
|
|
113
|
+
return {
|
|
114
|
+
content: [
|
|
115
|
+
{
|
|
116
|
+
type: 'text',
|
|
117
|
+
text: JSON.stringify({ success: true, message: 'Flow deleted' })
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
};
|
|
121
|
+
case 'delete_flows':
|
|
122
|
+
const result = await this.client.deleteFlows(args.flow_ids);
|
|
123
|
+
return {
|
|
124
|
+
content: [
|
|
125
|
+
{
|
|
126
|
+
type: 'text',
|
|
127
|
+
text: JSON.stringify(result, null, 2)
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
case 'list_components':
|
|
132
|
+
const components = await this.client.listComponents();
|
|
133
|
+
return {
|
|
134
|
+
content: [
|
|
135
|
+
{
|
|
136
|
+
type: 'text',
|
|
137
|
+
text: JSON.stringify(components, null, 2)
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
};
|
|
141
|
+
default:
|
|
142
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
logger_1.logger.error(`Error executing tool ${name}:`, error);
|
|
147
|
+
return {
|
|
148
|
+
content: [
|
|
149
|
+
{
|
|
150
|
+
type: 'text',
|
|
151
|
+
text: JSON.stringify({
|
|
152
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
isError: true
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
async run() {
|
|
162
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
163
|
+
await this.server.connect(transport);
|
|
164
|
+
logger_1.logger.info('Langflow MCP server running on stdio');
|
|
165
|
+
}
|
|
166
|
+
async shutdown() {
|
|
167
|
+
logger_1.logger.info('Shutting down Langflow MCP server');
|
|
168
|
+
await this.server.close();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.LangflowMCPServer = LangflowMCPServer;
|
|
172
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AACnE,wEAAiF;AACjF,iEAG4C;AAC5C,mCAA2C;AAC3C,4CAAyC;AACzC,iEAA6D;AAG7D,MAAa,iBAAiB;IAI5B;QAFQ,WAAM,GAA0B,IAAI,CAAC;QAG3C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;QAE5C,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;QACvF,CAAC;QAED,MAAM,MAAM,GAAmB;YAC7B,OAAO;YACP,MAAM;YACN,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,OAAO,EAAE,EAAE,CAAC;SAC/D,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,IAAI,gCAAc,CAAC,MAAM,CAAC,CAAC;QAEzC,eAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QAEhD,IAAI,CAAC,MAAM,GAAG,IAAI,iBAAM,CACtB;YACE,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,OAAO;SACjB,EACD;YACE,YAAY,EAAE;gBACZ,KAAK,EAAE,EAAE;aACV;SACF,CACF,CAAC;QAEF,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAEO,aAAa;QACnB,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,iCAAsB,E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AC,GAAG;QACP,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;QAC7C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACrC,eAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,eAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QACjD,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF;AA3LD,8CA2LC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAyI5C,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.langflowMCPTools = void 0;
|
|
4
|
+
exports.langflowMCPTools = [
|
|
5
|
+
{
|
|
6
|
+
name: 'create_flow',
|
|
7
|
+
description: 'Create a new Langflow flow. Pass name and optional description, data, folder_id.',
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
name: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
description: 'The name of the flow'
|
|
14
|
+
},
|
|
15
|
+
description: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'Optional description of the flow'
|
|
18
|
+
},
|
|
19
|
+
data: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
description: 'Optional flow data/configuration'
|
|
22
|
+
},
|
|
23
|
+
folder_id: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Optional folder ID to organize the flow'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
required: ['name']
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'list_flows',
|
|
33
|
+
description: 'List all Langflow flows with optional pagination and filtering.',
|
|
34
|
+
inputSchema: {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
page: {
|
|
38
|
+
type: 'number',
|
|
39
|
+
description: 'Page number for pagination (default: 1)'
|
|
40
|
+
},
|
|
41
|
+
size: {
|
|
42
|
+
type: 'number',
|
|
43
|
+
description: 'Number of items per page (default: 50, max: 100)'
|
|
44
|
+
},
|
|
45
|
+
folder_id: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
description: 'Filter by folder ID'
|
|
48
|
+
},
|
|
49
|
+
components_only: {
|
|
50
|
+
type: 'boolean',
|
|
51
|
+
description: 'Return only components (default: false)'
|
|
52
|
+
},
|
|
53
|
+
get_all: {
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
description: 'Get all flows without pagination (default: true)'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'get_flow',
|
|
62
|
+
description: 'Get details of a specific flow by ID.',
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: {
|
|
66
|
+
flow_id: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
description: 'The ID of the flow to retrieve'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
required: ['flow_id']
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'update_flow',
|
|
76
|
+
description: 'Update an existing flow. Pass flow_id and fields to update.',
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: {
|
|
80
|
+
flow_id: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
description: 'The ID of the flow to update'
|
|
83
|
+
},
|
|
84
|
+
name: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
description: 'New name for the flow'
|
|
87
|
+
},
|
|
88
|
+
description: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
description: 'New description for the flow'
|
|
91
|
+
},
|
|
92
|
+
data: {
|
|
93
|
+
type: 'object',
|
|
94
|
+
description: 'New flow data/configuration'
|
|
95
|
+
},
|
|
96
|
+
folder_id: {
|
|
97
|
+
type: 'string',
|
|
98
|
+
description: 'New folder ID'
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
required: ['flow_id']
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'delete_flow',
|
|
106
|
+
description: 'Delete a single flow by ID.',
|
|
107
|
+
inputSchema: {
|
|
108
|
+
type: 'object',
|
|
109
|
+
properties: {
|
|
110
|
+
flow_id: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
description: 'The ID of the flow to delete'
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
required: ['flow_id']
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'delete_flows',
|
|
120
|
+
description: 'Delete multiple flows at once. Pass array of flow IDs.',
|
|
121
|
+
inputSchema: {
|
|
122
|
+
type: 'object',
|
|
123
|
+
properties: {
|
|
124
|
+
flow_ids: {
|
|
125
|
+
type: 'array',
|
|
126
|
+
items: { type: 'string' },
|
|
127
|
+
description: 'Array of flow IDs to delete'
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
required: ['flow_ids']
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'list_components',
|
|
135
|
+
description: 'List all available Langflow components. Returns components with their types, names, and descriptions.',
|
|
136
|
+
inputSchema: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
properties: {}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
];
|
|
142
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["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YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LangflowConfig, FlowCreate, FlowRead, FlowUpdate, ListFlowsParams, ComponentInfo } from '../types';
|
|
2
|
+
export declare class LangflowClient {
|
|
3
|
+
private client;
|
|
4
|
+
private config;
|
|
5
|
+
constructor(config: LangflowConfig);
|
|
6
|
+
createFlow(flow: FlowCreate): Promise<FlowRead>;
|
|
7
|
+
listFlows(params?: ListFlowsParams): Promise<FlowRead[]>;
|
|
8
|
+
getFlow(flowId: string): Promise<FlowRead>;
|
|
9
|
+
updateFlow(flowId: string, updates: FlowUpdate): Promise<FlowRead>;
|
|
10
|
+
deleteFlow(flowId: string): Promise<void>;
|
|
11
|
+
deleteFlows(flowIds: string[]): Promise<{
|
|
12
|
+
deleted: number;
|
|
13
|
+
}>;
|
|
14
|
+
listComponents(): Promise<ComponentInfo[]>;
|
|
15
|
+
healthCheck(): Promise<boolean>;
|
|
16
|
+
private handleError;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=langflow-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langflow-client.d.ts","sourceRoot":"","sources":["../../src/services/langflow-client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,UAAU,EACV,QAAQ,EACR,UAAU,EACV,eAAe,EAEf,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAiB;gBAEnB,MAAM,EAAE,cAAc;IAY5B,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IAS/C,SAAS,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IASxD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAS1C,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IASlE,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAW5D,cAAc,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IA0B1C,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IASrC,OAAO,CAAC,WAAW;CAmBpB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LangflowClient = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
class LangflowClient {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
this.client = axios_1.default.create({
|
|
12
|
+
baseURL: `${config.baseUrl}/api/v1`,
|
|
13
|
+
timeout: config.timeout || 30000,
|
|
14
|
+
headers: {
|
|
15
|
+
'Content-Type': 'application/json',
|
|
16
|
+
'x-api-key': config.apiKey
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async createFlow(flow) {
|
|
21
|
+
try {
|
|
22
|
+
const response = await this.client.post('/flows/', flow);
|
|
23
|
+
return response.data;
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
throw this.handleError(error, 'Failed to create flow');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async listFlows(params) {
|
|
30
|
+
try {
|
|
31
|
+
const response = await this.client.get('/flows/', { params });
|
|
32
|
+
return response.data;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw this.handleError(error, 'Failed to list flows');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async getFlow(flowId) {
|
|
39
|
+
try {
|
|
40
|
+
const response = await this.client.get(`/flows/${flowId}`);
|
|
41
|
+
return response.data;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
throw this.handleError(error, `Failed to get flow ${flowId}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async updateFlow(flowId, updates) {
|
|
48
|
+
try {
|
|
49
|
+
const response = await this.client.patch(`/flows/${flowId}`, updates);
|
|
50
|
+
return response.data;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
throw this.handleError(error, `Failed to update flow ${flowId}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async deleteFlow(flowId) {
|
|
57
|
+
try {
|
|
58
|
+
await this.client.delete(`/flows/${flowId}`);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
throw this.handleError(error, `Failed to delete flow ${flowId}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async deleteFlows(flowIds) {
|
|
65
|
+
try {
|
|
66
|
+
const response = await this.client.delete('/flows/', {
|
|
67
|
+
data: flowIds
|
|
68
|
+
});
|
|
69
|
+
return response.data;
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
throw this.handleError(error, 'Failed to delete flows');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async listComponents() {
|
|
76
|
+
try {
|
|
77
|
+
const response = await this.client.get('/all');
|
|
78
|
+
const components = [];
|
|
79
|
+
if (response.data && typeof response.data === 'object') {
|
|
80
|
+
Object.entries(response.data).forEach(([category, items]) => {
|
|
81
|
+
if (items && typeof items === 'object') {
|
|
82
|
+
Object.entries(items).forEach(([name, info]) => {
|
|
83
|
+
components.push({
|
|
84
|
+
name,
|
|
85
|
+
display_name: info.display_name || name,
|
|
86
|
+
description: info.description || '',
|
|
87
|
+
type: category
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return components;
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw this.handleError(error, 'Failed to list components');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async healthCheck() {
|
|
100
|
+
try {
|
|
101
|
+
await this.client.get('/health');
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
handleError(error, message) {
|
|
109
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
110
|
+
const axiosError = error;
|
|
111
|
+
const status = axiosError.response?.status;
|
|
112
|
+
const data = axiosError.response?.data;
|
|
113
|
+
return new Error(`${message}: ${status ? `HTTP ${status}` : 'Network error'} - ${data ? JSON.stringify(data) : axiosError.message}`);
|
|
114
|
+
}
|
|
115
|
+
if (error instanceof Error) {
|
|
116
|
+
return new Error(`${message}: ${error.message}`);
|
|
117
|
+
}
|
|
118
|
+
return new Error(`${message}: Unknown error`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.LangflowClient = LangflowClient;
|
|
122
|
+
//# sourceMappingURL=langflow-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langflow-client.js","sourceRoot":"","sources":["../../src/services/langflow-client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyD;AAWzD,MAAa,cAAc;IAIzB,YAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,SAAS;YACnC,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK;YAChC,OAAO,EAAE;gB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C,UAAU,CAAC,OAC3C,EAAE,CACH,CAAC;QACJ,CAAC;QAED,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,IAAI,KAAK,CAAC,GAAG,OAAO,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,IAAI,KAAK,CAAC,GAAG,OAAO,iBAAiB,CAAC,CAAC;IAChD,CAAC;CACF;AA7HD,wCA6HC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface MCPServerConfig {
|
|
2
|
+
port: number;
|
|
3
|
+
host: string;
|
|
4
|
+
authToken?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ToolDefinition {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
properties: Record<string, any>;
|
|
12
|
+
required?: string[];
|
|
13
|
+
additionalProperties?: boolean | Record<string, any>;
|
|
14
|
+
};
|
|
15
|
+
outputSchema?: {
|
|
16
|
+
type: string;
|
|
17
|
+
properties: Record<string, any>;
|
|
18
|
+
required?: string[];
|
|
19
|
+
additionalProperties?: boolean | Record<string, any>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface LangflowConfig {
|
|
23
|
+
baseUrl: string;
|
|
24
|
+
apiKey: string;
|
|
25
|
+
timeout?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface FlowCreate {
|
|
28
|
+
name: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
data?: any;
|
|
31
|
+
folder_id?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface FlowRead {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
data?: any;
|
|
38
|
+
user_id: string;
|
|
39
|
+
folder_id?: string;
|
|
40
|
+
created_at: string;
|
|
41
|
+
updated_at: string;
|
|
42
|
+
}
|
|
43
|
+
export interface FlowUpdate {
|
|
44
|
+
name?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
data?: any;
|
|
47
|
+
folder_id?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ComponentInfo {
|
|
50
|
+
name: string;
|
|
51
|
+
display_name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
type: string;
|
|
54
|
+
}
|
|
55
|
+
export interface ListFlowsParams {
|
|
56
|
+
page?: number;
|
|
57
|
+
size?: number;
|
|
58
|
+
folder_id?: string;
|
|
59
|
+
components_only?: boolean;
|
|
60
|
+
get_all?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface DeleteFlowsRequest {
|
|
63
|
+
flow_ids: string[];
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,oBAAoB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACtD,CAAC;IACF,YAAY,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,oBAAoB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,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
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const logger: {
|
|
2
|
+
info: (message: string, ...args: any[]) => void;
|
|
3
|
+
error: (message: string, ...args: any[]) => void;
|
|
4
|
+
warn: (message: string, ...args: any[]) => void;
|
|
5
|
+
debug: (message: string, ...args: any[]) => void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;oBACD,MAAM,WAAW,GAAG,EAAE;qBAKrB,MAAM,WAAW,GAAG,EAAE;oBAGvB,MAAM,WAAW,GAAG,EAAE;qBAKrB,MAAM,WAAW,GAAG,EAAE;CAKxC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logger = void 0;
|
|
4
|
+
exports.logger = {
|
|
5
|
+
info: (message, ...args) => {
|
|
6
|
+
if (process.env.LOG_LEVEL !== 'error') {
|
|
7
|
+
console.error('[INFO]', message, ...args);
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
error: (message, ...args) => {
|
|
11
|
+
console.error('[ERROR]', message, ...args);
|
|
12
|
+
},
|
|
13
|
+
warn: (message, ...args) => {
|
|
14
|
+
if (process.env.LOG_LEVEL !== 'error') {
|
|
15
|
+
console.error('[WARN]', message, ...args);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
debug: (message, ...args) => {
|
|
19
|
+
if (process.env.LOG_LEVEL === 'debug') {
|
|
20
|
+
console.error('[DEBUG]', message, ...args);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACxC,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,OAAO,EAAE,CAAC;YACtC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,KAAK,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACzC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACxC,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,OAAO,EAAE,CAAC;YACtC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,KAAK,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACzC,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,OAAO,EAAE,CAAC;YACtC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "langflow-mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Integration between Langflow and Model Context Protocol (MCP)",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"langflow-mcp-server": "./dist/mcp/index.js"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc -p tsconfig.build.json",
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"start": "node dist/mcp/index.js",
|
|
21
|
+
"start:http": "MCP_MODE=http node dist/mcp/index.js",
|
|
22
|
+
"dev": "npm run build && npm run start",
|
|
23
|
+
"dev:http": "MCP_MODE=http nodemon --watch src --ext ts --exec 'npm run build && npm run start:http'",
|
|
24
|
+
"test": "vitest",
|
|
25
|
+
"test:ui": "vitest --ui",
|
|
26
|
+
"test:run": "vitest run",
|
|
27
|
+
"test:coverage": "vitest run --coverage",
|
|
28
|
+
"test:watch": "vitest watch",
|
|
29
|
+
"lint": "tsc --noEmit",
|
|
30
|
+
"typecheck": "tsc --noEmit"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/nobrainer-tech/langflow-mcp.git"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"langflow",
|
|
38
|
+
"mcp",
|
|
39
|
+
"model-context-protocol",
|
|
40
|
+
"ai",
|
|
41
|
+
"workflow",
|
|
42
|
+
"automation"
|
|
43
|
+
],
|
|
44
|
+
"author": "nobrainer-tech",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/nobrainer-tech/langflow-mcp/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/nobrainer-tech/langflow-mcp#readme",
|
|
50
|
+
"files": [
|
|
51
|
+
"dist/**/*",
|
|
52
|
+
".env.example",
|
|
53
|
+
"README.md",
|
|
54
|
+
"LICENSE"
|
|
55
|
+
],
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@types/node": "^22.15.30",
|
|
58
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
59
|
+
"@vitest/ui": "^3.2.4",
|
|
60
|
+
"axios-mock-adapter": "^2.1.0",
|
|
61
|
+
"nodemon": "^3.1.10",
|
|
62
|
+
"ts-node": "^10.9.2",
|
|
63
|
+
"typescript": "^5.8.3",
|
|
64
|
+
"vitest": "^3.2.4"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@modelcontextprotocol/sdk": "^1.13.2",
|
|
68
|
+
"axios": "^1.11.0",
|
|
69
|
+
"dotenv": "^16.5.0",
|
|
70
|
+
"zod": "^3.24.1"
|
|
71
|
+
}
|
|
72
|
+
}
|