@elnora-ai/mcp-server 0.1.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/CHANGELOG.md +20 -0
- package/LICENSE +201 -0
- package/README.md +194 -0
- package/dist/auth/middleware.d.ts +12 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +40 -0
- package/dist/auth/middleware.js.map +1 -0
- package/dist/auth/protected-resource.d.ts +4 -0
- package/dist/auth/protected-resource.d.ts.map +1 -0
- package/dist/auth/protected-resource.js +19 -0
- package/dist/auth/protected-resource.js.map +1 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +6 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +17 -0
- package/dist/server.js.map +1 -0
- package/dist/services/elnora-api-client.d.ts +29 -0
- package/dist/services/elnora-api-client.d.ts.map +1 -0
- package/dist/services/elnora-api-client.js +71 -0
- package/dist/services/elnora-api-client.js.map +1 -0
- package/dist/services/error-handler.d.ts +2 -0
- package/dist/services/error-handler.d.ts.map +1 -0
- package/dist/services/error-handler.js +33 -0
- package/dist/services/error-handler.js.map +1 -0
- package/dist/tools/files.d.ts +4 -0
- package/dist/tools/files.d.ts.map +1 -0
- package/dist/tools/files.js +64 -0
- package/dist/tools/files.js.map +1 -0
- package/dist/tools/messages.d.ts +4 -0
- package/dist/tools/messages.d.ts.map +1 -0
- package/dist/tools/messages.js +30 -0
- package/dist/tools/messages.js.map +1 -0
- package/dist/tools/protocols.d.ts +4 -0
- package/dist/tools/protocols.d.ts.map +1 -0
- package/dist/tools/protocols.js +45 -0
- package/dist/tools/protocols.js.map +1 -0
- package/dist/tools/tasks.d.ts +4 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +68 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/types.d.ts +49 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +54 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the Elnora MCP Server will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-02-27
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Initial release of Elnora MCP Server
|
|
15
|
+
- 8 MCP tools: `elnora_create_task`, `elnora_list_tasks`, `elnora_get_task_messages`,
|
|
16
|
+
`elnora_send_message`, `elnora_list_files`, `elnora_get_file_content`,
|
|
17
|
+
`elnora_upload_file`, `elnora_generate_protocol`
|
|
18
|
+
- HTTP transport (Streamable HTTP) with OAuth 2.1 and API key authentication
|
|
19
|
+
- Protected Resource Metadata endpoint (RFC 9728)
|
|
20
|
+
- Health check endpoint
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Elnora MCP Server
|
|
2
|
+
|
|
3
|
+
Connect AI agents to the [Elnora](https://elnora.ai) bioprotocol optimization platform via the [Model Context Protocol](https://modelcontextprotocol.io).
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
## What is Elnora?
|
|
8
|
+
|
|
9
|
+
Elnora is an AI-powered platform that helps researchers generate, optimize, and manage bioprotocols for wet-lab experiments. With this MCP server, you can interact with Elnora directly from AI coding assistants like Claude Code, Codex, Cursor, VS Code, and ChatGPT.
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
Add the Elnora MCP server to your AI client. No installation required — just point to the remote URL.
|
|
14
|
+
|
|
15
|
+
### Claude Code
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
claude mcp add elnora --transport streamable-http https://mcp.elnora.ai/mcp
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Cursor
|
|
22
|
+
|
|
23
|
+
Add to your Cursor MCP settings (Settings > MCP Servers):
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"elnora": {
|
|
29
|
+
"url": "https://mcp.elnora.ai/mcp"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### VS Code (Copilot)
|
|
36
|
+
|
|
37
|
+
Add to your `.vscode/mcp.json`:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"servers": {
|
|
42
|
+
"elnora": {
|
|
43
|
+
"type": "streamable-http",
|
|
44
|
+
"url": "https://mcp.elnora.ai/mcp"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Codex
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
codex --mcp-config mcp.json
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
With `mcp.json`:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"mcpServers": {
|
|
61
|
+
"elnora": {
|
|
62
|
+
"url": "https://mcp.elnora.ai/mcp"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### ChatGPT
|
|
69
|
+
|
|
70
|
+
Add as a remote MCP server in ChatGPT settings using the URL `https://mcp.elnora.ai/mcp`.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
On first connection, a browser window will open for OAuth login. Subsequent requests use the issued token automatically.
|
|
75
|
+
|
|
76
|
+
## Available Tools
|
|
77
|
+
|
|
78
|
+
### Tasks
|
|
79
|
+
|
|
80
|
+
| Tool | Description |
|
|
81
|
+
|------|-------------|
|
|
82
|
+
| `elnora_create_task` | Create a new task (conversation thread) for interacting with Elnora's AI |
|
|
83
|
+
| `elnora_list_tasks` | List tasks in your workspace with optional status filter |
|
|
84
|
+
| `elnora_get_task_messages` | Get the message history for a specific task |
|
|
85
|
+
|
|
86
|
+
### Messages
|
|
87
|
+
|
|
88
|
+
| Tool | Description |
|
|
89
|
+
|------|-------------|
|
|
90
|
+
| `elnora_send_message` | Send a message to a task and receive an AI response (30-120s for complex requests) |
|
|
91
|
+
|
|
92
|
+
### Files
|
|
93
|
+
|
|
94
|
+
| Tool | Description |
|
|
95
|
+
|------|-------------|
|
|
96
|
+
| `elnora_list_files` | List files in your workspace with optional project filter |
|
|
97
|
+
| `elnora_get_file_content` | Retrieve the content of a specific file |
|
|
98
|
+
| `elnora_upload_file` | Upload a text file to your workspace |
|
|
99
|
+
|
|
100
|
+
### Protocols
|
|
101
|
+
|
|
102
|
+
| Tool | Description |
|
|
103
|
+
|------|-------------|
|
|
104
|
+
| `elnora_generate_protocol` | Generate a bioprotocol — creates a task, sends your description, and returns the result |
|
|
105
|
+
|
|
106
|
+
## Authentication
|
|
107
|
+
|
|
108
|
+
### OAuth 2.1 (Recommended)
|
|
109
|
+
|
|
110
|
+
Most MCP clients handle OAuth automatically. On first connection:
|
|
111
|
+
|
|
112
|
+
1. A browser window opens for login
|
|
113
|
+
2. You authenticate with your Elnora account
|
|
114
|
+
3. The client receives a token and uses it for subsequent requests
|
|
115
|
+
|
|
116
|
+
No manual configuration needed.
|
|
117
|
+
|
|
118
|
+
### API Key
|
|
119
|
+
|
|
120
|
+
Alternatively, create an API key in your [Elnora dashboard](https://platform.elnora.ai) and pass it as a Bearer token:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"mcpServers": {
|
|
125
|
+
"elnora": {
|
|
126
|
+
"url": "https://mcp.elnora.ai/mcp",
|
|
127
|
+
"headers": {
|
|
128
|
+
"Authorization": "Bearer YOUR_API_KEY"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Security best practices:**
|
|
136
|
+
- Never commit API keys to version control
|
|
137
|
+
- Use environment variables or a secrets manager
|
|
138
|
+
- Rotate keys periodically via the Elnora dashboard
|
|
139
|
+
- Use OAuth when possible — it handles token refresh automatically
|
|
140
|
+
|
|
141
|
+
## Examples
|
|
142
|
+
|
|
143
|
+
### Generate a bioprotocol
|
|
144
|
+
|
|
145
|
+
Ask your AI assistant:
|
|
146
|
+
|
|
147
|
+
> "Use Elnora to generate a HEK 293 cell maintenance protocol"
|
|
148
|
+
|
|
149
|
+
The assistant will call `elnora_generate_protocol` with your description and return the generated protocol.
|
|
150
|
+
|
|
151
|
+
### Search and read files
|
|
152
|
+
|
|
153
|
+
> "List my files in Elnora, then show me the content of the most recent protocol"
|
|
154
|
+
|
|
155
|
+
The assistant will call `elnora_list_files` followed by `elnora_get_file_content`.
|
|
156
|
+
|
|
157
|
+
### Manage tasks
|
|
158
|
+
|
|
159
|
+
> "Show me my active Elnora tasks and get the messages from the latest one"
|
|
160
|
+
|
|
161
|
+
The assistant will call `elnora_list_tasks` and then `elnora_get_task_messages`.
|
|
162
|
+
|
|
163
|
+
## Troubleshooting
|
|
164
|
+
|
|
165
|
+
| Error | Cause | Solution |
|
|
166
|
+
|-------|-------|----------|
|
|
167
|
+
| 401 Unauthorized | Missing or expired token | Re-authenticate via OAuth or check your API key |
|
|
168
|
+
| 403 Forbidden | Insufficient permissions | Verify your account has access to the requested resource |
|
|
169
|
+
| 408 / Timeout | Complex operation taking too long | Protocol generation can take up to 120s — try again or simplify the request |
|
|
170
|
+
| Connection refused | Server unreachable | Check your internet connection; verify `https://mcp.elnora.ai/health` is accessible |
|
|
171
|
+
|
|
172
|
+
If you encounter persistent issues, please [open a GitHub issue](https://github.com/Elnora-AI/elnora-mcp-server/issues).
|
|
173
|
+
|
|
174
|
+
## Security
|
|
175
|
+
|
|
176
|
+
We take security seriously. If you discover a vulnerability, please report it responsibly — see our [security policy](.github/SECURITY.md).
|
|
177
|
+
|
|
178
|
+
## Changelog
|
|
179
|
+
|
|
180
|
+
See [CHANGELOG.md](CHANGELOG.md) for version history.
|
|
181
|
+
|
|
182
|
+
## Contributing
|
|
183
|
+
|
|
184
|
+
See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for contribution guidelines.
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
This project is licensed under the [Apache License 2.0](LICENSE).
|
|
189
|
+
|
|
190
|
+
## Support
|
|
191
|
+
|
|
192
|
+
- **Bug reports and feature requests:** [GitHub Issues](https://github.com/Elnora-AI/elnora-mcp-server/issues)
|
|
193
|
+
- **Account and billing questions:** [support@elnora.ai](mailto:support@elnora.ai)
|
|
194
|
+
- **Security vulnerabilities:** [security@elnora.ai](mailto:security@elnora.ai)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from "express";
|
|
2
|
+
import { AuthContext, ElnoraConfig } from "../types.js";
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Express {
|
|
5
|
+
interface Request {
|
|
6
|
+
authContext?: AuthContext;
|
|
7
|
+
bearerToken?: string;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare function authMiddleware(config: ElnoraConfig): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
12
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/auth/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,OAAO,CAAC;QAChB,UAAU,OAAO;YACf,WAAW,CAAC,EAAE,WAAW,CAAC;YAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB;KACF;CACF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,IACnC,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,KAAG,OAAO,CAAC,IAAI,CAAC,CA2C9E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ElnoraApiClient } from "../services/elnora-api-client.js";
|
|
2
|
+
export function authMiddleware(config) {
|
|
3
|
+
return async (req, res, next) => {
|
|
4
|
+
const authHeader = req.headers.authorization;
|
|
5
|
+
if (!authHeader || !authHeader.startsWith("Bearer ")) {
|
|
6
|
+
res.setHeader("WWW-Authenticate", `Bearer resource_metadata="${req.protocol}://${req.get("host")}/.well-known/oauth-protected-resource"`);
|
|
7
|
+
res.status(401).json({
|
|
8
|
+
error: "unauthorized",
|
|
9
|
+
error_description: "Bearer token required",
|
|
10
|
+
});
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const token = authHeader.slice(7); // Remove "Bearer "
|
|
14
|
+
try {
|
|
15
|
+
const validation = await ElnoraApiClient.validateToken(config.tokenValidationUrl, token);
|
|
16
|
+
if (!validation.valid || !validation.userId || !validation.organizationId) {
|
|
17
|
+
res.status(401).json({
|
|
18
|
+
error: "invalid_token",
|
|
19
|
+
error_description: "Token is invalid or expired",
|
|
20
|
+
});
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
req.authContext = {
|
|
24
|
+
userId: validation.userId,
|
|
25
|
+
organizationId: validation.organizationId,
|
|
26
|
+
scopes: validation.scopes || "",
|
|
27
|
+
tokenType: validation.tokenType || "unknown",
|
|
28
|
+
};
|
|
29
|
+
req.bearerToken = token;
|
|
30
|
+
next();
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
res.status(401).json({
|
|
34
|
+
error: "invalid_token",
|
|
35
|
+
error_description: "Token validation failed",
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/auth/middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAanE,MAAM,UAAU,cAAc,CAAC,MAAoB;IACjD,OAAO,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAiB,EAAE;QAC9E,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC;QAE7C,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACrD,GAAG,CAAC,SAAS,CACX,kBAAkB,EAClB,6BAA6B,GAAG,CAAC,QAAQ,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,wCAAwC,CACvG,CAAC;YACF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE,cAAc;gBACrB,iBAAiB,EAAE,uBAAuB;aAC3C,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,M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O,EAAE,KAAK,QAAQ,KAAG,IAAI,CAgB3C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function protectedResourceMetadataHandler(config) {
|
|
2
|
+
return (req, res) => {
|
|
3
|
+
const resource = process.env.RESOURCE_URL || `${req.protocol}://${req.get("host")}`;
|
|
4
|
+
res.json({
|
|
5
|
+
resource,
|
|
6
|
+
authorization_servers: [config.authUrl],
|
|
7
|
+
scopes_supported: [
|
|
8
|
+
"tasks:read",
|
|
9
|
+
"tasks:write",
|
|
10
|
+
"files:read",
|
|
11
|
+
"files:write",
|
|
12
|
+
"messages:read",
|
|
13
|
+
"messages:write",
|
|
14
|
+
],
|
|
15
|
+
bearer_methods_supported: ["header"],
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=protected-resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protected-resource.js","sourceRoot":"","sources":["../../src/auth/protected-resource.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,gCAAgC,CAAC,MAAoB;IACnE,OAAO,CAAC,GAAY,EAAE,GAAa,EAAQ,EAAE;QAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,GAAG,GAAG,CAAC,QAAQ,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QACpF,GAAG,CAAC,IAAI,CAAC;YACP,QAAQ;YACR,qBAAqB,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;YACvC,gBAAgB,EAAE;gBAChB,YAAY;gBACZ,aAAa;gBACb,YAAY;gBACZ,aAAa;gBACb,eAAe;gBACf,gBAAgB;aACjB;YACD,wBAAwB,EAAE,CAAC,QAAQ,CAAC;SACrC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CHARACTER_LIMIT = 25000;
|
|
2
|
+
export declare const DEFAULT_PAGE_SIZE = 20;
|
|
3
|
+
export declare const MAX_PAGE_SIZE = 100;
|
|
4
|
+
export declare const REQUEST_TIMEOUT_MS = 30000;
|
|
5
|
+
export declare const LONG_REQUEST_TIMEOUT_MS = 120000;
|
|
6
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AACxC,eAAO,MAAM,uBAAuB,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AACjC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACxC,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
2
|
+
import express from "express";
|
|
3
|
+
import { ElnoraApiClient } from "./services/elnora-api-client.js";
|
|
4
|
+
import { authMiddleware } from "./auth/middleware.js";
|
|
5
|
+
import { protectedResourceMetadataHandler } from "./auth/protected-resource.js";
|
|
6
|
+
import { createElnoraServer } from "./server.js";
|
|
7
|
+
function requireEnv(name) {
|
|
8
|
+
const value = process.env[name];
|
|
9
|
+
if (!value) {
|
|
10
|
+
throw new Error(`Required environment variable ${name} is not set`);
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
function loadConfig() {
|
|
15
|
+
return {
|
|
16
|
+
apiUrl: requireEnv("ELNORA_API_URL"),
|
|
17
|
+
authUrl: requireEnv("ELNORA_AUTH_URL"),
|
|
18
|
+
tokenValidationUrl: requireEnv("ELNORA_TOKEN_VALIDATION_URL"),
|
|
19
|
+
port: parseInt(process.env.PORT || "3000", 10),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async function main() {
|
|
23
|
+
const config = loadConfig();
|
|
24
|
+
const app = express();
|
|
25
|
+
app.use(express.json());
|
|
26
|
+
// Health check
|
|
27
|
+
app.get("/health", (_req, res) => {
|
|
28
|
+
res.json({ status: "ok", service: "elnora-mcp-server" });
|
|
29
|
+
});
|
|
30
|
+
// OAuth Protected Resource Metadata (per MCP spec, RFC 9728)
|
|
31
|
+
app.get("/.well-known/oauth-protected-resource", protectedResourceMetadataHandler(config));
|
|
32
|
+
// MCP endpoint with auth
|
|
33
|
+
app.post("/mcp", authMiddleware(config), async (req, res) => {
|
|
34
|
+
try {
|
|
35
|
+
// Create per-request MCP server and API client
|
|
36
|
+
const client = new ElnoraApiClient(config, req.bearerToken);
|
|
37
|
+
const getClient = () => client;
|
|
38
|
+
const server = createElnoraServer(config, getClient);
|
|
39
|
+
// Stateless transport — new transport per request
|
|
40
|
+
const transport = new StreamableHTTPServerTransport({
|
|
41
|
+
sessionIdGenerator: undefined,
|
|
42
|
+
enableJsonResponse: true,
|
|
43
|
+
});
|
|
44
|
+
res.on("close", () => transport.close());
|
|
45
|
+
await server.connect(transport);
|
|
46
|
+
await transport.handleRequest(req, res, req.body);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.error("MCP request error:", error);
|
|
50
|
+
if (!res.headersSent) {
|
|
51
|
+
res.status(500).json({ error: "internal_error", error_description: "MCP request failed" });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
app.listen(config.port, () => {
|
|
56
|
+
console.error(`Elnora MCP server running on http://localhost:${config.port}/mcp`);
|
|
57
|
+
console.error(`Protected Resource Metadata: http://localhost:${config.port}/.well-known/oauth-protected-resource`);
|
|
58
|
+
console.error(`Health check: http://localhost:${config.port}/health`);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
main().catch((error) => {
|
|
62
|
+
console.error("Server error:", error);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,SAAS,UAAU,CAAC,IAAY;IAC9B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,aAAa,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,UAAU;IACjB,OAAO;QACL,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,OAAO,EAAE,UAAU,CAAC,iBAAiB,CAAC;QACtC,kBAAkB,EAAE,UAAU,CAAC,6BAA6B,C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AAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAChC,MAAM,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;YAC3C,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;gBACrB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,CAAC,CAAC;YAC7F,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;QAC3B,OAAO,CAAC,KAAK,CAAC,iDAAiD,MAAM,CAAC,IAAI,MAAM,CAAC,CAAC;QAClF,OAAO,CAAC,KAAK,CACX,iDAAiD,MAAM,CAAC,IAAI,uCAAuC,CACpG,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,kCAAkC,MAAM,CAAC,IAAI,SAAS,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ElnoraApiClient } from "./services/elnora-api-client.js";
|
|
3
|
+
import { ElnoraConfig } from "./types.js";
|
|
4
|
+
export declare function createElnoraServer(config: ElnoraConfig, getClient: () => ElnoraApiClient): McpServer;
|
|
5
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAM1C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,GAAG,SAAS,CAYpG"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { registerTaskTools } from "./tools/tasks.js";
|
|
3
|
+
import { registerMessageTools } from "./tools/messages.js";
|
|
4
|
+
import { registerFileTools } from "./tools/files.js";
|
|
5
|
+
import { registerProtocolTools } from "./tools/protocols.js";
|
|
6
|
+
export function createElnoraServer(config, getClient) {
|
|
7
|
+
const server = new McpServer({
|
|
8
|
+
name: "elnora-mcp-server",
|
|
9
|
+
version: "0.1.0",
|
|
10
|
+
});
|
|
11
|
+
registerTaskTools(server, getClient);
|
|
12
|
+
registerMessageTools(server, getClient);
|
|
13
|
+
registerFileTools(server, getClient);
|
|
14
|
+
registerProtocolTools(server, getClient);
|
|
15
|
+
return server;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,MAAM,UAAU,kBAAkB,CAAC,MAAoB,EAAE,SAAgC;IACvF,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACrC,oBAAoB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACxC,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACrC,qBAAqB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAEzC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ElnoraConfig, ElnoraTask, ElnoraMessage, ElnoraFile, TokenValidationResult } from "../types.js";
|
|
2
|
+
export declare class ElnoraApiClient {
|
|
3
|
+
private bearerToken;
|
|
4
|
+
private client;
|
|
5
|
+
private tokenValidationUrl;
|
|
6
|
+
constructor(config: ElnoraConfig, bearerToken: string);
|
|
7
|
+
static validateToken(tokenValidationUrl: string, token: string): Promise<TokenValidationResult>;
|
|
8
|
+
createTask(title?: string): Promise<ElnoraTask>;
|
|
9
|
+
listTasks(status?: string, limit?: number, offset?: number): Promise<{
|
|
10
|
+
items: ElnoraTask[];
|
|
11
|
+
totalCount: number;
|
|
12
|
+
}>;
|
|
13
|
+
getTaskMessages(taskId: string, limit?: number, offset?: number): Promise<{
|
|
14
|
+
items: ElnoraMessage[];
|
|
15
|
+
totalCount: number;
|
|
16
|
+
}>;
|
|
17
|
+
sendMessage(taskId: string, content: string, fileIds?: string[]): Promise<ElnoraMessage>;
|
|
18
|
+
listFiles(projectId?: string, limit?: number, offset?: number): Promise<{
|
|
19
|
+
items: ElnoraFile[];
|
|
20
|
+
totalCount: number;
|
|
21
|
+
}>;
|
|
22
|
+
getFileContent(fileId: string): Promise<{
|
|
23
|
+
content: string;
|
|
24
|
+
name: string;
|
|
25
|
+
fileType: string;
|
|
26
|
+
}>;
|
|
27
|
+
uploadFile(name: string, content: string, fileType?: string): Promise<ElnoraFile>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=elnora-api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elnora-api-client.d.ts","sourceRoot":"","sources":["../../src/services/elnora-api-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGzG,qBAAa,eAAe;IAIQ,OAAO,CAAC,WAAW;IAHrD,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,kBAAkB,CAAS;gBAEvB,MAAM,EAAE,YAAY,EAAU,WAAW,EAAE,MAAM;WAehD,aAAa,CAAC,kBAAkB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAW/F,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAO/C,SAAS,CACb,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,SAAK,EACV,MAAM,SAAI,GACT,OAAO,CAAC;QAAE,KAAK,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAOjD,eAAe,CACnB,MAAM,EAAE,MAAM,EACd,KAAK,SAAK,EACV,MAAM,SAAI,GACT,OAAO,CAAC;QAAE,KAAK,EAAE,aAAa,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IASpD,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAWxF,SAAS,CACb,SAAS,CAAC,EAAE,MAAM,EAClB,KAAK,SAAK,EACV,MAAM,SAAI,GACT,OAAO,CAAC;QAAE,KAAK,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAOjD,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAK5F,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAQxF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { REQUEST_TIMEOUT_MS, LONG_REQUEST_TIMEOUT_MS } from "../constants.js";
|
|
3
|
+
export class ElnoraApiClient {
|
|
4
|
+
bearerToken;
|
|
5
|
+
client;
|
|
6
|
+
tokenValidationUrl;
|
|
7
|
+
constructor(config, bearerToken) {
|
|
8
|
+
this.bearerToken = bearerToken;
|
|
9
|
+
this.client = axios.create({
|
|
10
|
+
baseURL: config.apiUrl,
|
|
11
|
+
timeout: REQUEST_TIMEOUT_MS,
|
|
12
|
+
headers: {
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
Accept: "application/json",
|
|
15
|
+
Authorization: `Bearer ${bearerToken}`,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
this.tokenValidationUrl = config.tokenValidationUrl;
|
|
19
|
+
}
|
|
20
|
+
// --- Token Validation ---
|
|
21
|
+
static async validateToken(tokenValidationUrl, token) {
|
|
22
|
+
const response = await axios.post(tokenValidationUrl, { token }, { timeout: REQUEST_TIMEOUT_MS });
|
|
23
|
+
return response.data;
|
|
24
|
+
}
|
|
25
|
+
// --- Tasks ---
|
|
26
|
+
async createTask(title) {
|
|
27
|
+
const response = await this.client.post("/tasks", {
|
|
28
|
+
title: title || "New Task",
|
|
29
|
+
});
|
|
30
|
+
return response.data;
|
|
31
|
+
}
|
|
32
|
+
async listTasks(status, limit = 20, offset = 0) {
|
|
33
|
+
const params = { limit, offset };
|
|
34
|
+
if (status)
|
|
35
|
+
params.status = status;
|
|
36
|
+
const response = await this.client.get("/tasks", { params });
|
|
37
|
+
return response.data;
|
|
38
|
+
}
|
|
39
|
+
async getTaskMessages(taskId, limit = 50, offset = 0) {
|
|
40
|
+
const response = await this.client.get(`/tasks/${taskId}/messages`, {
|
|
41
|
+
params: { limit, offset },
|
|
42
|
+
});
|
|
43
|
+
return response.data;
|
|
44
|
+
}
|
|
45
|
+
// --- Messages ---
|
|
46
|
+
async sendMessage(taskId, content, fileIds) {
|
|
47
|
+
const response = await this.client.post(`/tasks/${taskId}/messages`, { content, fileIds }, { timeout: LONG_REQUEST_TIMEOUT_MS });
|
|
48
|
+
return response.data;
|
|
49
|
+
}
|
|
50
|
+
// --- Files ---
|
|
51
|
+
async listFiles(projectId, limit = 20, offset = 0) {
|
|
52
|
+
const params = { limit, offset };
|
|
53
|
+
if (projectId)
|
|
54
|
+
params.projectId = projectId;
|
|
55
|
+
const response = await this.client.get("/files", { params });
|
|
56
|
+
return response.data;
|
|
57
|
+
}
|
|
58
|
+
async getFileContent(fileId) {
|
|
59
|
+
const response = await this.client.get(`/files/${fileId}/content`);
|
|
60
|
+
return response.data;
|
|
61
|
+
}
|
|
62
|
+
async uploadFile(name, content, fileType) {
|
|
63
|
+
const response = await this.client.post("/files", {
|
|
64
|
+
name,
|
|
65
|
+
content,
|
|
66
|
+
fileType: fileType || "text/markdown",
|
|
67
|
+
});
|
|
68
|
+
return response.data;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=elnora-api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elnora-api-client.js","sourceRoot":"","sources":["../../src/services/elnora-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAw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,CAAC,GAAG,CAAC,UAAU,MAAM,UAAU,CAAC,CAAC;QACnE,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAY,EAAE,OAAe,EAAE,QAAiB;QAC/D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAa,QAAQ,EAAE;YAC5D,IAAI;YACJ,OAAO;YACP,QAAQ,EAAE,QAAQ,IAAI,eAAe;SACtC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../src/services/error-handler.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA6BrD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
export function handleApiError(error) {
|
|
3
|
+
if (axios.isAxiosError(error)) {
|
|
4
|
+
const axiosErr = error;
|
|
5
|
+
if (axiosErr.response) {
|
|
6
|
+
const status = axiosErr.response.status;
|
|
7
|
+
const data = axiosErr.response.data;
|
|
8
|
+
const messages = data?.messages?.join(", ") || "";
|
|
9
|
+
switch (status) {
|
|
10
|
+
case 400:
|
|
11
|
+
return `Error: Invalid request. ${messages || "Check your parameters."}`;
|
|
12
|
+
case 401:
|
|
13
|
+
return "Error: Authentication failed. Your token may have expired — re-authenticate.";
|
|
14
|
+
case 403:
|
|
15
|
+
return "Error: Permission denied. You don't have access to this resource.";
|
|
16
|
+
case 404:
|
|
17
|
+
return `Error: Resource not found. ${messages || "Check the ID is correct."}`;
|
|
18
|
+
case 429:
|
|
19
|
+
return "Error: Rate limit exceeded. Please wait before making more requests.";
|
|
20
|
+
default:
|
|
21
|
+
return `Error: API request failed (${status}). ${messages}`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (axiosErr.code === "ECONNABORTED") {
|
|
25
|
+
return "Error: Request timed out. The operation may still be in progress.";
|
|
26
|
+
}
|
|
27
|
+
else if (axiosErr.code === "ECONNREFUSED") {
|
|
28
|
+
return "Error: Service temporarily unavailable. Please try again later.";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return `Error: Unexpected error: ${error instanceof Error ? error.message : String(error)}`;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../src/services/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,KAAgE,CAAC;QAClF,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACtB,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;YACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;YACpC,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAElD,QAAQ,MAAM,EAAE,CAAC;gBACf,KAAK,GAAG;oBACN,OAAO,2BAA2B,QAAQ,IAAI,wBAAwB,EAAE,CAAC;gBAC3E,KAAK,GAAG;oBACN,OAAO,8EAA8E,CAAC;gBACxF,KAAK,GAAG;oBACN,OAAO,mEAAmE,CAAC;gBAC7E,KAAK,GAAG;oBACN,OAAO,8BAA8B,QAAQ,IAAI,0BAA0B,EAAE,CAAC;gBAChF,KAAK,GAAG;oBACN,OAAO,sEAAsE,CAAC;gBAChF;oBACE,OAAO,8BAA8B,MAAM,MAAM,QAAQ,EAAE,CAAC;YAChE,CAAC;QACH,CAAC;aAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC5C,OAAO,mEAAmE,CAAC;QAC7E,CAAC;aAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC5C,OAAO,iEAAiE,CAAC;QAC3E,CAAC;IACH,CAAC;IACD,OAAO,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC9F,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ElnoraApiClient } from "../services/elnora-api-client.js";
|
|
3
|
+
export declare function registerFileTools(server: McpServer, getClient: () => ElnoraApiClient): void;
|
|
4
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/tools/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAInE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,GAAG,IAAI,CAwE3F"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { handleApiError } from "../services/error-handler.js";
|
|
3
|
+
import { CHARACTER_LIMIT } from "../constants.js";
|
|
4
|
+
export function registerFileTools(server, getClient) {
|
|
5
|
+
server.registerTool("elnora_list_files", {
|
|
6
|
+
title: "List Files",
|
|
7
|
+
description: "List files in your Elnora workspace. Returns file metadata including name, type, and visibility.",
|
|
8
|
+
inputSchema: {
|
|
9
|
+
project_id: z.string().uuid().optional().describe("Filter by project UUID"),
|
|
10
|
+
limit: z.number().int().min(1).max(100).default(20).describe("Max results"),
|
|
11
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset"),
|
|
12
|
+
},
|
|
13
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
14
|
+
}, async ({ project_id, limit, offset }) => {
|
|
15
|
+
try {
|
|
16
|
+
const result = await getClient().listFiles(project_id, limit, offset);
|
|
17
|
+
return {
|
|
18
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
return { content: [{ type: "text", text: handleApiError(error) }], isError: true };
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
server.registerTool("elnora_get_file_content", {
|
|
26
|
+
title: "Get File Content",
|
|
27
|
+
description: "Retrieve the content of a specific file by its ID. Returns the file content as text along with metadata.",
|
|
28
|
+
inputSchema: {
|
|
29
|
+
file_id: z.string().uuid().describe("File UUID"),
|
|
30
|
+
},
|
|
31
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
32
|
+
}, async ({ file_id }) => {
|
|
33
|
+
try {
|
|
34
|
+
const result = await getClient().getFileContent(file_id);
|
|
35
|
+
return {
|
|
36
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return { content: [{ type: "text", text: handleApiError(error) }], isError: true };
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
server.registerTool("elnora_upload_file", {
|
|
44
|
+
title: "Upload File",
|
|
45
|
+
description: "Upload a text file to Elnora. Files are stored in the user's workspace and can be attached to task messages.",
|
|
46
|
+
inputSchema: {
|
|
47
|
+
name: z.string().min(1).max(255).describe("Filename"),
|
|
48
|
+
content: z.string().min(1).max(CHARACTER_LIMIT).describe("File content (max 25,000 chars)"),
|
|
49
|
+
file_type: z.string().optional().describe("MIME type (default: text/markdown)"),
|
|
50
|
+
},
|
|
51
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
52
|
+
}, async ({ name, content, file_type }) => {
|
|
53
|
+
try {
|
|
54
|
+
const result = await getClient().uploadFile(name, content, file_type);
|
|
55
|
+
return {
|
|
56
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
return { content: [{ type: "text", text: handleApiError(error) }], isError: true };
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/tools/files.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,SAAgC;IACnF,MAAM,CAAC,YAAY,CACjB,mBAAmB,EACnB;QACE,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,kGAAkG;QACpG,WAAW,EAAE;YACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;YAC3E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC;YAC3E,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,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AAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aAC5E,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC9F,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ElnoraApiClient } from "../services/elnora-api-client.js";
|
|
3
|
+
export declare function registerMessageTools(server: McpServer, getClient: () => ElnoraApiClient): void;
|
|
4
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/tools/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,GAAG,IAAI,CA8B9F"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { handleApiError } from "../services/error-handler.js";
|
|
3
|
+
export function registerMessageTools(server, getClient) {
|
|
4
|
+
server.registerTool("elnora_send_message", {
|
|
5
|
+
title: "Send Message",
|
|
6
|
+
description: "Send a message to an Elnora task and receive the AI response. The message is processed by Elnora's AI system, which handles protocol generation, research, and data analysis. This operation may take 30-120 seconds for complex requests.",
|
|
7
|
+
inputSchema: {
|
|
8
|
+
task_id: z.string().uuid().describe("Task UUID"),
|
|
9
|
+
message: z.string().min(1).max(10000).describe("Message content (markdown supported)"),
|
|
10
|
+
file_ids: z.array(z.string().uuid()).optional().describe("File IDs to attach"),
|
|
11
|
+
},
|
|
12
|
+
annotations: {
|
|
13
|
+
readOnlyHint: false,
|
|
14
|
+
destructiveHint: false,
|
|
15
|
+
idempotentHint: false,
|
|
16
|
+
openWorldHint: true,
|
|
17
|
+
},
|
|
18
|
+
}, async ({ task_id, message, file_ids }) => {
|
|
19
|
+
try {
|
|
20
|
+
const response = await getClient().sendMessage(task_id, message, file_ids);
|
|
21
|
+
return {
|
|
22
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
return { content: [{ type: "text", text: handleApiError(error) }], isError: true };
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/tools/messages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,SAAgC;IACtF,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,cAAc;QACrB,WAAW,EACT,4OAA4O;QAC9O,WAAW,EAAE;YACX,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;YAChD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,sCAAsC,CAAC;YACtF,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;SAC/E;QACD,WAAW,EAAE;YACX,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,KAAK;YACrB,aAAa,EAAE,IAAI;SACpB;KACF,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QACvC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,SAAS,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC3E,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aAC9E,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC9F,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ElnoraApiClient } from "../services/elnora-api-client.js";
|
|
3
|
+
export declare function registerProtocolTools(server: McpServer, getClient: () => ElnoraApiClient): void;
|
|
4
|
+
//# sourceMappingURL=protocols.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocols.d.ts","sourceRoot":"","sources":["../../src/tools/protocols.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,GAAG,IAAI,CAgD/F"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { handleApiError } from "../services/error-handler.js";
|
|
3
|
+
export function registerProtocolTools(server, getClient) {
|
|
4
|
+
server.registerTool("elnora_generate_protocol", {
|
|
5
|
+
title: "Generate Protocol",
|
|
6
|
+
description: `Generate a bioprotocol using Elnora's AI agents. This is a convenience tool that creates a task, sends the description as a message, and returns the generated protocol content. This is the primary tool for hackathon partners. The operation typically takes 30-120 seconds.
|
|
7
|
+
|
|
8
|
+
Examples:
|
|
9
|
+
- "Generate a HEK 293 cell maintenance protocol"
|
|
10
|
+
- "Create a CRISPR guide RNA design protocol for BRCA1"
|
|
11
|
+
- "Write a western blot protocol for detecting p53 in HeLa cells"`,
|
|
12
|
+
inputSchema: {
|
|
13
|
+
description: z.string().min(10).max(5000).describe("Protocol description"),
|
|
14
|
+
title: z.string().max(200).optional().describe("Task title (defaults to description preview)"),
|
|
15
|
+
},
|
|
16
|
+
annotations: {
|
|
17
|
+
readOnlyHint: false,
|
|
18
|
+
destructiveHint: false,
|
|
19
|
+
idempotentHint: false,
|
|
20
|
+
openWorldHint: true,
|
|
21
|
+
},
|
|
22
|
+
}, async ({ description, title }) => {
|
|
23
|
+
try {
|
|
24
|
+
const client = getClient();
|
|
25
|
+
// 1. Create a task
|
|
26
|
+
const taskTitle = title || description.slice(0, 100);
|
|
27
|
+
const task = await client.createTask(taskTitle);
|
|
28
|
+
// 2. Send the description as a message
|
|
29
|
+
const response = await client.sendMessage(task.id, description);
|
|
30
|
+
// 3. Return the result
|
|
31
|
+
const result = {
|
|
32
|
+
task_id: task.id,
|
|
33
|
+
protocol_content: response.content,
|
|
34
|
+
message_id: response.id,
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return { content: [{ type: "text", text: handleApiError(error) }], isError: true };
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=protocols.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocols.js","sourceRoot":"","sources":["../../src/tools/protocols.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,SAAgC;IACvF,MAAM,CAAC,YAAY,CACjB,0BAA0B,EAC1B;QACE,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE;;;;;oEAKiD;QAC9D,WAAW,EAAE;YACX,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC;YAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;SAC/F;QACD,WAAW,EAAE;YACX,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,KAAK;YACrB,aAAa,EAAE,IAAI;SACpB;KACF,EACD,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE;QAC/B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAE3B,mBAAmB;YACnB,MAAM,SAAS,GAAG,KAAK,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACrD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YAEhD,uCAAuC;YACvC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;YAEhE,uBAAuB;YACvB,MAAM,MAAM,GAAG;gBACb,OAAO,EAAE,IAAI,CAAC,EAAE;gBAChB,gBAAgB,EAAE,QAAQ,CAAC,OAAO;gBAClC,UAAU,EAAE,QAAQ,CAAC,EAAE;aACxB,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aAC5E,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC9F,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ElnoraApiClient } from "../services/elnora-api-client.js";
|
|
3
|
+
export declare function registerTaskTools(server: McpServer, getClient: () => ElnoraApiClient): void;
|
|
4
|
+
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/tools/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,GAAG,IAAI,CA8E3F"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { handleApiError } from "../services/error-handler.js";
|
|
3
|
+
export function registerTaskTools(server, getClient) {
|
|
4
|
+
server.registerTool("elnora_create_task", {
|
|
5
|
+
title: "Create Task",
|
|
6
|
+
description: "Create a new task (conversation) in Elnora. Tasks are the primary unit of interaction — each task is a chat thread where you can send messages and receive AI agent responses.",
|
|
7
|
+
inputSchema: {
|
|
8
|
+
title: z.string().max(200).optional().describe("Task title (e.g., 'HEK 293 protocol generation')"),
|
|
9
|
+
},
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
idempotentHint: false,
|
|
14
|
+
openWorldHint: true,
|
|
15
|
+
},
|
|
16
|
+
}, async ({ title }) => {
|
|
17
|
+
try {
|
|
18
|
+
const task = await getClient().createTask(title);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(task, null, 2) }],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return { content: [{ type: "text", text: handleApiError(error) }], isError: true };
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
server.registerTool("elnora_list_tasks", {
|
|
28
|
+
title: "List Tasks",
|
|
29
|
+
description: "List tasks in your Elnora workspace. Returns task summaries with status and timestamps.",
|
|
30
|
+
inputSchema: {
|
|
31
|
+
status: z.string().optional().describe("Filter by task status"),
|
|
32
|
+
limit: z.number().int().min(1).max(100).default(20).describe("Max results"),
|
|
33
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset"),
|
|
34
|
+
},
|
|
35
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
36
|
+
}, async ({ status, limit, offset }) => {
|
|
37
|
+
try {
|
|
38
|
+
const result = await getClient().listTasks(status, limit, offset);
|
|
39
|
+
return {
|
|
40
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return { content: [{ type: "text", text: handleApiError(error) }], isError: true };
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
server.registerTool("elnora_get_task_messages", {
|
|
48
|
+
title: "Get Task Messages",
|
|
49
|
+
description: "Get the message history for a specific task. Returns user and assistant messages in chronological order.",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
task_id: z.string().uuid().describe("Task UUID"),
|
|
52
|
+
limit: z.number().int().min(1).max(100).default(50).describe("Max messages"),
|
|
53
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset"),
|
|
54
|
+
},
|
|
55
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
56
|
+
}, async ({ task_id, limit, offset }) => {
|
|
57
|
+
try {
|
|
58
|
+
const result = await getClient().getTaskMessages(task_id, limit, offset);
|
|
59
|
+
return {
|
|
60
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
return { content: [{ type: "text", text: handleApiError(error) }], isError: true };
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../src/tools/tasks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,SAAgC;IACnF,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,gLAAgL;QAClL,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE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AC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;SACzE;QACD,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;KACvG,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;QACnC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACzE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aAC5E,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC9F,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface ElnoraConfig {
|
|
2
|
+
apiUrl: string;
|
|
3
|
+
authUrl: string;
|
|
4
|
+
tokenValidationUrl: string;
|
|
5
|
+
port: number;
|
|
6
|
+
}
|
|
7
|
+
export interface AuthContext {
|
|
8
|
+
userId: number;
|
|
9
|
+
organizationId: string;
|
|
10
|
+
scopes: string;
|
|
11
|
+
tokenType: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ElnoraTask {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
status: string;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ElnoraMessage {
|
|
21
|
+
id: string;
|
|
22
|
+
taskId: string;
|
|
23
|
+
role: "user" | "assistant";
|
|
24
|
+
content: string;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
agentName?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ElnoraFile {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
fileType: string;
|
|
32
|
+
visibility: string;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
latestVersionId?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface TokenValidationResult {
|
|
37
|
+
valid: boolean;
|
|
38
|
+
userId?: number;
|
|
39
|
+
organizationId?: string;
|
|
40
|
+
scopes?: string;
|
|
41
|
+
tokenType?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface PaginatedResponse<T> {
|
|
44
|
+
items: T[];
|
|
45
|
+
totalCount: number;
|
|
46
|
+
hasMore: boolean;
|
|
47
|
+
nextOffset?: number;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elnora-ai/mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for Elnora Platform — AI-powered bioprotocol optimization",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "node dist/index.js",
|
|
9
|
+
"dev": "tsx watch src/index.ts",
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"clean": "rm -rf dist",
|
|
12
|
+
"test": "vitest run",
|
|
13
|
+
"test:watch": "vitest"
|
|
14
|
+
},
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/Elnora-AI/elnora-mcp-server.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/Elnora-AI/elnora-mcp-server/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://elnora.ai",
|
|
24
|
+
"keywords": [
|
|
25
|
+
"mcp",
|
|
26
|
+
"model-context-protocol",
|
|
27
|
+
"elnora",
|
|
28
|
+
"bioprotocol",
|
|
29
|
+
"ai-agent",
|
|
30
|
+
"lab-protocol"
|
|
31
|
+
],
|
|
32
|
+
"files": [
|
|
33
|
+
"dist/",
|
|
34
|
+
"LICENSE",
|
|
35
|
+
"README.md",
|
|
36
|
+
"CHANGELOG.md"
|
|
37
|
+
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
43
|
+
"express": "^5.1.0",
|
|
44
|
+
"zod": "^3.24.0",
|
|
45
|
+
"axios": "^1.8.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/express": "^5.0.0",
|
|
49
|
+
"@types/node": "^22.12.0",
|
|
50
|
+
"tsx": "^4.19.0",
|
|
51
|
+
"typescript": "^5.7.0",
|
|
52
|
+
"vitest": "^3.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|