@cyanheads/pubmed-mcp-server 1.2.4 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -91
- package/dist/config/index.d.ts +13 -52
- package/dist/config/index.js +61 -204
- package/dist/index.js +30 -60
- package/dist/mcp-server/server.d.ts +0 -5
- package/dist/mcp-server/server.js +18 -34
- package/dist/mcp-server/tools/fetchPubMedContent/logic.js +2 -2
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic/citationFormatter.js +2 -2
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic/elinkHandler.js +3 -3
- package/dist/mcp-server/tools/searchPubMedArticles/logic.js +2 -2
- package/dist/mcp-server/transports/auth/authFactory.d.ts +10 -0
- package/dist/mcp-server/transports/auth/authFactory.js +41 -0
- package/dist/mcp-server/transports/auth/authMiddleware.d.ts +19 -0
- package/dist/mcp-server/transports/auth/authMiddleware.js +57 -0
- package/dist/mcp-server/transports/auth/index.d.ts +8 -5
- package/dist/mcp-server/transports/auth/index.js +6 -4
- package/dist/mcp-server/transports/auth/{core → lib}/authTypes.d.ts +0 -5
- package/dist/mcp-server/transports/auth/lib/authTypes.js +8 -0
- package/dist/mcp-server/transports/auth/{core → lib}/authUtils.js +21 -14
- package/dist/mcp-server/transports/auth/strategies/authStrategy.d.ts +17 -0
- package/dist/mcp-server/transports/auth/strategies/authStrategy.js +1 -0
- package/dist/mcp-server/transports/auth/strategies/jwtStrategy.d.ts +7 -0
- package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +112 -0
- package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts +7 -0
- package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js +101 -0
- package/dist/mcp-server/transports/core/baseTransportManager.d.ts +17 -0
- package/dist/mcp-server/transports/core/baseTransportManager.js +18 -0
- package/dist/mcp-server/transports/core/honoNodeBridge.d.ts +23 -0
- package/dist/mcp-server/transports/core/honoNodeBridge.js +51 -0
- package/dist/mcp-server/transports/core/statefulTransportManager.d.ts +31 -0
- package/dist/mcp-server/transports/core/statefulTransportManager.js +233 -0
- package/dist/mcp-server/transports/core/statelessTransportManager.d.ts +20 -0
- package/dist/mcp-server/transports/core/statelessTransportManager.js +92 -0
- package/dist/mcp-server/transports/core/transportTypes.d.ts +68 -0
- package/dist/mcp-server/transports/core/transportTypes.js +5 -0
- package/dist/mcp-server/transports/{httpErrorHandler.d.ts → http/httpErrorHandler.d.ts} +4 -9
- package/dist/mcp-server/transports/{httpErrorHandler.js → http/httpErrorHandler.js} +33 -8
- package/dist/mcp-server/transports/http/httpTransport.d.ts +22 -0
- package/dist/mcp-server/transports/http/httpTransport.js +251 -0
- package/dist/mcp-server/transports/http/httpTypes.d.ts +16 -0
- package/dist/mcp-server/transports/http/httpTypes.js +5 -0
- package/dist/mcp-server/transports/http/index.d.ts +7 -0
- package/dist/mcp-server/transports/http/index.js +6 -0
- package/dist/mcp-server/transports/http/mcpTransportMiddleware.d.ts +25 -0
- package/dist/mcp-server/transports/http/mcpTransportMiddleware.js +63 -0
- package/dist/mcp-server/transports/stdio/index.d.ts +5 -0
- package/dist/mcp-server/transports/stdio/index.js +5 -0
- package/dist/mcp-server/transports/{stdioTransport.d.ts → stdio/stdioTransport.d.ts} +2 -2
- package/dist/mcp-server/transports/{stdioTransport.js → stdio/stdioTransport.js} +10 -5
- package/dist/services/NCBI/{ncbiConstants.d.ts → core/ncbiConstants.d.ts} +1 -1
- package/dist/services/NCBI/{ncbiConstants.js → core/ncbiConstants.js} +1 -1
- package/dist/services/NCBI/{ncbiCoreApiClient.d.ts → core/ncbiCoreApiClient.d.ts} +2 -2
- package/dist/services/NCBI/{ncbiCoreApiClient.js → core/ncbiCoreApiClient.js} +4 -4
- package/dist/services/NCBI/{ncbiRequestQueueManager.d.ts → core/ncbiRequestQueueManager.d.ts} +2 -2
- package/dist/services/NCBI/{ncbiRequestQueueManager.js → core/ncbiRequestQueueManager.js} +3 -3
- package/dist/services/NCBI/{ncbiResponseHandler.d.ts → core/ncbiResponseHandler.d.ts} +2 -2
- package/dist/services/NCBI/{ncbiResponseHandler.js → core/ncbiResponseHandler.js} +3 -3
- package/dist/services/NCBI/{ncbiService.d.ts → core/ncbiService.d.ts} +3 -3
- package/dist/services/NCBI/{ncbiService.js → core/ncbiService.js} +2 -2
- package/dist/{utils/parsing/ncbi-parsing → services/NCBI/parsing}/eSummaryResultParser.d.ts +1 -1
- package/dist/{utils/parsing/ncbi-parsing → services/NCBI/parsing}/eSummaryResultParser.js +1 -1
- package/dist/{utils/parsing/ncbi-parsing → services/NCBI/parsing}/index.d.ts +1 -1
- package/dist/{utils/parsing/ncbi-parsing → services/NCBI/parsing}/index.js +1 -1
- package/dist/{utils/parsing/ncbi-parsing → services/NCBI/parsing}/pubmedArticleStructureParser.d.ts +1 -1
- package/dist/{utils/parsing/ncbi-parsing → services/NCBI/parsing}/pubmedArticleStructureParser.js +1 -1
- package/dist/{utils/parsing/ncbi-parsing → services/NCBI/parsing}/xmlGenericHelpers.d.ts +1 -1
- package/dist/{utils/parsing/ncbi-parsing → services/NCBI/parsing}/xmlGenericHelpers.js +1 -1
- package/dist/types-global/errors.d.ts +2 -0
- package/dist/types-global/errors.js +2 -0
- package/dist/utils/internal/errorHandler.js +1 -1
- package/dist/utils/internal/logger.d.ts +13 -1
- package/dist/utils/internal/logger.js +43 -9
- package/dist/utils/network/fetchWithTimeout.d.ts +21 -0
- package/dist/utils/network/fetchWithTimeout.js +59 -0
- package/dist/utils/network/index.d.ts +6 -0
- package/dist/utils/network/index.js +5 -0
- package/dist/utils/scheduling/index.d.ts +6 -0
- package/dist/utils/scheduling/index.js +6 -0
- package/dist/utils/scheduling/scheduler.d.ts +72 -0
- package/dist/utils/scheduling/scheduler.js +150 -0
- package/dist/utils/security/sanitization.js +35 -18
- package/package.json +9 -7
- package/dist/mcp-server/transports/auth/core/authTypes.js +0 -5
- package/dist/mcp-server/transports/auth/strategies/jwt/jwtMiddleware.d.ts +0 -27
- package/dist/mcp-server/transports/auth/strategies/jwt/jwtMiddleware.js +0 -149
- package/dist/mcp-server/transports/auth/strategies/oauth/oauthMiddleware.d.ts +0 -20
- package/dist/mcp-server/transports/auth/strategies/oauth/oauthMiddleware.js +0 -124
- package/dist/mcp-server/transports/httpTransport.d.ts +0 -21
- package/dist/mcp-server/transports/httpTransport.js +0 -208
- /package/dist/mcp-server/transports/auth/{core → lib}/authContext.d.ts +0 -0
- /package/dist/mcp-server/transports/auth/{core → lib}/authContext.js +0 -0
- /package/dist/mcp-server/transports/auth/{core → lib}/authUtils.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://modelcontextprotocol.io/)
|
|
5
|
-
[](./CHANGELOG.md)
|
|
6
|
-
[](https://opensource.org/licenses/Apache-2.0)
|
|
7
|
-
[](https://github.com/cyanheads/pubmed-mcp-server/issues)
|
|
8
|
-
[](https://github.com/cyanheads/pubmed-mcp-server)
|
|
3
|
+
# pubmed-mcp-server
|
|
9
4
|
|
|
10
5
|
**Empower your AI agents and research tools with seamless PubMed integration!**
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](https://modelcontextprotocol.io/)
|
|
9
|
+
[](./CHANGELOG.md)
|
|
10
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
11
|
+
[](https://github.com/cyanheads/pubmed-mcp-server/issues)
|
|
12
|
+
[](https://github.com/cyanheads/pubmed-mcp-server)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
Model Context Protocol (MCP) Server providing comprehensive access to PubMed's biomedical literature database. Enables LLMs and AI agents to search, retrieve, analyze, and visualize scientific publications through NCBI's E-utilities API with advanced research workflow capabilities.
|
|
13
17
|
|
|
14
18
|
Built on the [`cyanheads/mcp-ts-template`](https://github.com/cyanheads/mcp-ts-template), this server follows a modular architecture with robust error handling, logging, and security features.
|
|
15
19
|
|
|
@@ -17,23 +21,22 @@ Built on the [`cyanheads/mcp-ts-template`](https://github.com/cyanheads/mcp-ts-t
|
|
|
17
21
|
|
|
18
22
|
This server equips your AI with specialized tools to interact with PubMed:
|
|
19
23
|
|
|
20
|
-
| Tool Name | Description
|
|
21
|
-
| :-------------------------------------------------------------------------------------- |
|
|
22
|
-
| [`search_pubmed_articles`](./src/mcp-server/tools/searchPubMedArticles/) | Searches PubMed for articles based on your query.
|
|
23
|
-
| [`fetch_pubmed_content`](./src/mcp-server/tools/fetchPubMedContent/) | Retrieves detailed information for PubMed articles.
|
|
24
|
-
| [`get_pubmed_article_connections`](./src/mcp-server/tools/getPubMedArticleConnections/) | Finds related articles (cited by, similar, references) or formats citations for a PMID.
|
|
25
|
-
| [`pubmed_research_agent`](./src/mcp-server/tools/pubmedResearchAgent/) | Generates a standardized JSON research plan outline from component details.
|
|
26
|
-
| [`generate_pubmed_chart`](./src/mcp-server/tools/generatePubMedChart/) | Generates a chart image (PNG) from given input data.
|
|
24
|
+
| Tool Name | Description | Example |
|
|
25
|
+
| :-------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| [`search_pubmed_articles`](./src/mcp-server/tools/searchPubMedArticles/) | Searches PubMed for articles based on your query. | [View Example](./examples/search_pubmed_articles_example.md) |
|
|
27
|
+
| [`fetch_pubmed_content`](./src/mcp-server/tools/fetchPubMedContent/) | Retrieves detailed information for PubMed articles. | [View Example](./examples/fetch_pubmed_content_example.md) |
|
|
28
|
+
| [`get_pubmed_article_connections`](./src/mcp-server/tools/getPubMedArticleConnections/) | Finds related articles (cited by, similar, references) or formats citations for a PMID. | [Ex. 1](./examples/get_pubmed_article_connections_1.md), [Ex. 2](./examples/get_pubmed_article_connections_2.md) |
|
|
29
|
+
| [`pubmed_research_agent`](./src/mcp-server/tools/pubmedResearchAgent/) | Generates a standardized JSON research plan outline from component details. | [View Example](./examples/pubmed_research_agent_example.md) |
|
|
30
|
+
| [`generate_pubmed_chart`](./src/mcp-server/tools/generatePubMedChart/) | Generates a chart image (PNG) from given input data. | [View Examples](./examples/generate_pubmed_chart/) |
|
|
27
31
|
|
|
28
32
|
---
|
|
29
33
|
|
|
30
34
|
## Table of Contents
|
|
31
35
|
|
|
32
|
-
| [Overview](#overview)
|
|
33
|
-
|
|
34
|
-
| [Configuration](#configuration) | [Project Structure](#project-structure)
|
|
35
|
-
|
|
36
|
-
| [Tools](#tools) | [Resources](#resources) | [Development](#development) | [License](#license) |
|
|
36
|
+
| [Overview](#overview) | [Features](#features) | [Installation](#installation) |
|
|
37
|
+
| :------------------------------ | :--------------------------------------------- | :---------------------------- |
|
|
38
|
+
| [Configuration](#configuration) | [Project Structure](#project-structure) |
|
|
39
|
+
| [Tools](#tools) | [Development & Testing](#development--testing) | [License](#license) |
|
|
37
40
|
|
|
38
41
|
## Overview
|
|
39
42
|
|
|
@@ -58,11 +61,11 @@ Leverages the robust utilities provided by the `mcp-ts-template`:
|
|
|
58
61
|
|
|
59
62
|
- **Logging**: Structured, configurable logging (file rotation, stdout JSON, MCP notifications) with sensitive data redaction.
|
|
60
63
|
- **Error Handling**: Centralized error processing, standardized error types (`McpError`), and automatic logging.
|
|
61
|
-
- **Configuration**: Environment variable loading (`dotenv`) with comprehensive validation.
|
|
64
|
+
- **Configuration**: Environment variable loading (`dotenv`) with comprehensive validation using Zod.
|
|
62
65
|
- **Input Validation/Sanitization**: Uses `zod` for schema validation and custom sanitization logic.
|
|
63
66
|
- **Request Context**: Tracking and correlation of operations via unique request IDs using `AsyncLocalStorage`.
|
|
64
67
|
- **Type Safety**: Strong typing enforced by TypeScript and Zod schemas.
|
|
65
|
-
- **HTTP Transport**: High-performance HTTP server using **Hono**, featuring session management
|
|
68
|
+
- **HTTP Transport**: High-performance HTTP server using **Hono**, featuring session management and authentication support.
|
|
66
69
|
- **Authentication**: Robust authentication layer supporting JWT and OAuth 2.1, with fine-grained scope enforcement.
|
|
67
70
|
- **Deployment**: Multi-stage `Dockerfile` for creating small, secure production images with native dependency support.
|
|
68
71
|
|
|
@@ -83,56 +86,8 @@ Leverages the robust utilities provided by the `mcp-ts-template`:
|
|
|
83
86
|
|
|
84
87
|
- [Node.js (>=18.0.0)](https://nodejs.org/)
|
|
85
88
|
- [npm](https://www.npmjs.com/) (comes with Node.js)
|
|
86
|
-
- [Docker](https://www.docker.com/) (optional, for containerized deployment)
|
|
87
89
|
- **NCBI API Key** (recommended for higher rate limits) - [Get one here](https://ncbiinsights.ncbi.nlm.nih.gov/2017/11/02/new-api-keys-for-the-e-utilities/)
|
|
88
90
|
|
|
89
|
-
### Install via npm (recommended)
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
npm install @cyanheads/pubmed-mcp-server
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### Alternatively Install from Source
|
|
96
|
-
|
|
97
|
-
1. Clone the repository:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
git clone https://github.com/cyanheads/pubmed-mcp-server.git
|
|
101
|
-
cd pubmed-mcp-server
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
2. Install dependencies:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
npm install
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
3. Build the project:
|
|
111
|
-
```bash
|
|
112
|
-
npm run build
|
|
113
|
-
*or npm run rebuild*
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## Configuration
|
|
117
|
-
|
|
118
|
-
### Environment Variables
|
|
119
|
-
|
|
120
|
-
Configure the server using environment variables. These environmental variables are set within your MCP client config/settings (e.g. `claude_desktop_config.json` for Claude Desktop)
|
|
121
|
-
|
|
122
|
-
| Variable | Description | Default |
|
|
123
|
-
| ---------------------- | ---------------------------------------------------------------------------------------- | ------------------------------ |
|
|
124
|
-
| `MCP_TRANSPORT_TYPE` | Transport mechanism: `stdio` or `http`. | `stdio` |
|
|
125
|
-
| `MCP_HTTP_PORT` | Port for the HTTP server (if `MCP_TRANSPORT_TYPE=http`). | `3010` |
|
|
126
|
-
| `MCP_HTTP_HOST` | Host address for the HTTP server (if `MCP_TRANSPORT_TYPE=http`). | `127.0.0.1` |
|
|
127
|
-
| `MCP_ALLOWED_ORIGINS` | Comma-separated list of allowed origins for CORS (if `MCP_TRANSPORT_TYPE=http`). | (none) |
|
|
128
|
-
| `MCP_LOG_LEVEL` | Logging level (`debug`, `info`, `notice`, `warning`, `error`, `crit`, `alert`, `emerg`). | `debug` |
|
|
129
|
-
| `LOG_OUTPUT_MODE` | Logging output mode: `file` or `stdout`. | `file` |
|
|
130
|
-
| `MCP_AUTH_MODE` | Authentication mode for HTTP: `jwt` or `oauth`. | `jwt` |
|
|
131
|
-
| `MCP_AUTH_SECRET_KEY` | **Required for `jwt` auth.** Minimum 32-character secret key for JWT authentication. | (none) |
|
|
132
|
-
| `NCBI_API_KEY` | **Recommended.** Your NCBI API Key for higher rate limits and reliable access. | (none) |
|
|
133
|
-
| `NCBI_TOOL_IDENTIFIER` | Tool identifier for NCBI E-utility requests. | `@cyanheads/pubmed-mcp-server` |
|
|
134
|
-
| `LOGS_DIR` | Directory for log file storage (if `LOG_OUTPUT_MODE=file`). | `logs/` |
|
|
135
|
-
|
|
136
91
|
### MCP Client Settings
|
|
137
92
|
|
|
138
93
|
Add the following to your MCP client's configuration file (e.g., `cline_mcp_settings.json`). This configuration uses `npx` to run the server, which will automatically install the package if not already present:
|
|
@@ -145,14 +100,55 @@ Add the following to your MCP client's configuration file (e.g., `cline_mcp_sett
|
|
|
145
100
|
"args": ["@cyanheads/pubmed-mcp-server"],
|
|
146
101
|
"env": {
|
|
147
102
|
"NCBI_API_KEY": "your_ncbi_api_key_here"
|
|
148
|
-
}
|
|
149
|
-
"disabled": false,
|
|
150
|
-
"autoApprove": []
|
|
103
|
+
}
|
|
151
104
|
}
|
|
152
105
|
}
|
|
153
106
|
}
|
|
154
107
|
```
|
|
155
108
|
|
|
109
|
+
### If running manually (not via MCP client for development or testing)
|
|
110
|
+
|
|
111
|
+
#### Install via npm
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm install @cyanheads/pubmed-mcp-server
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### Alternatively Install from Source
|
|
118
|
+
|
|
119
|
+
1. Clone the repository:
|
|
120
|
+
```bash
|
|
121
|
+
git clone https://github.com/cyanheads/pubmed-mcp-server.git
|
|
122
|
+
cd pubmed-mcp-server
|
|
123
|
+
```
|
|
124
|
+
2. Install dependencies:
|
|
125
|
+
```bash
|
|
126
|
+
npm install
|
|
127
|
+
```
|
|
128
|
+
3. Build the project:
|
|
129
|
+
```bash
|
|
130
|
+
npm run build
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Configuration
|
|
134
|
+
|
|
135
|
+
### Environment Variables
|
|
136
|
+
|
|
137
|
+
Configure the server using environment variables. For local development, these can be set in a `.env` file at the project root or directly in your environment. Otherwise, you can set them in your MCP client configuration as shown above.
|
|
138
|
+
|
|
139
|
+
| Variable | Description | Default |
|
|
140
|
+
| :-------------------- | :--------------------------------------------------------------------------------------- | :------------ |
|
|
141
|
+
| `MCP_TRANSPORT_TYPE` | Transport mechanism: `stdio` or `http`. | `stdio` |
|
|
142
|
+
| `MCP_HTTP_PORT` | Port for the HTTP server (if `MCP_TRANSPORT_TYPE=http`). | `3010` |
|
|
143
|
+
| `MCP_HTTP_HOST` | Host address for the HTTP server (if `MCP_TRANSPORT_TYPE=http`). | `127.0.0.1` |
|
|
144
|
+
| `MCP_ALLOWED_ORIGINS` | Comma-separated list of allowed origins for CORS (if `MCP_TRANSPORT_TYPE=http`). | (none) |
|
|
145
|
+
| `MCP_LOG_LEVEL` | Logging level (`debug`, `info`, `notice`, `warning`, `error`, `crit`, `alert`, `emerg`). | `debug` |
|
|
146
|
+
| `MCP_AUTH_MODE` | Authentication mode for HTTP: `jwt` or `oauth`. | `jwt` |
|
|
147
|
+
| `MCP_AUTH_SECRET_KEY` | **Required for `jwt` auth.** Minimum 32-character secret key for JWT authentication. | (none) |
|
|
148
|
+
| `NCBI_API_KEY` | **Recommended.** Your NCBI API Key for higher rate limits and reliable access. | (none) |
|
|
149
|
+
| `LOGS_DIR` | Directory for log file storage. | `logs/` |
|
|
150
|
+
| `NODE_ENV` | Runtime environment (`development`, `production`). | `development` |
|
|
151
|
+
|
|
156
152
|
## Project Structure
|
|
157
153
|
|
|
158
154
|
The codebase follows a modular structure within the `src/` directory:
|
|
@@ -165,7 +161,6 @@ src/
|
|
|
165
161
|
├── mcp-server/ # Core MCP server logic and capability registration
|
|
166
162
|
│ ├── server.ts # Server setup, capability registration
|
|
167
163
|
│ ├── transports/ # Transport handling (stdio, http)
|
|
168
|
-
│ ├── resources/ # MCP Resource implementations
|
|
169
164
|
│ └── tools/ # MCP Tool implementations (subdirs per tool)
|
|
170
165
|
├── services/ # External service integrations
|
|
171
166
|
│ └── NCBI/ # NCBI E-utilities API client and parsing
|
|
@@ -191,40 +186,38 @@ _Note: All tools support comprehensive error handling and return structured JSON
|
|
|
191
186
|
|
|
192
187
|
## Examples
|
|
193
188
|
|
|
194
|
-
Comprehensive usage examples are available in the [`examples/`](examples/) directory
|
|
189
|
+
Comprehensive usage examples for each tool are available in the [`examples/`](examples/) directory.
|
|
195
190
|
|
|
196
|
-
- [
|
|
197
|
-
- [
|
|
198
|
-
- [
|
|
199
|
-
- [
|
|
200
|
-
- [
|
|
191
|
+
- **`search_pubmed_articles`**: [View Example](./examples/search_pubmed_articles_example.md)
|
|
192
|
+
- **`fetch_pubmed_content`**: [View Example](./examples/fetch_pubmed_content_example.md)
|
|
193
|
+
- **`get_pubmed_article_connections`**: [Ex. 1](./examples/get_pubmed_article_connections_1.md), [Ex. 2](./examples/get_pubmed_article_connections_2.md)
|
|
194
|
+
- **`pubmed_research_agent`**: [View Example](./examples/pubmed_research_agent_example.md)
|
|
195
|
+
- **`generate_pubmed_chart`**: [View Examples](./examples/generate_pubmed_chart/)
|
|
201
196
|
|
|
202
|
-
## Development
|
|
197
|
+
## Development & Testing
|
|
203
198
|
|
|
204
|
-
###
|
|
199
|
+
### Development Scripts
|
|
205
200
|
|
|
206
201
|
```bash
|
|
207
202
|
# Build the project (compile TS to JS in dist/ and make executable)
|
|
208
203
|
npm run build
|
|
209
204
|
|
|
210
|
-
# Test the server locally using the MCP inspector tool (stdio transport)
|
|
211
|
-
npm run inspector
|
|
212
|
-
|
|
213
|
-
# Test the server locally using the MCP inspector tool (http transport)
|
|
214
|
-
npm run inspector:http
|
|
215
|
-
|
|
216
205
|
# Clean build artifacts
|
|
217
206
|
npm run clean
|
|
218
207
|
|
|
219
|
-
# Generate a file tree representation for documentation
|
|
220
|
-
npm run tree
|
|
221
|
-
|
|
222
208
|
# Clean build artifacts and then rebuild the project
|
|
223
209
|
npm run rebuild
|
|
224
210
|
|
|
225
211
|
# Format code with Prettier
|
|
226
212
|
npm run format
|
|
227
213
|
|
|
214
|
+
# Generate a file tree representation for documentation
|
|
215
|
+
npm run tree
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Running the Server
|
|
219
|
+
|
|
220
|
+
```bash
|
|
228
221
|
# Start the server using stdio (default)
|
|
229
222
|
npm start
|
|
230
223
|
# Or explicitly:
|
|
@@ -232,6 +225,12 @@ npm run start:stdio
|
|
|
232
225
|
|
|
233
226
|
# Start the server using HTTP transport
|
|
234
227
|
npm run start:http
|
|
228
|
+
|
|
229
|
+
# Test the server locally using the MCP inspector tool (stdio transport)
|
|
230
|
+
npm run inspector
|
|
231
|
+
|
|
232
|
+
# Test the server locally using the MCP inspector tool (http transport)
|
|
233
|
+
npm run inspector:http
|
|
235
234
|
```
|
|
236
235
|
|
|
237
236
|
## License
|
package/dist/config/index.d.ts
CHANGED
|
@@ -4,78 +4,39 @@
|
|
|
4
4
|
* environment variables and `package.json`. It uses Zod for schema validation
|
|
5
5
|
* to ensure type safety and correctness of configuration parameters.
|
|
6
6
|
*
|
|
7
|
-
* Key responsibilities:
|
|
8
|
-
* - Load environment variables from a `.env` file.
|
|
9
|
-
* - Read `package.json` for default server name and version.
|
|
10
|
-
* - Define a Zod schema for all expected environment variables.
|
|
11
|
-
* - Validate environment variables against the schema.
|
|
12
|
-
* - Construct and export a comprehensive `config` object.
|
|
13
|
-
* - Export individual configuration values like `logLevel` and `environment` for convenience.
|
|
14
|
-
*
|
|
15
7
|
* @module src/config/index
|
|
16
8
|
*/
|
|
17
|
-
/**
|
|
18
|
-
* Main application configuration object.
|
|
19
|
-
* Aggregates settings from validated environment variables and `package.json`.
|
|
20
|
-
*/
|
|
21
9
|
export declare const config: {
|
|
22
|
-
|
|
10
|
+
pkg: {
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
};
|
|
23
14
|
mcpServerName: string;
|
|
24
|
-
/** MCP server version. Env `MCP_SERVER_VERSION` > `package.json` version > "0.0.0". */
|
|
25
15
|
mcpServerVersion: string;
|
|
26
|
-
/** Logging level. From `MCP_LOG_LEVEL` env var. Default: "debug". */
|
|
27
16
|
logLevel: string;
|
|
28
|
-
/** Defines the logging output mode ('file' or 'stdout'). From `LOG_OUTPUT_MODE`. */
|
|
29
|
-
logOutputMode: "file" | "stdout";
|
|
30
|
-
/** Absolute path to the logs directory (if logOutputMode is 'file'). From `LOGS_DIR`. */
|
|
31
17
|
logsPath: string | null;
|
|
32
|
-
/** Runtime environment. From `NODE_ENV` env var. Default: "development". */
|
|
33
18
|
environment: string;
|
|
34
|
-
/** MCP transport type ('stdio' or 'http'). From `MCP_TRANSPORT_TYPE` env var. Default: "stdio". */
|
|
35
19
|
mcpTransportType: "stdio" | "http";
|
|
36
|
-
|
|
20
|
+
mcpSessionMode: "stateless" | "stateful" | "auto";
|
|
37
21
|
mcpHttpPort: number;
|
|
38
|
-
/** HTTP server host (if http transport). From `MCP_HTTP_HOST` env var. Default: "127.0.0.1". */
|
|
39
22
|
mcpHttpHost: string;
|
|
40
|
-
|
|
23
|
+
mcpHttpEndpointPath: string;
|
|
24
|
+
mcpHttpMaxPortRetries: number;
|
|
25
|
+
mcpHttpPortRetryDelayMs: number;
|
|
26
|
+
mcpStatefulSessionStaleTimeoutMs: number;
|
|
41
27
|
mcpAllowedOrigins: string[] | undefined;
|
|
42
|
-
|
|
28
|
+
mcpAuthMode: "jwt" | "oauth" | "none";
|
|
43
29
|
mcpAuthSecretKey: string | undefined;
|
|
44
|
-
/** Auth mode ('jwt' or 'oauth'). From `MCP_AUTH_MODE`. */
|
|
45
|
-
mcpAuthMode: "jwt" | "oauth";
|
|
46
|
-
/** OAuth Issuer URL. From `OAUTH_ISSUER_URL`. */
|
|
47
30
|
oauthIssuerUrl: string | undefined;
|
|
48
|
-
/** OAuth Audience. From `OAUTH_AUDIENCE`. */
|
|
49
|
-
oauthAudience: string | undefined;
|
|
50
|
-
/** OAuth JWKS URI. From `OAUTH_JWKS_URI`. */
|
|
51
31
|
oauthJwksUri: string | undefined;
|
|
52
|
-
|
|
32
|
+
oauthAudience: string | undefined;
|
|
33
|
+
devMcpClientId: string | undefined;
|
|
34
|
+
devMcpScopes: string[] | undefined;
|
|
53
35
|
ncbiApiKey: string | undefined;
|
|
54
|
-
/** NCBI Tool Identifier. From `NCBI_TOOL_IDENTIFIER`. Defaults to server name/version. */
|
|
55
36
|
ncbiToolIdentifier: string;
|
|
56
|
-
/** NCBI Admin Email. From `NCBI_ADMIN_EMAIL`. */
|
|
57
37
|
ncbiAdminEmail: string | undefined;
|
|
58
|
-
/** NCBI Request Delay in MS. From `NCBI_REQUEST_DELAY_MS`. Dynamically set based on API key presence. */
|
|
59
38
|
ncbiRequestDelayMs: number;
|
|
60
|
-
/** NCBI Max Retries. From `NCBI_MAX_RETRIES`. */
|
|
61
39
|
ncbiMaxRetries: number;
|
|
62
|
-
/** OAuth Proxy configurations. Undefined if no related env vars are set. */
|
|
63
|
-
oauthProxy: {
|
|
64
|
-
authorizationUrl: string | undefined;
|
|
65
|
-
tokenUrl: string | undefined;
|
|
66
|
-
revocationUrl: string | undefined;
|
|
67
|
-
issuerUrl: string | undefined;
|
|
68
|
-
serviceDocumentationUrl: string | undefined;
|
|
69
|
-
defaultClientRedirectUris: string[] | undefined;
|
|
70
|
-
} | undefined;
|
|
71
40
|
};
|
|
72
|
-
/**
|
|
73
|
-
* Configured logging level for the application.
|
|
74
|
-
* Exported for convenience.
|
|
75
|
-
*/
|
|
76
41
|
export declare const logLevel: string;
|
|
77
|
-
/**
|
|
78
|
-
* Configured runtime environment ("development", "production", etc.).
|
|
79
|
-
* Exported for convenience.
|
|
80
|
-
*/
|
|
81
42
|
export declare const environment: string;
|