Twist AI MCP Server
Enables AI agents to access and interact with a Twist workspace, managing threads, conversations, inbox, and more through natural language.
README
Twist AI and MCP SDK
Library for connecting AI agents to Twist. Includes tools that can be integrated into LLMs, enabling them to access and interact with a Twist workspace on the user's behalf.
These tools can be used both through an MCP server, or imported directly in other projects to integrate them to your own AI conversational interfaces.
Using tools
1. Add this repository as a dependency
npm install @doist/twist-ai
2. Import the tools and plug them to an AI
Here's an example using Vercel's AI SDK.
import { fetchInbox, reply, markDone } from '@doist/twist-ai'
import { streamText } from 'ai'
const result = streamText({
model: yourModel,
system: 'You are a helpful Twist assistant',
tools: {
fetchInbox,
reply,
markDone,
},
})
Using as an MCP server
Quick Start
You can run the MCP server directly with npx:
npx @doist/twist-ai
Setup Guide
Claude Desktop
Add to your Claude Desktop configuration file (claude_desktop_config.json):
{
"mcpServers": {
"twist": {
"command": "npx",
"args": ["-y", "@doist/twist-ai"],
"env": {
"TWIST_API_KEY": "your-twist-api-key-here"
}
}
}
}
Cursor
Create a configuration file:
- Global:
~/.cursor/mcp.json - Project-specific:
.cursor/mcp.json
{
"mcpServers": {
"twist": {
"command": "npx",
"args": ["-y", "@doist/twist-ai"],
"env": {
"TWIST_API_KEY": "your-twist-api-key-here"
}
}
}
}
Then enable the server in Cursor settings if prompted.
Claude Code (CLI)
claude mcp add twist npx @doist/twist-ai
Then set your API key:
export TWIST_API_KEY=your-twist-api-key-here
Visual Studio Code
- Open Command Palette → MCP: Add Server
- Configure the server:
{
"servers": {
"twist": {
"command": "npx",
"args": ["-y", "@doist/twist-ai"],
"env": {
"TWIST_API_KEY": "your-twist-api-key-here"
}
}
}
}
Getting your Twist API Key
- Visit https://twist.com/app_console
- Create a new integration or use an existing one
- Copy your API key
- Add it to your MCP configuration as shown above
Features
A key feature of this project is that tools can be reused, and are not written specifically for use in an MCP server. They can be hooked up as tools to other conversational AI interfaces (e.g. Vercel's AI SDK).
This project is in its early stages. Expect more and/or better tools soon.
Nevertheless, our goal is to provide a small set of tools that enable complete workflows, rather than just atomic actions, striking a balance between flexibility and efficiency for LLMs.
Available Tools
- userInfo - Get information about the current user and their workspaces
- fetchInbox - Fetch threads and conversations from the inbox
- loadThread - Load a specific thread with its comments
- loadConversation - Load a specific conversation with its messages
- searchContent - Search across a workspace for threads, comments, and messages
- createThread - Create a new thread in a channel. Accepts an optional
displayInInboxboolean (defaultfalse). Whentrue, the thread is unarchived after creation so it appears in the author's Inbox. See also TWIST_CREATE_THREAD_DISPLAY_IN_INBOX. - reply - Reply to threads or conversations
- react - Add reactions to threads, comments, conversations, or messages
- markDone - Mark threads or conversations as done (read and/or archived)
- buildLink - Build URLs to Twist resources
For more details on each tool, see the src/tools directory.
Environment Variables
| Variable | Default | Description |
|---|---|---|
TWIST_API_KEY |
(required) | Your Twist API key. |
TWIST_CREATE_THREAD_DISPLAY_IN_INBOX |
false |
Set to true to unarchive every newly-created thread so it appears in the author's Inbox, without needing to pass displayInInbox: true on each call. Only takes effect when running the MCP locally. The remote/hosted MCP does not have this variable set and will use the per-call displayInInbox parameter only. |
Dependencies
- MCP server using the official @modelcontextprotocol/sdk
- Twist TypeScript SDK @doist/twist-sdk
Local Development Setup
Prerequisites
- Node.js 18 or higher
- npm
- A Twist account with API access
Setup
- Clone the repository:
git clone https://github.com/doist/twist-ai.git
cd twist-ai
- Install dependencies:
npm install
- Create a
.envfile with your Twist API key:
TWIST_API_KEY=your-twist-api-key-here
- Build the project:
npm run build
Development Commands
npm start- Build and run the MCP inspector for testingnpm run dev- Development mode with auto-rebuild and restartnpm test- Run all testsnpm run type-check- Run TypeScript type checkingnpm run format:check- Run linting and formatting checksnpm run format:fix- Auto-fix linting and formatting issues
Contributing
Contributions are welcome! Please ensure:
- All tests pass (
npm test) - Code is properly typed (
npm run type-check) - Code passes linting and formatting checks (
npm run format:check)
Use Conventional Commits for commit messages:
feat:for new featuresfix:for bug fixesdocs:for documentation changestest:for test changeschore:for maintenance tasks
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.