mcp-ts-template 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -21
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +5 -5
- package/dist/services/openRouterProvider.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.typescriptlang.org/)
|
|
4
4
|
[](https://github.com/modelcontextprotocol/typescript-sdk)
|
|
5
5
|
[](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-03-26/changelog.mdx)
|
|
6
|
-
[](./CHANGELOG.md)
|
|
7
7
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
8
8
|
[](https://github.com/cyanheads/mcp-ts-template/issues)
|
|
9
9
|
[](https://github.com/cyanheads/mcp-ts-template)
|
|
@@ -90,26 +90,26 @@ Get the example server running in minutes:
|
|
|
90
90
|
|
|
91
91
|
Configure the MCP server's behavior using these environment variables:
|
|
92
92
|
|
|
93
|
-
| Variable | Description | Default
|
|
94
|
-
| :------------------------ | :-------------------------------------------------------------------------------------------------- |
|
|
95
|
-
| `MCP_TRANSPORT_TYPE` | Server transport: `stdio` or `http`. | `stdio`
|
|
96
|
-
| `MCP_HTTP_PORT` | Port for the HTTP server (if `MCP_TRANSPORT_TYPE=http`). | `3010`
|
|
97
|
-
| `MCP_HTTP_HOST` | Host address for the HTTP server (if `MCP_TRANSPORT_TYPE=http`). | `127.0.0.1`
|
|
98
|
-
| `MCP_ALLOWED_ORIGINS` | Comma-separated allowed origins for CORS (if `MCP_TRANSPORT_TYPE=http`). | (none)
|
|
99
|
-
| `MCP_SERVER_NAME` | Optional server name (used in MCP initialization). | (from package.json)
|
|
100
|
-
| `MCP_SERVER_VERSION` | Optional server version (used in MCP initialization). | (from package.json)
|
|
101
|
-
| `MCP_LOG_LEVEL` | Server logging level (`debug`, `info`, `warning`, `error`, etc.). | `info`
|
|
102
|
-
| `NODE_ENV` | Runtime environment (`development`, `production`). | `development`
|
|
103
|
-
| `MCP_AUTH_SECRET_KEY` | **Required for HTTP transport.** Secret key (min 32 chars) for signing/verifying auth tokens (JWT). | (none - **MUST be set in production**)
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
| `OPENROUTER_API_KEY` | API key for OpenRouter.ai service. Optional, but service will be unconfigured without it. | (none)
|
|
107
|
-
| `LLM_DEFAULT_MODEL` | Default model to use for LLM calls via OpenRouter. | `
|
|
108
|
-
| `LLM_DEFAULT_TEMPERATURE` | Default temperature for LLM calls (0-2). Optional. | (none)
|
|
109
|
-
| `LLM_DEFAULT_TOP_P` | Default top_p for LLM calls (0-1). Optional. | (none)
|
|
110
|
-
| `LLM_DEFAULT_MAX_TOKENS` | Default max_tokens for LLM calls. Optional. | (none)
|
|
111
|
-
| `LLM_DEFAULT_TOP_K` | Default top_k for LLM calls (non-negative integer). Optional. | (none)
|
|
112
|
-
| `LLM_DEFAULT_MIN_P` | Default min_p for LLM calls (0-1). Optional. | (none)
|
|
93
|
+
| Variable | Description | Default |
|
|
94
|
+
| :------------------------ | :-------------------------------------------------------------------------------------------------- | :----------------------------------------- |
|
|
95
|
+
| `MCP_TRANSPORT_TYPE` | Server transport: `stdio` or `http`. | `stdio` |
|
|
96
|
+
| `MCP_HTTP_PORT` | Port for the HTTP server (if `MCP_TRANSPORT_TYPE=http`). | `3010` |
|
|
97
|
+
| `MCP_HTTP_HOST` | Host address for the HTTP server (if `MCP_TRANSPORT_TYPE=http`). | `127.0.0.1` |
|
|
98
|
+
| `MCP_ALLOWED_ORIGINS` | Comma-separated allowed origins for CORS (if `MCP_TRANSPORT_TYPE=http`). | (none) |
|
|
99
|
+
| `MCP_SERVER_NAME` | Optional server name (used in MCP initialization). | (from package.json) |
|
|
100
|
+
| `MCP_SERVER_VERSION` | Optional server version (used in MCP initialization). | (from package.json) |
|
|
101
|
+
| `MCP_LOG_LEVEL` | Server logging level (`debug`, `info`, `warning`, `error`, etc.). | `info` |
|
|
102
|
+
| `NODE_ENV` | Runtime environment (`development`, `production`). | `development` |
|
|
103
|
+
| `MCP_AUTH_SECRET_KEY` | **Required for HTTP transport.** Secret key (min 32 chars) for signing/verifying auth tokens (JWT). | (none - **MUST be set in production**) |
|
|
104
|
+
| `OPENROUTER_APP_URL` | URL of the application (used by OpenRouter service for HTTP Referer). | `https://caseyjhand.com` |
|
|
105
|
+
| `OPENROUTER_APP_NAME` | Name of the application (used by OpenRouter service for X-Title header). | 'mcp-ts-template' |
|
|
106
|
+
| `OPENROUTER_API_KEY` | API key for OpenRouter.ai service. Optional, but service will be unconfigured without it. | (none) |
|
|
107
|
+
| `LLM_DEFAULT_MODEL` | Default model to use for LLM calls via OpenRouter. | `google/gemini-2.5-flash-preview:thinking` |
|
|
108
|
+
| `LLM_DEFAULT_TEMPERATURE` | Default temperature for LLM calls (0-2). Optional. | (none) |
|
|
109
|
+
| `LLM_DEFAULT_TOP_P` | Default top_p for LLM calls (0-1). Optional. | (none) |
|
|
110
|
+
| `LLM_DEFAULT_MAX_TOKENS` | Default max_tokens for LLM calls. Optional. | (none) |
|
|
111
|
+
| `LLM_DEFAULT_TOP_K` | Default top_k for LLM calls (non-negative integer). Optional. | (none) |
|
|
112
|
+
| `LLM_DEFAULT_MIN_P` | Default min_p for LLM calls (0-1). Optional. | (none) |
|
|
113
113
|
|
|
114
114
|
**Note on HTTP Port Retries:** If the `MCP_HTTP_PORT` is busy, the server automatically tries the next port (up to 15 times).
|
|
115
115
|
|
package/dist/config/index.d.ts
CHANGED
|
@@ -58,8 +58,8 @@ export declare const config: {
|
|
|
58
58
|
* Default: undefined (Auth middleware should throw error if not set in production)
|
|
59
59
|
*/
|
|
60
60
|
mcpAuthSecretKey: string | undefined;
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
openrouterAppUrl: string;
|
|
62
|
+
openrouterAppName: string;
|
|
63
63
|
openrouterApiKey: string | undefined;
|
|
64
64
|
llmDefaultModel: string;
|
|
65
65
|
llmDefaultTemperature: number | undefined;
|
package/dist/config/index.js
CHANGED
|
@@ -33,10 +33,10 @@ const EnvSchema = z.object({
|
|
|
33
33
|
MCP_ALLOWED_ORIGINS: z.string().optional(), // Comma-separated string
|
|
34
34
|
MCP_AUTH_SECRET_KEY: z.string().min(32, "MCP_AUTH_SECRET_KEY must be at least 32 characters long for security").optional(), // Secret for signing/verifying tokens
|
|
35
35
|
// OpenRouter and LLM specific configurations
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
OPENROUTER_APP_URL: z.string().url("OPENROUTER_APP_URL must be a valid URL").optional(),
|
|
37
|
+
OPENROUTER_APP_NAME: z.string().optional(),
|
|
38
38
|
OPENROUTER_API_KEY: z.string().optional(),
|
|
39
|
-
LLM_DEFAULT_MODEL: z.string().default('
|
|
39
|
+
LLM_DEFAULT_MODEL: z.string().default('google/gemini-2.5-flash-preview:thinking'),
|
|
40
40
|
LLM_DEFAULT_TEMPERATURE: z.coerce.number().min(0).max(2).optional(),
|
|
41
41
|
LLM_DEFAULT_TOP_P: z.coerce.number().min(0).max(1).optional(),
|
|
42
42
|
LLM_DEFAULT_MAX_TOKENS: z.coerce.number().int().positive().optional(),
|
|
@@ -116,8 +116,8 @@ export const config = {
|
|
|
116
116
|
*/
|
|
117
117
|
mcpAuthSecretKey: env.MCP_AUTH_SECRET_KEY,
|
|
118
118
|
// OpenRouter and LLM specific properties
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
openrouterAppUrl: env.OPENROUTER_APP_URL || 'http://localhost:3000', // Default if not set
|
|
120
|
+
openrouterAppName: env.OPENROUTER_APP_NAME || pkg.name || 'MCP TS App', // Default if not set
|
|
121
121
|
openrouterApiKey: env.OPENROUTER_API_KEY, // No default, service handles if missing
|
|
122
122
|
llmDefaultModel: env.LLM_DEFAULT_MODEL,
|
|
123
123
|
llmDefaultTemperature: env.LLM_DEFAULT_TEMPERATURE,
|
|
@@ -6,8 +6,8 @@ import { logger } from '../utils/internal/logger.js';
|
|
|
6
6
|
import { sanitization } from '../utils/security/sanitization.js';
|
|
7
7
|
import { rateLimiter } from '../utils/security/rateLimiter.js';
|
|
8
8
|
// Use the updated config properties
|
|
9
|
-
const YOUR_SITE_URL = config.
|
|
10
|
-
const YOUR_SITE_NAME = config.
|
|
9
|
+
const YOUR_SITE_URL = config.openrouterAppUrl;
|
|
10
|
+
const YOUR_SITE_NAME = config.openrouterAppName;
|
|
11
11
|
/**
|
|
12
12
|
* Service class for interacting with the OpenRouter API using the OpenAI SDK compatibility.
|
|
13
13
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-ts-template",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "TypeScript template for building Model Context Protocol (MCP) servers & clients. Features production-ready utilities, stdio/HTTP transports (with JWT auth), examples, and type safety. Ideal starting point for creating MCP-based applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|