mcp-http-webhook 1.0.0

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.
Files changed (80) hide show
  1. package/.eslintrc.json +16 -0
  2. package/.prettierrc.json +8 -0
  3. package/ARCHITECTURE.md +269 -0
  4. package/CONTRIBUTING.md +136 -0
  5. package/GETTING_STARTED.md +310 -0
  6. package/IMPLEMENTATION.md +294 -0
  7. package/LICENSE +21 -0
  8. package/MIGRATION_TO_SDK.md +263 -0
  9. package/README.md +496 -0
  10. package/SDK_INTEGRATION_COMPLETE.md +300 -0
  11. package/STANDARD_SUBSCRIPTIONS.md +268 -0
  12. package/STANDARD_SUBSCRIPTIONS_COMPLETE.md +309 -0
  13. package/SUMMARY.md +272 -0
  14. package/Spec.md +2778 -0
  15. package/dist/errors/index.d.ts +52 -0
  16. package/dist/errors/index.d.ts.map +1 -0
  17. package/dist/errors/index.js +81 -0
  18. package/dist/errors/index.js.map +1 -0
  19. package/dist/index.d.ts +9 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +37 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/protocol/ProtocolHandler.d.ts +37 -0
  24. package/dist/protocol/ProtocolHandler.d.ts.map +1 -0
  25. package/dist/protocol/ProtocolHandler.js +172 -0
  26. package/dist/protocol/ProtocolHandler.js.map +1 -0
  27. package/dist/server.d.ts +6 -0
  28. package/dist/server.d.ts.map +1 -0
  29. package/dist/server.js +502 -0
  30. package/dist/server.js.map +1 -0
  31. package/dist/stores/InMemoryStore.d.ts +27 -0
  32. package/dist/stores/InMemoryStore.d.ts.map +1 -0
  33. package/dist/stores/InMemoryStore.js +73 -0
  34. package/dist/stores/InMemoryStore.js.map +1 -0
  35. package/dist/stores/RedisStore.d.ts +18 -0
  36. package/dist/stores/RedisStore.d.ts.map +1 -0
  37. package/dist/stores/RedisStore.js +45 -0
  38. package/dist/stores/RedisStore.js.map +1 -0
  39. package/dist/stores/index.d.ts +3 -0
  40. package/dist/stores/index.d.ts.map +1 -0
  41. package/dist/stores/index.js +9 -0
  42. package/dist/stores/index.js.map +1 -0
  43. package/dist/subscriptions/SubscriptionManager.d.ts +49 -0
  44. package/dist/subscriptions/SubscriptionManager.d.ts.map +1 -0
  45. package/dist/subscriptions/SubscriptionManager.js +181 -0
  46. package/dist/subscriptions/SubscriptionManager.js.map +1 -0
  47. package/dist/types/index.d.ts +271 -0
  48. package/dist/types/index.d.ts.map +1 -0
  49. package/dist/types/index.js +16 -0
  50. package/dist/types/index.js.map +1 -0
  51. package/dist/utils/index.d.ts +51 -0
  52. package/dist/utils/index.d.ts.map +1 -0
  53. package/dist/utils/index.js +154 -0
  54. package/dist/utils/index.js.map +1 -0
  55. package/dist/webhooks/WebhookManager.d.ts +27 -0
  56. package/dist/webhooks/WebhookManager.d.ts.map +1 -0
  57. package/dist/webhooks/WebhookManager.js +174 -0
  58. package/dist/webhooks/WebhookManager.js.map +1 -0
  59. package/examples/GITHUB_LIVE_EXAMPLE.md +308 -0
  60. package/examples/GITHUB_LIVE_SETUP.md +253 -0
  61. package/examples/QUICKSTART.md +130 -0
  62. package/examples/basic-setup.ts +142 -0
  63. package/examples/github-server-live.ts +690 -0
  64. package/examples/github-server.ts +223 -0
  65. package/examples/google-drive-server-live.ts +773 -0
  66. package/examples/start-github-live.sh +53 -0
  67. package/jest.config.js +20 -0
  68. package/package.json +58 -0
  69. package/src/errors/index.ts +81 -0
  70. package/src/index.ts +19 -0
  71. package/src/server.ts +595 -0
  72. package/src/stores/InMemoryStore.ts +87 -0
  73. package/src/stores/RedisStore.ts +51 -0
  74. package/src/stores/index.ts +2 -0
  75. package/src/subscriptions/SubscriptionManager.ts +240 -0
  76. package/src/types/index.ts +341 -0
  77. package/src/utils/index.ts +156 -0
  78. package/src/webhooks/WebhookManager.ts +230 -0
  79. package/test-sdk-integration.sh +157 -0
  80. package/tsconfig.json +21 -0
@@ -0,0 +1,53 @@
1
+ #!/bin/bash
2
+
3
+ # GitHub MCP Live Integration Helper Script
4
+
5
+ set -e
6
+
7
+ echo "╔═══════════════════════════════════════════════════════════╗"
8
+ echo "║ GitHub MCP Server - Setup Helper ║"
9
+ echo "╚═══════════════════════════════════════════════════════════╝"
10
+ echo ""
11
+
12
+ # Check if ngrok auth token is set
13
+ if [ -z "$NGROK_AUTH_TOKEN" ]; then
14
+ echo "⚠️ ngrok auth token not found in environment"
15
+ echo ""
16
+ echo "To fix this:"
17
+ echo "1. Sign up for free ngrok account: https://dashboard.ngrok.com/signup"
18
+ echo "2. Get your auth token: https://dashboard.ngrok.com/get-started/your-authtoken"
19
+ echo "3. Run: export NGROK_AUTH_TOKEN='your_token_here'"
20
+ echo ""
21
+ read -p "Press Enter to continue (you'll be prompted for token)..."
22
+ else
23
+ echo "✅ ngrok auth token found in environment"
24
+ fi
25
+
26
+ echo ""
27
+ echo "📋 Prerequisites Checklist:"
28
+ echo ""
29
+ echo "1. GitHub Personal Access Token"
30
+ echo " Create at: https://github.com/settings/tokens/new"
31
+ echo " Scopes needed: repo, admin:repo_hook"
32
+ echo ""
33
+ echo "2. Test Repository"
34
+ echo " Use any repo you own, or create: gh repo create mcp-test --public"
35
+ echo ""
36
+ echo "3. ngrok Auth Token (if not set above)"
37
+ echo " Get from: https://dashboard.ngrok.com/get-started/your-authtoken"
38
+ echo ""
39
+
40
+ read -p "Ready to start? (y/n) " -n 1 -r
41
+ echo ""
42
+
43
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
44
+ echo "Setup cancelled."
45
+ exit 0
46
+ fi
47
+
48
+ echo ""
49
+ echo "🚀 Starting GitHub MCP Live Server..."
50
+ echo ""
51
+
52
+ cd "$(dirname "$0")/.."
53
+ npx tsx examples/github-server-live.ts
package/jest.config.js ADDED
@@ -0,0 +1,20 @@
1
+ module.exports = {
2
+ preset: 'ts-jest',
3
+ testEnvironment: 'node',
4
+ roots: ['<rootDir>/src'],
5
+ testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
6
+ collectCoverageFrom: [
7
+ 'src/**/*.ts',
8
+ '!src/**/*.d.ts',
9
+ '!src/**/*.test.ts',
10
+ '!src/**/index.ts'
11
+ ],
12
+ coverageThreshold: {
13
+ global: {
14
+ branches: 80,
15
+ functions: 80,
16
+ lines: 80,
17
+ statements: 80
18
+ }
19
+ }
20
+ };
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "mcp-http-webhook",
3
+ "version": "1.0.0",
4
+ "description": "Production-ready MCP server framework with HTTP + webhook-based subscriptions",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "dev": "tsc --watch",
10
+ "test": "jest",
11
+ "lint": "eslint src --ext .ts",
12
+ "format": "prettier --write \"src/**/*.ts\"",
13
+ "type-check": "tsc --noEmit",
14
+ "prepare": "npm run build",
15
+ "prepublishOnly": "npm run lint && npm run type-check",
16
+ "publish": "npm run build && npm publish --access public"
17
+ },
18
+ "keywords": [
19
+ "mcp",
20
+ "model-context-protocol",
21
+ "webhook",
22
+ "http",
23
+ "ai",
24
+ "llm"
25
+ ],
26
+ "author": "Your Organization",
27
+ "license": "MIT",
28
+ "peerDependencies": {
29
+ "@modelcontextprotocol/sdk": "^1.0.0",
30
+ "express": "^4.18.0"
31
+ },
32
+ "dependencies": {
33
+ "@ngrok/ngrok": "^1.5.2",
34
+ "@octokit/rest": "^20.0.0",
35
+ "cors": "^2.8.5",
36
+ "nanoid": "^5.0.0",
37
+ "ngrok": "^4.3.3",
38
+ "zod": "^3.22.0",
39
+ "googleapis": "^144.0.0"
40
+ },
41
+ "devDependencies": {
42
+ "@types/cors": "^2.8.19",
43
+ "@types/express": "^4.17.21",
44
+ "@types/jest": "^29.5.0",
45
+ "@types/node": "^20.0.0",
46
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
47
+ "@typescript-eslint/parser": "^6.0.0",
48
+ "eslint": "^8.0.0",
49
+ "jest": "^29.5.0",
50
+ "prettier": "^3.0.0",
51
+ "ts-jest": "^29.1.0",
52
+ "typescript": "^5.0.0"
53
+ },
54
+ "optionalDependencies": {
55
+ "ioredis": "^5.3.0",
56
+ "prom-client": "^15.0.0"
57
+ }
58
+ }
@@ -0,0 +1,81 @@
1
+ import { MCPErrorCode } from '../types';
2
+
3
+ /**
4
+ * Base MCP Error class
5
+ */
6
+ export class MCPError extends Error {
7
+ code: number;
8
+ data?: any;
9
+
10
+ constructor(message: string, code: number, data?: any) {
11
+ super(message);
12
+ this.name = this.constructor.name;
13
+ this.code = code;
14
+ this.data = data;
15
+ Error.captureStackTrace(this, this.constructor);
16
+ }
17
+
18
+ toJSON() {
19
+ return {
20
+ error: {
21
+ code: this.code,
22
+ message: this.message,
23
+ data: this.data,
24
+ },
25
+ };
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Authentication error
31
+ */
32
+ export class AuthenticationError extends MCPError {
33
+ constructor(message = 'Authentication failed', data?: any) {
34
+ super(message, MCPErrorCode.AuthenticationError, data);
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Validation error
40
+ */
41
+ export class ValidationError extends MCPError {
42
+ constructor(message = 'Validation failed', data?: any) {
43
+ super(message, MCPErrorCode.ValidationError, data);
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Resource not found error
49
+ */
50
+ export class ResourceNotFoundError extends MCPError {
51
+ constructor(message = 'Resource not found', data?: any) {
52
+ super(message, MCPErrorCode.ResourceNotFoundError, data);
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Tool execution error
58
+ */
59
+ export class ToolExecutionError extends MCPError {
60
+ constructor(message = 'Tool execution failed', data?: any) {
61
+ super(message, MCPErrorCode.ToolExecutionError, data);
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Webhook error
67
+ */
68
+ export class WebhookError extends MCPError {
69
+ constructor(message = 'Webhook error', data?: any) {
70
+ super(message, MCPErrorCode.WebhookError, data);
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Storage error
76
+ */
77
+ export class StorageError extends MCPError {
78
+ constructor(message = 'Storage error', data?: any) {
79
+ super(message, MCPErrorCode.StorageError, data);
80
+ }
81
+ }
package/src/index.ts ADDED
@@ -0,0 +1,19 @@
1
+ // Main export
2
+ export { createMCPServer } from './server';
3
+
4
+ // Types
5
+ export * from './types';
6
+
7
+ // Errors
8
+ export * from './errors';
9
+
10
+ // Utilities
11
+ export * from './utils';
12
+
13
+ // Managers (for advanced usage)
14
+ export { SubscriptionManager } from './subscriptions/SubscriptionManager';
15
+ export { WebhookManager } from './webhooks/WebhookManager';
16
+
17
+ // Store implementations
18
+ export { InMemoryStore } from './stores/InMemoryStore';
19
+ export { RedisStore } from './stores/RedisStore';