@arikusi/deepseek-mcp-server 1.4.0 → 1.4.2
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 +24 -5
- package/README.md +42 -2
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -7
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +12 -3
- package/dist/server.js.map +1 -1
- package/dist/transport-http.d.ts +9 -0
- package/dist/transport-http.d.ts.map +1 -0
- package/dist/transport-http.js +109 -0
- package/dist/transport-http.js.map +1 -0
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,14 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.4.2] - 2026-03-07
|
|
11
|
+
|
|
10
12
|
### Added
|
|
11
|
-
-
|
|
13
|
+
- **Streamable HTTP Transport**: New `TRANSPORT=http` mode with Express-based Streamable HTTP server. Per-session McpServer instances with shared DeepSeekClient. Supports POST/GET/DELETE on `/mcp` endpoint and SSE streaming.
|
|
14
|
+
- **Health Endpoint**: `GET /health` returns server status, version, uptime, and transport type.
|
|
15
|
+
- **Docker Support**: Multi-stage `Dockerfile`, `docker-compose.yml`, and `.dockerignore` for containerized deployment. Default transport is HTTP in Docker.
|
|
16
|
+
- **Docker CI**: GitHub Actions job for Docker build smoke test with health endpoint verification.
|
|
17
|
+
- **New Config Variables**: `TRANSPORT` (stdio|http, default: stdio), `HTTP_PORT` (default: 3000).
|
|
18
|
+
- **253 Tests**: Up from 241, with 12 new tests covering HTTP transport endpoints, config transport/port parsing, and session lifecycle.
|
|
12
19
|
|
|
13
20
|
### Changed
|
|
14
|
-
-
|
|
21
|
+
- Entry point (`index.ts`) now branches on `config.transport` — stdio (default) or HTTP mode.
|
|
22
|
+
- CI dist check includes `transport-http.js`.
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
## [1.4.1] - 2026-03-07
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- **MCP Registry**: `mcpName` for official MCP Registry (registry.modelcontextprotocol.io) publishing
|
|
28
|
+
- **Glama Registry**: `glama.json` for glama.ai server listing
|
|
29
|
+
- **Smithery Compatibility**: CJS bundler fallback in `server.ts`, `createSandboxServer()` export
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
- **server.json**: Updated to official MCP Registry schema format
|
|
33
|
+
- **README**: Added Glama badge
|
|
18
34
|
|
|
19
35
|
## [1.4.0] - 2026-03-07
|
|
20
36
|
|
|
@@ -243,6 +259,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
243
259
|
|
|
244
260
|
## Version History
|
|
245
261
|
|
|
262
|
+
- **1.4.2** (2026-03-07): Streamable HTTP transport, Docker support, health endpoint, 253 tests
|
|
246
263
|
- **1.4.0** (2026-03-07): Model-aware pricing, multimodal content types, flexible fallback chain, MCP Registry, 241 tests
|
|
247
264
|
- **1.3.3** (2026-03-07): Streaming fallback tests, session tool_calls fix, configurable circuit breaker, session message limit, 212 tests
|
|
248
265
|
- **1.3.2** (2026-03-06): OpenAI SDK v6, Zod v4, DEFAULT_MODEL config
|
|
@@ -261,7 +278,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
261
278
|
- [GitHub repository](https://github.com/arikusi/deepseek-mcp-server)
|
|
262
279
|
- [Issue tracker](https://github.com/arikusi/deepseek-mcp-server/issues)
|
|
263
280
|
|
|
264
|
-
[Unreleased]: https://github.com/arikusi/deepseek-mcp-server/compare/v1.4.
|
|
281
|
+
[Unreleased]: https://github.com/arikusi/deepseek-mcp-server/compare/v1.4.2...HEAD
|
|
282
|
+
[1.4.2]: https://github.com/arikusi/deepseek-mcp-server/compare/v1.4.1...v1.4.2
|
|
283
|
+
[1.4.1]: https://github.com/arikusi/deepseek-mcp-server/compare/v1.4.0...v1.4.1
|
|
265
284
|
[1.4.0]: https://github.com/arikusi/deepseek-mcp-server/compare/v1.3.3...v1.4.0
|
|
266
285
|
[1.3.3]: https://github.com/arikusi/deepseek-mcp-server/compare/v1.3.2...v1.3.3
|
|
267
286
|
[1.3.2]: https://github.com/arikusi/deepseek-mcp-server/compare/v1.3.1...v1.3.2
|
package/README.md
CHANGED
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
[](https://github.com/arikusi/deepseek-mcp-server/actions)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
<a href="https://glama.ai/mcp/servers/@arikusi/deepseek-mcp-server">
|
|
11
|
+
<img width="380" height="200" src="https://glama.ai/mcp/servers/@arikusi/deepseek-mcp-server/badge" />
|
|
12
|
+
</a>
|
|
13
|
+
|
|
14
|
+
MCP server for DeepSeek AI models (Chat + Reasoner). Supports stdio and HTTP transports, Docker deployment, multi-turn sessions, model fallback with circuit breaker, function calling, thinking mode, JSON output, multimodal input, and cost tracking.
|
|
11
15
|
|
|
12
16
|
**Compatible with:**
|
|
13
17
|
- Claude Code CLI
|
|
@@ -61,7 +65,9 @@ That's it! Your MCP client can now use DeepSeek models!
|
|
|
61
65
|
- **12 Prompt Templates**: Templates for debugging, code review, function calling, and more
|
|
62
66
|
- **Streaming Support**: Real-time response generation
|
|
63
67
|
- **Multimodal Ready**: Content part types for text + image input (enable with `ENABLE_MULTIMODAL=true`)
|
|
64
|
-
- **
|
|
68
|
+
- **HTTP Transport**: Remote access via Streamable HTTP with `TRANSPORT=http`
|
|
69
|
+
- **Docker Ready**: Multi-stage Dockerfile with health checks for containerized deployment
|
|
70
|
+
- **Tested**: 253 tests with 90%+ code coverage
|
|
65
71
|
- **Type-Safe**: Full TypeScript implementation
|
|
66
72
|
- **MCP Compatible**: Works with any MCP-compatible CLI (Claude Code, Gemini CLI, etc.)
|
|
67
73
|
|
|
@@ -388,6 +394,8 @@ The server is configured via environment variables. All settings except `DEEPSEE
|
|
|
388
394
|
| `CIRCUIT_BREAKER_RESET_TIMEOUT` | `30000` | Milliseconds before circuit half-opens |
|
|
389
395
|
| `MAX_SESSION_MESSAGES` | `200` | Max messages per session (sliding window) |
|
|
390
396
|
| `ENABLE_MULTIMODAL` | `false` | Enable multimodal (image) input support |
|
|
397
|
+
| `TRANSPORT` | `stdio` | Transport mode: `stdio` or `http` |
|
|
398
|
+
| `HTTP_PORT` | `3000` | HTTP server port (when TRANSPORT=http) |
|
|
391
399
|
|
|
392
400
|
**Example with custom config:**
|
|
393
401
|
```bash
|
|
@@ -415,6 +423,7 @@ deepseek-mcp-server/
|
|
|
415
423
|
│ ├── session.ts # In-memory session store (multi-turn)
|
|
416
424
|
│ ├── circuit-breaker.ts # Circuit breaker pattern
|
|
417
425
|
│ ├── usage-tracker.ts # Usage statistics tracker
|
|
426
|
+
│ ├── transport-http.ts # Streamable HTTP transport (Express)
|
|
418
427
|
│ ├── tools/
|
|
419
428
|
│ │ ├── deepseek-chat.ts # deepseek_chat tool (sessions + fallback)
|
|
420
429
|
│ │ ├── deepseek-sessions.ts # deepseek_sessions tool
|
|
@@ -475,6 +484,37 @@ npm start
|
|
|
475
484
|
|
|
476
485
|
The server will start and wait for MCP client connections via stdio.
|
|
477
486
|
|
|
487
|
+
### HTTP Transport
|
|
488
|
+
|
|
489
|
+
Run the server as an HTTP endpoint for remote access:
|
|
490
|
+
|
|
491
|
+
```bash
|
|
492
|
+
TRANSPORT=http HTTP_PORT=3000 DEEPSEEK_API_KEY=your-key node dist/index.js
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
Test the health endpoint:
|
|
496
|
+
```bash
|
|
497
|
+
curl http://localhost:3000/health
|
|
498
|
+
# → {"status":"ok","version":"1.4.2","uptime":5.2,"transport":"http","timestamp":"..."}
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
The MCP endpoint is available at `POST /mcp` (Streamable HTTP protocol).
|
|
502
|
+
|
|
503
|
+
### Docker
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
# Build
|
|
507
|
+
docker build -t deepseek-mcp-server .
|
|
508
|
+
|
|
509
|
+
# Run
|
|
510
|
+
docker run -d -p 3000:3000 -e DEEPSEEK_API_KEY=your-key deepseek-mcp-server
|
|
511
|
+
|
|
512
|
+
# Or use docker-compose
|
|
513
|
+
DEEPSEEK_API_KEY=your-key docker compose up -d
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
The Docker image defaults to HTTP transport on port 3000 with a built-in health check.
|
|
517
|
+
|
|
478
518
|
## Troubleshooting
|
|
479
519
|
|
|
480
520
|
### "DEEPSEEK_API_KEY environment variable is not set"
|
package/dist/config.d.ts
CHANGED
|
@@ -19,6 +19,11 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
19
19
|
circuitBreakerResetTimeout: z.ZodDefault<z.ZodNumber>;
|
|
20
20
|
maxSessionMessages: z.ZodDefault<z.ZodNumber>;
|
|
21
21
|
enableMultimodal: z.ZodDefault<z.ZodBoolean>;
|
|
22
|
+
transport: z.ZodDefault<z.ZodEnum<{
|
|
23
|
+
stdio: "stdio";
|
|
24
|
+
http: "http";
|
|
25
|
+
}>>;
|
|
26
|
+
httpPort: z.ZodDefault<z.ZodNumber>;
|
|
22
27
|
}, z.core.$strip>;
|
|
23
28
|
export type Config = z.infer<typeof ConfigSchema>;
|
|
24
29
|
/**
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,QAAA,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;iBAkBhB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAIlD;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAyDnC;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAKlC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC"}
|
package/dist/config.js
CHANGED
|
@@ -20,6 +20,8 @@ const ConfigSchema = z.object({
|
|
|
20
20
|
circuitBreakerResetTimeout: z.number().positive().default(30000),
|
|
21
21
|
maxSessionMessages: z.number().positive().default(200),
|
|
22
22
|
enableMultimodal: z.boolean().default(false),
|
|
23
|
+
transport: z.enum(['stdio', 'http']).default('stdio'),
|
|
24
|
+
httpPort: z.number().positive().default(3000),
|
|
23
25
|
});
|
|
24
26
|
let cachedConfig = null;
|
|
25
27
|
/**
|
|
@@ -60,6 +62,8 @@ export function loadConfig() {
|
|
|
60
62
|
? parseInt(process.env.MAX_SESSION_MESSAGES, 10)
|
|
61
63
|
: 200,
|
|
62
64
|
enableMultimodal: process.env.ENABLE_MULTIMODAL === 'true',
|
|
65
|
+
transport: (process.env.TRANSPORT || 'stdio'),
|
|
66
|
+
httpPort: process.env.HTTP_PORT ? parseInt(process.env.HTTP_PORT, 10) : 3000,
|
|
63
67
|
};
|
|
64
68
|
const result = ConfigSchema.safeParse(raw);
|
|
65
69
|
if (!result.success) {
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AA6FH,wBAAgB,mBAAmB,gEAUlC"}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { createServer, version } from './server.js';
|
|
|
11
11
|
import { registerAllTools } from './tools/index.js';
|
|
12
12
|
import { registerAllPrompts } from './prompts/index.js';
|
|
13
13
|
import { registerAllResources } from './resources/index.js';
|
|
14
|
+
import { startHttpTransport } from './transport-http.js';
|
|
14
15
|
async function main() {
|
|
15
16
|
// Load and validate configuration
|
|
16
17
|
try {
|
|
@@ -45,13 +46,26 @@ async function main() {
|
|
|
45
46
|
console.error('[DeepSeek MCP] API connection successful');
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
if (config.transport === 'http') {
|
|
50
|
+
// HTTP transport: per-session McpServer, shared DeepSeekClient
|
|
51
|
+
const serverFactory = () => {
|
|
52
|
+
const s = createServer();
|
|
53
|
+
registerAllTools(s, deepseek);
|
|
54
|
+
registerAllPrompts(s);
|
|
55
|
+
registerAllResources(s);
|
|
56
|
+
return s;
|
|
57
|
+
};
|
|
58
|
+
await startHttpTransport(serverFactory, config.httpPort);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Stdio transport (default)
|
|
62
|
+
const transport = new StdioServerTransport();
|
|
63
|
+
await server.connect(transport);
|
|
64
|
+
console.error('[DeepSeek MCP] Server running on stdio');
|
|
65
|
+
console.error('[DeepSeek MCP] Available tools: deepseek_chat (sessions, fallback), deepseek_sessions');
|
|
66
|
+
console.error('[DeepSeek MCP] Available prompts: 12 reasoning templates');
|
|
67
|
+
console.error('[DeepSeek MCP] Available resources: deepseek://models, deepseek://config, deepseek://usage');
|
|
68
|
+
}
|
|
55
69
|
}
|
|
56
70
|
// Error handling
|
|
57
71
|
process.on('uncaughtException', (error) => {
|
|
@@ -62,6 +76,18 @@ process.on('unhandledRejection', (reason, promise) => {
|
|
|
62
76
|
console.error('[DeepSeek MCP] Unhandled rejection at:', promise, 'reason:', reason);
|
|
63
77
|
process.exit(1);
|
|
64
78
|
});
|
|
79
|
+
// Smithery sandbox: allows scanning tools/resources without real credentials
|
|
80
|
+
export function createSandboxServer() {
|
|
81
|
+
process.env.DEEPSEEK_API_KEY = process.env.DEEPSEEK_API_KEY || 'sandbox-key';
|
|
82
|
+
process.env.SKIP_CONNECTION_TEST = 'true';
|
|
83
|
+
loadConfig();
|
|
84
|
+
const client = new DeepSeekClient();
|
|
85
|
+
const server = createServer();
|
|
86
|
+
registerAllTools(server, client);
|
|
87
|
+
registerAllPrompts(server);
|
|
88
|
+
registerAllResources(server);
|
|
89
|
+
return server;
|
|
90
|
+
}
|
|
65
91
|
// Start the server
|
|
66
92
|
main().catch((error) => {
|
|
67
93
|
console.error('[DeepSeek MCP] Fatal error:', error);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;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IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Creates and exports the McpServer instance with version from package.json
|
|
4
4
|
*/
|
|
5
5
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
-
declare
|
|
6
|
+
declare let version: string;
|
|
7
7
|
export { version };
|
|
8
8
|
export declare function createServer(): McpServer;
|
|
9
9
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKpE,QAAA,IAAI,OAAO,QAAU,CAAC;AAStB,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,wBAAgB,YAAY,IAAI,SAAS,CAKxC"}
|
package/dist/server.js
CHANGED
|
@@ -3,9 +3,18 @@
|
|
|
3
3
|
* Creates and exports the McpServer instance with version from package.json
|
|
4
4
|
*/
|
|
5
5
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { readFileSync } from 'fs';
|
|
7
|
+
import { dirname, join } from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
let version = '1.4.2';
|
|
10
|
+
try {
|
|
11
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
|
|
13
|
+
version = pkg.version;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// CJS bundler fallback (e.g., Smithery) — uses hardcoded version
|
|
17
|
+
}
|
|
9
18
|
export { version };
|
|
10
19
|
export function createServer() {
|
|
11
20
|
return new McpServer({
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,IAAI,OAAO,GAAG,OAAO,CAAC;AACtB,IAAI,CAAC;IACH,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IACrF,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;AACxB,CAAC;AAAC,MAAM,CAAC;IACP,iEAAiE;AACnE,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,SAAS,CAAC;QACnB,IAAI,EAAE,qBAAqB;QAC3B,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Transport for DeepSeek MCP Server
|
|
3
|
+
* Implements Streamable HTTP transport using the MCP SDK's Express middleware.
|
|
4
|
+
* Each MCP session gets its own McpServer instance; DeepSeekClient is shared.
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
export declare function createHttpApp(serverFactory: () => McpServer): import("express").Express;
|
|
8
|
+
export declare function startHttpTransport(serverFactory: () => McpServer, port: number): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=transport-http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport-http.d.ts","sourceRoot":"","sources":["../src/transport-http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,SAAS,6BAsF3D;AAED,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,MAAM,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBpG"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Transport for DeepSeek MCP Server
|
|
3
|
+
* Implements Streamable HTTP transport using the MCP SDK's Express middleware.
|
|
4
|
+
* Each MCP session gets its own McpServer instance; DeepSeekClient is shared.
|
|
5
|
+
*/
|
|
6
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
7
|
+
import { createMcpExpressApp } from '@modelcontextprotocol/sdk/server/express.js';
|
|
8
|
+
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
+
import { randomUUID } from 'node:crypto';
|
|
10
|
+
import { version } from './server.js';
|
|
11
|
+
const transports = {};
|
|
12
|
+
export function createHttpApp(serverFactory) {
|
|
13
|
+
const app = createMcpExpressApp({ host: '0.0.0.0' });
|
|
14
|
+
// Health check endpoint
|
|
15
|
+
app.get('/health', (_req, res) => {
|
|
16
|
+
res.json({
|
|
17
|
+
status: 'ok',
|
|
18
|
+
version,
|
|
19
|
+
uptime: process.uptime(),
|
|
20
|
+
transport: 'http',
|
|
21
|
+
timestamp: new Date().toISOString(),
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
// POST /mcp — handle JSON-RPC requests
|
|
25
|
+
app.post('/mcp', async (req, res) => {
|
|
26
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
27
|
+
// Existing session — reuse transport
|
|
28
|
+
if (sessionId && transports[sessionId]) {
|
|
29
|
+
await transports[sessionId].handleRequest(req, res, req.body);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// New initialize request — create session
|
|
33
|
+
if (!sessionId && isInitializeRequest(req.body)) {
|
|
34
|
+
const transport = new StreamableHTTPServerTransport({
|
|
35
|
+
sessionIdGenerator: () => randomUUID(),
|
|
36
|
+
onsessioninitialized: (id) => {
|
|
37
|
+
transports[id] = transport;
|
|
38
|
+
console.error(`[DeepSeek MCP] HTTP session initialized: ${id}`);
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
transport.onclose = () => {
|
|
42
|
+
if (transport.sessionId) {
|
|
43
|
+
delete transports[transport.sessionId];
|
|
44
|
+
console.error(`[DeepSeek MCP] HTTP session closed: ${transport.sessionId}`);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const server = serverFactory();
|
|
48
|
+
await server.connect(transport);
|
|
49
|
+
await transport.handleRequest(req, res, req.body);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Invalid request
|
|
53
|
+
res.status(400).json({
|
|
54
|
+
jsonrpc: '2.0',
|
|
55
|
+
error: { code: -32000, message: 'Invalid request: no valid session or not an initialize request' },
|
|
56
|
+
id: null,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
// GET /mcp — SSE stream for existing session
|
|
60
|
+
app.get('/mcp', async (req, res) => {
|
|
61
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
62
|
+
if (sessionId && transports[sessionId]) {
|
|
63
|
+
await transports[sessionId].handleRequest(req, res);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
res.status(400).json({
|
|
67
|
+
jsonrpc: '2.0',
|
|
68
|
+
error: { code: -32000, message: 'Invalid or missing session ID' },
|
|
69
|
+
id: null,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
// DELETE /mcp — terminate session
|
|
74
|
+
app.delete('/mcp', async (req, res) => {
|
|
75
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
76
|
+
if (sessionId && transports[sessionId]) {
|
|
77
|
+
await transports[sessionId].close();
|
|
78
|
+
delete transports[sessionId];
|
|
79
|
+
res.status(200).json({ status: 'session terminated' });
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
res.status(400).json({
|
|
83
|
+
jsonrpc: '2.0',
|
|
84
|
+
error: { code: -32000, message: 'Invalid or missing session ID' },
|
|
85
|
+
id: null,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return app;
|
|
90
|
+
}
|
|
91
|
+
export async function startHttpTransport(serverFactory, port) {
|
|
92
|
+
const app = createHttpApp(serverFactory);
|
|
93
|
+
const httpServer = app.listen(port, '0.0.0.0', () => {
|
|
94
|
+
console.error(`[DeepSeek MCP] HTTP transport listening on http://0.0.0.0:${port}`);
|
|
95
|
+
console.error(`[DeepSeek MCP] Health check: http://localhost:${port}/health`);
|
|
96
|
+
console.error(`[DeepSeek MCP] MCP endpoint: http://localhost:${port}/mcp`);
|
|
97
|
+
});
|
|
98
|
+
const shutdown = async () => {
|
|
99
|
+
console.error('[DeepSeek MCP] Shutting down HTTP transport...');
|
|
100
|
+
for (const [id, transport] of Object.entries(transports)) {
|
|
101
|
+
await transport.close();
|
|
102
|
+
delete transports[id];
|
|
103
|
+
}
|
|
104
|
+
httpServer.close();
|
|
105
|
+
};
|
|
106
|
+
process.on('SIGINT', shutdown);
|
|
107
|
+
process.on('SIGTERM', shutdown);
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=transport-http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport-http.js","sourceRoot":"","sources":["../src/transport-http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,UAAU,GAAkD,EAAE,CAAC;AAErE,MAAM,UAAU,aAAa,CAAC,aAA8B;IAC1D,MAAM,GAAG,GAAG,mBAAmB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IAErD,wBAAwB;IACxB,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QAC/B,GAAG,CAAC,IAAI,CAAC;YACP,MAAM,EAAE,IAAI;YACZ,OAAO;YACP,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;YACxB,SAAS,EAAE,MAAM;YACjB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,uCAAuC;IACvC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QAClC,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAuB,CAAC;QAEtE,qCAAqC;QACrC,IAAI,SAAS,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACvC,MAAM,UAAU,CAAC,SAA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C;IAEH,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,aAA8B,EAAE,IAAY;IACnF,MAAM,GAAG,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;IAEzC,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE;QAClD,OAAO,CAAC,KAAK,CAAC,6DAA6D,IAAI,EAAE,CAAC,CAAC;QACnF,OAAO,CAAC,KAAK,CAAC,iDAAiD,IAAI,SAAS,CAAC,CAAC;QAC9E,OAAO,CAAC,KAAK,CAAC,iDAAiD,IAAI,MAAM,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;QAC1B,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAChE,KAAK,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YACzD,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;YACxB,OAAO,UAAU,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC;QACD,UAAU,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arikusi/deepseek-mcp-server",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
|
+
"mcpName": "io.github.arikusi/deepseek",
|
|
4
5
|
"description": "MCP Server for DeepSeek API integration - enables Claude Code to use DeepSeek Chat and Reasoner models",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"type": "module",
|
|
@@ -36,7 +37,10 @@
|
|
|
36
37
|
"circuit-breaker",
|
|
37
38
|
"model-fallback",
|
|
38
39
|
"gemini-cli",
|
|
39
|
-
"mcp-server"
|
|
40
|
+
"mcp-server",
|
|
41
|
+
"docker",
|
|
42
|
+
"http-transport",
|
|
43
|
+
"streamable-http"
|
|
40
44
|
],
|
|
41
45
|
"author": "arikusi",
|
|
42
46
|
"license": "MIT",
|
|
@@ -63,6 +67,7 @@
|
|
|
63
67
|
"zod": "^4.3.6"
|
|
64
68
|
},
|
|
65
69
|
"devDependencies": {
|
|
70
|
+
"@types/express": "^5.0.6",
|
|
66
71
|
"@types/node": "^22.10.5",
|
|
67
72
|
"@vitest/coverage-v8": "^4.0.18",
|
|
68
73
|
"typescript": "^5.7.3",
|