A multi-platform AI chatbot powered by the Morpheus decentralized AI network. Built with Vercel Chat SDK.
Morpheus Assistant lets you interact with AI models through the Morpheus compute marketplace — available on Slack, Discord, GitHub, and Linear from a single codebase.
- 🤖 AI-Powered Responses — Streaming AI responses via the Morpheus API Gateway
- 💬 Multi-Platform — Works on Slack, Discord, GitHub Issues, and Linear Issues
- 🔄 Multi-Turn Conversations — Thread-based conversations with context history
- ⚡ Streaming — Real-time streaming responses on supported platforms
- 🎨 Rich UI — Interactive cards, buttons, and slash commands (Slack)
- 🔧 Modular — Enable only the platforms you need via environment variables
- 🚀 Serverless-Ready — Deploy to Vercel with zero config
Models available through the Morpheus AI Gateway:
| Model | Description |
|---|---|
llama-3.3-70b |
Meta's Llama 3.3 70B — general purpose (default) |
llama-3.3-70b:web |
Llama 3.3 with web search capabilities |
qwen3-235b |
Alibaba's Qwen 3 235B — large model |
qwen3-235b:web |
Qwen 3 with web search capabilities |
- Node.js 20+
- A Morpheus API key
- Credentials for at least one platform (Slack, Discord, GitHub, or Linear)
- Redis for production (optional for development)
git clone https://github.com/MorpheusAIs/morpheus-assistant.git
cd morpheus-assistant
npm installcp .env.example .env.localEdit .env.local with your credentials. See platform-specific setup below.
npm run devThe bot will start at http://localhost:3000. Use a tool like ngrok to expose it for webhook testing:
ngrok http 3000npm i -g vercel
vercelOr connect your GitHub repo to Vercel for automatic deployments. Set all environment variables in the Vercel dashboard under Settings > Environment Variables.
The Morpheus API Gateway provides free AI inference through the decentralized compute marketplace.
- Go to app.mor.org
- Create an account or sign in
- Navigate to the API Keys section
- Click Create API Key
- Copy the key immediately — it will only be shown once
- Add it to your
.env.localasMORPHEUS_API_KEY
⚠️ Store your API key securely. Never commit it to version control.
For more details, see the Morpheus API Documentation.
You only need to configure the platforms you want to use. The bot automatically detects which adapters to enable based on your environment variables.
Click to expand Slack setup
- Go to api.slack.com/apps
- Click Create New App > From an app manifest
- Select your workspace
- Paste the contents of
slack-manifest.ymlfrom this repo - Replace
YOUR_DOMAINwith your deployment URL (e.g.,morpheus-assistant.vercel.app) - Click Create
- Go to Settings > Basic Information
- Under App Credentials, copy the Signing Secret
- Go to OAuth & Permissions
- Click Install to Workspace
- Copy the Bot User OAuth Token (starts with
xoxb-)
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secretAfter installation, these slash commands are available:
/ask <question>— Ask a one-off question/morpheus help— Show help information/morpheus models— List available AI models/morpheus about— Learn about Morpheus
Click to expand Discord setup
- Go to discord.com/developers/applications
- Click New Application and name it "Morpheus Assistant"
- Go to the Bot section
- Click Reset Token and copy the Bot Token
- Under Privileged Gateway Intents, enable:
- Message Content Intent
- Server Members Intent
- Go to General Information and copy the Application ID and Public Key
Go to OAuth2 > URL Generator:
- Scopes:
bot,applications.commands - Bot Permissions:
Send Messages,Read Message History,Add Reactions - Copy the generated URL and open it to invite the bot to your server
DISCORD_BOT_TOKEN=your-bot-token
DISCORD_PUBLIC_KEY=your-public-key
DISCORD_APPLICATION_ID=your-application-id
CRON_SECRET=any-random-secret-stringIn the Discord Developer Portal, set the Interactions Endpoint URL to:
https://YOUR_DOMAIN/api/webhooks/discord
The Discord adapter uses a cron-based gateway listener for serverless environments. This is automatically configured via vercel.json — the cron job runs every 9 minutes to maintain the gateway connection.
Click to expand GitHub setup
- Go to github.com/settings/apps
- Click New GitHub App
- Configure:
- Name: Morpheus Assistant
- Homepage URL: Your deployment URL
- Webhook URL:
https://YOUR_DOMAIN/api/webhooks/github - Webhook Secret: Generate a secure random string
- Permissions:
- Issues: Read & Write
- Pull Requests: Read & Write
- Subscribe to events: Issues, Issue comments, Pull requests, Pull request reviews, Pull request review comments
- Click Create GitHub App
- Generate a Private Key (downloads a
.pemfile) - Note the App ID
- Install the app on your repositories
GITHUB_APP_ID=123456
GITHUB_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----"
GITHUB_WEBHOOK_SECRET=your-webhook-secretFor simpler setups, you can use a PAT:
- Go to github.com/settings/tokens
- Generate a new token with
reposcope - Set up a webhook on each repository pointing to
https://YOUR_DOMAIN/api/webhooks/github
GITHUB_TOKEN=ghp_xxxxxxxxxxxx
GITHUB_WEBHOOK_SECRET=your-webhook-secretClick to expand Linear setup
Option A: API Key (Simpler)
- Go to linear.app/settings/api
- Click Create Key
- Copy the API key
Option B: OAuth Application
- Go to linear.app/settings/api/applications
- Create a new application
- Note the Client ID and Client Secret
- Go to linear.app/settings/api > Webhooks
- Click New Webhook
- Set URL to
https://YOUR_DOMAIN/api/webhooks/linear - Enable events: Issues, Issue comments
- Copy the Signing Secret
# API Key auth
LINEAR_API_KEY=lin_api_xxxxxxxxxxxx
LINEAR_WEBHOOK_SECRET=your-webhook-secret
# OR OAuth auth
# LINEAR_CLIENT_ID=your-client-id
# LINEAR_CLIENT_SECRET=your-client-secret
# LINEAR_WEBHOOK_SECRET=your-webhook-secretFor production deployments, configure Redis for persistent thread subscriptions and distributed locking:
REDIS_URL=redis://your-redis-host:6379Popular managed Redis providers:
- Upstash (serverless, free tier available)
- Redis Cloud
- Vercel KV
If REDIS_URL is not set, the bot falls back to in-memory state. This is fine for local development but not suitable for production — state is lost on restart and doesn't work across multiple instances.
morpheus-assistant/
├── app/
│ ├── api/
│ │ ├── webhooks/[platform]/route.ts # Webhook handler for all platforms
│ │ └── discord/gateway/route.ts # Discord gateway (serverless)
│ ├── layout.tsx # Root layout
│ └── page.tsx # Landing page
├── lib/
│ ├── morpheus.ts # Morpheus AI provider config
│ ├── bot.tsx # Chat SDK instance & adapters
│ └── handlers.tsx # Event handlers (mentions, commands, etc.)
├── .env.example # Environment variable template
├── slack-manifest.yml # Slack app manifest
├── vercel.json # Vercel config (Discord cron)
├── next.config.ts # Next.js config
├── tsconfig.json # TypeScript config
└── package.json # Dependencies
- Webhook Events — Each platform sends events (mentions, messages, reactions) to
/api/webhooks/{platform} - Event Routing — the Chat SDK normalizes events and routes them to your handlers
- AI Processing — Handlers stream requests to the Morpheus API Gateway via the Vercel AI SDK
- Response Delivery — Responses stream back to the originating platform in real-time
| Event | Trigger | Behavior |
|---|---|---|
onNewMention |
Bot @-mentioned | Subscribe to thread, stream AI response |
onSubscribedMessage |
Message in subscribed thread | Stream AI response with conversation history |
/ask <question> |
Slash command | Stream a one-off AI response |
/morpheus help |
Slash command | Show help card with available commands |
/morpheus models |
Slash command | List available AI models |
/morpheus about |
Slash command | Show information about Morpheus |
npm run dev # Start dev server
npm run build # Production build
npm run start # Start production server
npm run lint # Run linterUse ngrok to expose your local server:
ngrok http 3000Then update your platform webhook URLs to use the ngrok URL (e.g., https://abc123.ngrok.io/api/webhooks/slack).
Contributions are welcome! Please see the Contributing Guidelines for details.
This project is licensed under the MIT License — see the LICENSE file for details.
- Morpheus Network — Decentralized AI infrastructure
- Morpheus API Docs — API Gateway documentation
- Chat SDK Docs — Vercel Chat SDK documentation
- Vercel AI SDK — AI SDK for TypeScript