Skip to content

Commit 576915f

Browse files
authored
Merge pull request #13 from Beyond-Better/staging
Proper docs for exported modules
2 parents 7292ca8 + 35e6282 commit 576915f

File tree

6 files changed

+193
-22
lines changed

6 files changed

+193
-22
lines changed

deno.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@beyondbetter/bb-mcp-server",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"description": "Comprehensive library for building Deno-based MCP servers",
55
"license": "MIT",
66
"copyright": "2025 - Beyond Better <charlie@beyondbetter.app>",

examples/1-simple/main.ts

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#!/usr/bin/env -S deno run --allow-all
1+
#!/usr/bin/env -S deno run --allow-all --unstable-kv
22

33
/**
4-
* Simple MCP Server - Minimal Setup with Basic Plugin Tools
4+
* @module examples/1-simple
5+
*
6+
* # Simple MCP Server - Minimal Setup with Basic Plugin Tools
57
*
68
* This demonstrates the simplest approach for bb-mcp-server:
79
* - Zero custom dependencies (uses library defaults)
@@ -53,10 +55,10 @@
5355
* ======
5456
*
5557
* # STDIO transport (default):
56-
* deno run --allow-all main.ts
58+
* deno run --allow-all --unstable-kv main.ts
5759
*
5860
* # HTTP transport:
59-
* MCP_TRANSPORT=http deno run --allow-all main.ts
61+
* MCP_TRANSPORT=http deno run --allow-all --unstable-kv main.ts
6062
* # Then access: http://localhost:3000
6163
*
6264
* NEXT STEPS:
@@ -66,6 +68,34 @@
6668
* 1. Try 2-plugin-workflows to learn about multi-step processes
6769
* 2. Explore 3-plugin-api-auth for external API integration
6870
* 3. Study 4-manual-deps for complete infrastructure control
71+
*
72+
* @example Run this example directly from JSR
73+
* ```bash
74+
* # Run with STDIO transport (default)
75+
* deno run --allow-all --unstable-kv jsr:@beyondbetter/bb-mcp-server/examples/1-simple
76+
*
77+
* # Run with HTTP transport
78+
* MCP_TRANSPORT=http deno run --allow-all --unstable-kv jsr:@beyondbetter/bb-mcp-server/examples/1-simple
79+
* ```
80+
*
81+
* @example Basic server setup
82+
* ```typescript
83+
* import { AppServer } from 'jsr:@beyondbetter/bb-mcp-server';
84+
*
85+
* const appServer = await AppServer.create({
86+
* serverConfig: {
87+
* name: 'my-mcp-server',
88+
* version: '1.0.0',
89+
* title: 'My MCP Server',
90+
* description: 'My custom MCP server',
91+
* },
92+
* });
93+
*
94+
* await appServer.start();
95+
* ```
96+
*
97+
* @see {@link https://github.com/beyond-better/bb-mcp-server/tree/main/examples/1-simple | Full example documentation}
98+
* @see {@link https://github.com/beyond-better/bb-mcp-server/tree/main/examples | All examples}
6999
*/
70100

71101
// Import the bb-mcp-server library - handles ALL infrastructure

examples/2-plugin-workflows/main.ts

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#!/usr/bin/env -S deno run --allow-all
1+
#!/usr/bin/env -S deno run --allow-all --unstable-kv
22

33
/**
4-
* Plugin-Workflows MCP Server - Multi-Step Workflow Demonstrations
4+
* @module examples/2-plugin-workflows
5+
*
6+
* # Plugin-Workflows MCP Server - Multi-Step Workflow Demonstrations
57
*
68
* This demonstrates advanced workflow capabilities with bb-mcp-server:
79
* - Multi-step workflow implementations with state management
@@ -63,14 +65,14 @@
6365
* ======
6466
*
6567
* # STDIO transport (default):
66-
* deno run --allow-all main.ts
68+
* deno run --allow-all --unstable-kv main.ts
6769
*
6870
* # HTTP transport:
69-
* MCP_TRANSPORT=http deno run --allow-all main.ts
71+
* MCP_TRANSPORT=http deno run --allow-all --unstable-kv main.ts
7072
* # Then access: http://localhost:3000
7173
*
7274
* # Test workflows:
73-
* deno test --allow-all src/tests/
75+
* deno test --allow-all --unstable-kv src/tests/
7476
*
7577
* WORKFLOW EXAMPLES:
7678
* ==================
@@ -108,6 +110,30 @@
108110
* 1. Try 3-plugin-api-auth to learn OAuth and external API integration
109111
* 2. Explore 4-manual-deps for complete infrastructure control
110112
* 3. Build your own workflows for specific business processes
113+
*
114+
* @example Run this example directly from JSR
115+
* ```bash
116+
* # Run with STDIO transport (default)
117+
* deno run --allow-all --unstable-kv jsr:@beyondbetter/bb-mcp-server/examples/2-plugin-workflows
118+
*
119+
* # Run with HTTP transport
120+
* MCP_TRANSPORT=http deno run --allow-all --unstable-kv jsr:@beyondbetter/bb-mcp-server/examples/2-plugin-workflows
121+
* ```
122+
*
123+
* @example Execute a workflow
124+
* ```typescript
125+
* // Data processing workflow example
126+
* const result = await workflow.execute({
127+
* userId: 'user123',
128+
* data: [{name: 'Alice', score: 95}],
129+
* transformations: ['normalize', 'sort'],
130+
* outputFormat: 'json',
131+
* analysisType: 'summary'
132+
* });
133+
* ```
134+
*
135+
* @see {@link https://github.com/beyond-better/bb-mcp-server/tree/main/examples/2-plugin-workflows | Full example documentation}
136+
* @see {@link https://github.com/beyond-better/bb-mcp-server/tree/main/examples/1-simple | Previous example: Simple MCP Server}
111137
*/
112138

113139
// Import the bb-mcp-server library - handles ALL infrastructure
@@ -155,7 +181,7 @@ async function main(): Promise<void> {
155181
console.log(' - content_generation_pipeline (plan → generate → review → publish)');
156182
console.log('🛠️ Available tools: current_datetime, validate_json');
157183
console.log('🔄 Transport:', process.env.MCP_TRANSPORT || 'stdio');
158-
console.log('🧪 Run tests: deno test --allow-all src/tests/');
184+
console.log('🧪 Run tests: deno test --allow-all --unstable-kv src/tests/');
159185
} catch (error) {
160186
console.error('❌ Failed to start Plugin-Workflows MCP Server:', error);
161187
Deno.exit(1);

examples/3-plugin-api-auth/main.ts

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#!/usr/bin/env -S deno run --allow-all
1+
#!/usr/bin/env -S deno run --allow-all --unstable-kv
22

33
/**
4-
* Plugin-API-Auth MCP Server - OAuth and External API Integration
4+
* @module examples/3-plugin-api-auth
5+
*
6+
* # Plugin-API-Auth MCP Server - OAuth and External API Integration
57
*
68
* This demonstrates advanced capabilities with bb-mcp-server:
79
* - OAuth authentication with external APIs
@@ -53,10 +55,10 @@
5355
* ======
5456
*
5557
* # STDIO transport:
56-
* deno run --allow-all main.ts
58+
* deno run --allow-all --unstable-kv main.ts
5759
*
5860
* # HTTP transport with OAuth endpoints:
59-
* MCP_TRANSPORT=http deno run --allow-all main.ts
61+
* MCP_TRANSPORT=http deno run --allow-all --unstable-kv main.ts
6062
* # Then access: http://localhost:3000
6163
*
6264
* NEXT STEPS:
@@ -66,6 +68,36 @@
6668
* 1. Try 4-manual-deps for complete infrastructure control
6769
* 2. Build your own OAuth integrations for different providers
6870
* 3. Implement custom authentication and API patterns
71+
*
72+
* @example Run this example directly from JSR (requires OAuth credentials)
73+
* ```bash
74+
* # Set up OAuth credentials first
75+
* export OAUTH_CONSUMER_CLIENT_ID=your-client-id
76+
* export OAUTH_CONSUMER_CLIENT_SECRET=your-client-secret
77+
*
78+
* # Run with STDIO transport
79+
* deno run --allow-all --unstable-kv jsr:@beyondbetter/bb-mcp-server/examples/3-plugin-api-auth
80+
*
81+
* # Run with HTTP transport (includes OAuth endpoints)
82+
* MCP_TRANSPORT=http deno run --allow-all --unstable-kv jsr:@beyondbetter/bb-mcp-server/examples/3-plugin-api-auth
83+
* ```
84+
*
85+
* @example Custom OAuth consumer setup
86+
* ```typescript
87+
* import { OAuthConsumer } from 'jsr:@beyondbetter/bb-mcp-server';
88+
*
89+
* const oauthConsumer = new ExampleOAuthConsumer({
90+
* provider: 'examplecorp',
91+
* authUrl: 'https://api.example.com/oauth/authorize',
92+
* tokenUrl: 'https://api.example.com/oauth/token',
93+
* clientId: process.env.OAUTH_CONSUMER_CLIENT_ID,
94+
* clientSecret: process.env.OAUTH_CONSUMER_CLIENT_SECRET,
95+
* scopes: ['read', 'write'],
96+
* });
97+
* ```
98+
*
99+
* @see {@link https://github.com/beyond-better/bb-mcp-server/tree/main/examples/3-plugin-api-auth | Full example documentation}
100+
* @see {@link https://github.com/beyond-better/bb-mcp-server/tree/main/examples/2-plugin-workflows | Previous example: Multi-step Workflows}
69101
*/
70102

71103
// Import the bb-mcp-server library - handles ALL infrastructure

examples/4-manual-deps/main.ts

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#!/usr/bin/env -S deno run --allow-all
1+
#!/usr/bin/env -S deno run --allow-all --unstable-kv
22

33
/**
4-
* Manual-Deps MCP Server - Complete Infrastructure Control
4+
* @module examples/4-manual-deps
5+
*
6+
* # Manual-Deps MCP Server - Complete Infrastructure Control
57
*
68
* This demonstrates expert-level capabilities with bb-mcp-server:
79
* - Complete control over dependency creation and configuration
@@ -50,10 +52,10 @@
5052
* ======
5153
*
5254
* # STDIO transport:
53-
* deno run --allow-all main.ts
55+
* deno run --allow-all --unstable-kv main.ts
5456
*
5557
* # HTTP transport with OAuth endpoints:
56-
* MCP_TRANSPORT=http deno run --allow-all main.ts
58+
* MCP_TRANSPORT=http deno run --allow-all --unstable-kv main.ts
5759
* # Then access: http://localhost:3000
5860
*
5961
* EXPERT PATTERNS:
@@ -64,6 +66,39 @@
6466
* - Manual registration within library lifecycle
6567
* - Advanced configuration and environment handling
6668
* - Integration with existing enterprise infrastructure
69+
*
70+
* @example Run this example directly from JSR
71+
* ```bash
72+
* # Run with STDIO transport (default)
73+
* deno run --allow-all --unstable-kv jsr:@beyondbetter/bb-mcp-server/examples/4-manual-deps
74+
*
75+
* # Run with HTTP transport and OAuth endpoints
76+
* MCP_TRANSPORT=http deno run --allow-all --unstable-kv jsr:@beyondbetter/bb-mcp-server/examples/4-manual-deps
77+
* ```
78+
*
79+
* @example Manual dependency creation
80+
* ```typescript
81+
* import { AppServer } from 'jsr:@beyondbetter/bb-mcp-server';
82+
*
83+
* // Custom dependency function with complete control
84+
* async function createManualDependencies(baseConfig) {
85+
* // Manually create all dependencies
86+
* const toolRegistry = await getToolRegistry(logger, errorHandler);
87+
* const workflowRegistry = await getWorkflowRegistry(logger, errorHandler);
88+
*
89+
* // Manual registration with custom logic
90+
* toolRegistry.registerTool('my_tool', definition, handler);
91+
* workflowRegistry.registerWorkflow(myWorkflow);
92+
*
93+
* return { toolRegistry, workflowRegistry, ...otherDeps };
94+
* }
95+
*
96+
* const appServer = await AppServer.create(createManualDependencies);
97+
* await appServer.start();
98+
* ```
99+
*
100+
* @see {@link https://github.com/beyond-better/bb-mcp-server/tree/main/examples/4-manual-deps | Full example documentation}
101+
* @see {@link https://github.com/beyond-better/bb-mcp-server/tree/main/examples/3-plugin-api-auth | Previous example: OAuth and API Integration}
67102
*/
68103

69104
// Import the bb-mcp-server library

examples/chunked-storage-demo/main.ts

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,62 @@
11
/**
2-
* Chunked Storage Demo - MCP Server with Large Message Support
2+
* @module examples/chunked-storage-demo
3+
*
4+
* # Chunked Storage Demo - MCP Server with Large Message Support
35
*
46
* This example demonstrates how to use the TransportEventStoreChunked
57
* to handle large messages that exceed Deno KV's 64KB limit.
68
*
79
* Features demonstrated:
8-
* - Automatic chunking of large messages
9-
* - Compression for efficient storage
10+
* - Automatic chunking of large messages (60KB chunks)
11+
* - Compression for efficient storage (gzip)
1012
* - Monitoring and statistics
1113
* - Error handling for oversized messages
14+
*
15+
* The chunked storage system automatically splits messages larger than 60KB into
16+
* smaller chunks, stores them separately in Deno KV, and reassembles them on retrieval.
17+
* Compression is applied when beneficial (typically 20-80% size reduction for text).
18+
*
19+
* @example Run this example directly from JSR
20+
* ```bash
21+
* # Run with STDIO transport (default)
22+
* deno run --allow-all --unstable-kv jsr:@beyondbetter/bb-mcp-server/examples/chunked-storage-demo
23+
*
24+
* # Run with HTTP transport
25+
* MCP_TRANSPORT=http deno run --allow-all --unstable-kv jsr:@beyondbetter/bb-mcp-server/examples/chunked-storage-demo
26+
* ```
27+
*
28+
* @example Test large message handling
29+
* ```bash
30+
* # After starting the server, use MCP client to generate large messages:
31+
* # Generate a 500KB JSON message
32+
* generate_large_message({"size": 500, "content": "json"})
33+
*
34+
* # Check storage statistics
35+
* get_storage_stats({})
36+
*
37+
* # Generate very large message (2MB)
38+
* generate_large_message({"size": 2048, "content": "mixed"})
39+
* ```
40+
*
41+
* @example Using chunked storage in your project
42+
* ```typescript
43+
* import { TransportEventStoreChunked, KVManager } from 'jsr:@beyondbetter/bb-mcp-server';
44+
*
45+
* const eventStore = new TransportEventStoreChunked(
46+
* kvManager,
47+
* ['events'],
48+
* logger,
49+
* {
50+
* maxChunkSize: 60 * 1024, // 60KB chunks
51+
* enableCompression: true, // Enable gzip compression
52+
* compressionThreshold: 1024, // Compress messages > 1KB
53+
* maxMessageSize: 10 * 1024 * 1024, // 10MB max message size
54+
* },
55+
* );
56+
* ```
57+
*
58+
* @see {@link https://github.com/beyond-better/bb-mcp-server/tree/main/examples/chunked-storage-demo | Full example documentation}
59+
* @see {@link https://github.com/beyond-better/bb-mcp-server/tree/main/examples | All examples}
1260
*/
1361

1462
import {

0 commit comments

Comments
 (0)