mcp-ts-template 2.4.4 → 2.4.7
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 +26 -19
- package/dist/index.js +6384 -291
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](./CHANGELOG.md) [](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-06-18/changelog.mdx) [](https://modelcontextprotocol.io/) [](./LICENSE) [](https://github.com/cyanheads/mcp-ts-template/issues) [](https://www.typescriptlang.org/) [](https://bun.sh/) [](./coverage/index.html)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
- **Elicitation Support**: Tools can interactively prompt the user for missing parameters during execution, streamlining user workflows.
|
|
20
20
|
- **Robust Error Handling**: A unified `McpError` system ensures consistent, structured error responses across the server.
|
|
21
21
|
- **Pluggable Authentication**: Secure your server with zero-fuss support for `none`, `jwt`, or `oauth` modes.
|
|
22
|
-
- **Abstracted Storage**: Swap storage backends (`in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2`) without changing business logic. Features secure opaque cursor pagination, parallel batch operations, and comprehensive validation.
|
|
22
|
+
- **Abstracted Storage**: Swap storage backends (`in-memory`, `filesystem`, `Supabase`, `SurrealDB`, `Cloudflare KV/R2`) without changing business logic. Features secure opaque cursor pagination, parallel batch operations, and comprehensive validation.
|
|
23
|
+
- **Graph Database Operations**: Optional graph service for relationship management, graph traversals, and pathfinding algorithms (SurrealDB provider).
|
|
23
24
|
- **Full-Stack Observability**: Get deep insights with structured logging (Pino) and optional, auto-instrumented OpenTelemetry for traces and metrics.
|
|
24
25
|
- **Dependency Injection**: Built with `tsyringe` for a clean, decoupled, and testable architecture.
|
|
25
|
-
- **Service Integrations**: Pluggable services for external APIs, including LLM providers (OpenRouter)
|
|
26
|
+
- **Service Integrations**: Pluggable services for external APIs, including LLM providers (OpenRouter), text-to-speech (ElevenLabs), and graph operations (SurrealDB).
|
|
26
27
|
- **Rich Built-in Utility Suite**: Helpers for parsing (PDF, YAML, CSV), scheduling, security, and more.
|
|
27
28
|
- **Edge-Ready**: Write code once and run it seamlessly on your local machine or at the edge on Cloudflare Workers.
|
|
28
29
|
|
|
@@ -104,21 +105,26 @@ bun install
|
|
|
104
105
|
|
|
105
106
|
All configuration is centralized and validated at startup in `src/config/index.ts`. Key environment variables in your `.env` file include:
|
|
106
107
|
|
|
107
|
-
| Variable | Description
|
|
108
|
-
| :-------------------------- |
|
|
109
|
-
| `MCP_TRANSPORT_TYPE` | The transport to use: `stdio` or `http`.
|
|
110
|
-
| `MCP_HTTP_PORT` | The port for the HTTP server.
|
|
111
|
-
| `MCP_HTTP_HOST` | The hostname for the HTTP server.
|
|
112
|
-
| `MCP_AUTH_MODE` | Authentication mode: `none`, `jwt`, or `oauth`.
|
|
113
|
-
| `MCP_AUTH_SECRET_KEY` | **Required for `jwt` auth mode.** A 32+ character secret.
|
|
114
|
-
| `OAUTH_ISSUER_URL` | **Required for `oauth` auth mode.** URL of the OIDC provider.
|
|
115
|
-
| `STORAGE_PROVIDER_TYPE` | Storage backend: `in-memory`, `filesystem`, `supabase`, `cloudflare-kv`, `r2`.
|
|
116
|
-
| `STORAGE_FILESYSTEM_PATH` | **Required for `filesystem` storage.** Path to the storage directory.
|
|
117
|
-
| `SUPABASE_URL` | **Required for `supabase` storage.** Your Supabase project URL.
|
|
118
|
-
| `SUPABASE_SERVICE_ROLE_KEY` | **Required for `supabase` storage.** Your Supabase service role key.
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
108
|
+
| Variable | Description | Default |
|
|
109
|
+
| :-------------------------- | :------------------------------------------------------------------------------------------------ | :---------- |
|
|
110
|
+
| `MCP_TRANSPORT_TYPE` | The transport to use: `stdio` or `http`. | `http` |
|
|
111
|
+
| `MCP_HTTP_PORT` | The port for the HTTP server. | `3010` |
|
|
112
|
+
| `MCP_HTTP_HOST` | The hostname for the HTTP server. | `127.0.0.1` |
|
|
113
|
+
| `MCP_AUTH_MODE` | Authentication mode: `none`, `jwt`, or `oauth`. | `none` |
|
|
114
|
+
| `MCP_AUTH_SECRET_KEY` | **Required for `jwt` auth mode.** A 32+ character secret. | `(none)` |
|
|
115
|
+
| `OAUTH_ISSUER_URL` | **Required for `oauth` auth mode.** URL of the OIDC provider. | `(none)` |
|
|
116
|
+
| `STORAGE_PROVIDER_TYPE` | Storage backend: `in-memory`, `filesystem`, `supabase`, `surrealdb`, `cloudflare-kv`, `r2`. | `in-memory` |
|
|
117
|
+
| `STORAGE_FILESYSTEM_PATH` | **Required for `filesystem` storage.** Path to the storage directory. | `(none)` |
|
|
118
|
+
| `SUPABASE_URL` | **Required for `supabase` storage.** Your Supabase project URL. | `(none)` |
|
|
119
|
+
| `SUPABASE_SERVICE_ROLE_KEY` | **Required for `supabase` storage.** Your Supabase service role key. | `(none)` |
|
|
120
|
+
| `SURREALDB_URL` | **Required for `surrealdb` storage.** SurrealDB endpoint (e.g., `wss://cloud.surrealdb.com/rpc`). | `(none)` |
|
|
121
|
+
| `SURREALDB_NAMESPACE` | **Required for `surrealdb` storage.** SurrealDB namespace. | `(none)` |
|
|
122
|
+
| `SURREALDB_DATABASE` | **Required for `surrealdb` storage.** SurrealDB database name. | `(none)` |
|
|
123
|
+
| `SURREALDB_USERNAME` | **Optional for `surrealdb` storage.** Database username for authentication. | `(none)` |
|
|
124
|
+
| `SURREALDB_PASSWORD` | **Optional for `surrealdb` storage.** Database password for authentication. | `(none)` |
|
|
125
|
+
| `OTEL_ENABLED` | Set to `true` to enable OpenTelemetry. | `false` |
|
|
126
|
+
| `LOG_LEVEL` | The minimum level for logging (`debug`, `info`, `warn`, `error`). | `info` |
|
|
127
|
+
| `OPENROUTER_API_KEY` | API key for OpenRouter LLM service. | `(none)` |
|
|
122
128
|
|
|
123
129
|
### Authentication & Authorization
|
|
124
130
|
|
|
@@ -128,7 +134,8 @@ All configuration is centralized and validated at startup in `src/config/index.t
|
|
|
128
134
|
### Storage
|
|
129
135
|
|
|
130
136
|
- **Service**: A DI-managed `StorageService` provides a consistent API for persistence. **Never access `fs` or other storage SDKs directly from tool logic.**
|
|
131
|
-
- **Providers**: The default is `in-memory`. Node-only providers include `filesystem`. Edge-compatible providers include `supabase`, `cloudflare-kv`, and `cloudflare-r2`.
|
|
137
|
+
- **Providers**: The default is `in-memory`. Node-only providers include `filesystem`. Edge-compatible providers include `supabase`, `surrealdb`, `cloudflare-kv`, and `cloudflare-r2`.
|
|
138
|
+
- **SurrealDB Setup**: When using `surrealdb` provider, initialize the database schema using `docs/surrealdb-schema.surql` before first use.
|
|
132
139
|
- **Multi-Tenancy**: The `StorageService` requires `context.tenantId`. This is automatically propagated from the `tid` claim in a JWT when auth is enabled.
|
|
133
140
|
- **Advanced Features**:
|
|
134
141
|
- **Secure Pagination**: Opaque cursors with tenant ID binding prevent cross-tenant attacks
|