A lightweight Model Context Protocol (MCP) server for Answer AI chatflow and document store management
npm install @answerai/answeragent-mcp
A lightweight Model Context Protocol (MCP) server for Answer AI chatflow and document store management. This server exposes Answer AI's powerful features through standardized MCP tools and prompts, allowing you to manage chatflows, document stores, assistants, and more directly from your MCP-compatible AI clients.
Install globally via npm:
``bash`
npm install -g @answerai/answeragent-mcp
Or use with npx (no installation required):
`bash`
npx @answerai/answeragent-mcp
1. Get Your Answer AI Credentials:
- API Base URL (e.g., https://your-instance.studio.theanswer.ai)
- API Token (JWT token from your Answer AI instance)
2. Test the Server:
`bash`
npx @modelcontextprotocol/inspector @answerai/answeragent-mcp
Add this configuration to your ~/.cursor/mcp.json file:
`json`
{
"mcpServers": {
"answerai-mcp": {
"command": "node",
"args": [
"/path/to/your/project/dist/index.js"
],
"env": {
"ANSWERAGENT_AI_API_BASE_URL": "https://your-instance.studio.theanswer.ai",
"ANSWERAGENT_AI_API_TOKEN": "your-jwt-token-here"
}
}
}
}
For NPM installed version:
`json`
{
"mcpServers": {
"answerai-mcp": {
"command": "npx",
"args": ["@answerai/answeragent-mcp"],
"env": {
"ANSWERAGENT_AI_API_BASE_URL": "https://your-instance.studio.theanswer.ai",
"ANSWERAGENT_AI_API_TOKEN": "your-jwt-token-here"
}
}
}
}
Add this to your Claude Desktop MCP settings file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%/Claude/claude_desktop_config.json
Windows:
`json`
{
"mcpServers": {
"answerai": {
"command": "npx",
"args": ["@answerai/answeragent-mcp"],
"env": {
"ANSWERAGENT_AI_API_BASE_URL": "https://your-instance.studio.theanswer.ai",
"ANSWERAGENT_AI_API_TOKEN": "your-jwt-token-here"
}
}
}
}
Most MCP clients follow the same pattern:
`json`
{
"command": "npx",
"args": ["@answerai/answeragent-mcp"],
"env": {
"ANSWERAGENT_AI_API_BASE_URL": "https://your-instance.studio.theanswer.ai",
"ANSWERAGENT_AI_API_TOKEN": "your-jwt-token-here"
}
}
The server requires two environment variables:
- ANSWERAGENT_AI_API_BASE_URL: Your Answer AI instance base URL (without /api/v1)ANSWERAGENT_AI_API_TOKEN
- : Your Answer AI JWT authentication token
Important:
- Don't include /api/v1 in the base URL - the server adds this automatically
- Make sure you're using a JWT token, not an API key
- The token must have appropriate permissions for the operations you want to perform
- Create new chatflows
- get_chatflow - Retrieve chatflow details
- update_chatflow - Update existing chatflows
- delete_chatflow - Remove chatflows
- list_chatflows - List all chatflows$3
- create_document_store - Create document stores
- get_document_store - Get store details
- update_document_store - Update document stores
- delete_document_store - Remove document stores
- list_document_stores - List all stores
- query_vector_store - Query document stores (basic)
- query_vector_store_with_filter - Query with metadata filtering (see below)
- upsert_document - Add/update documents
- refresh_document_store - Refresh store contents#### Metadata Filtering with
query_vector_store_with_filterThis tool allows semantic search with Pinecone metadata filters to narrow down results based on document metadata fields.
Parameters:
-
storeId (required): Document store ID
- query (required): Semantic search query text
- metadataFilter (optional): Pinecone metadata filter objectSupported Filter Operators:
| Operator | Description | Example |
|----------|-------------|---------|
|
$eq | Equal to | {"department": {"$eq": "sales"}} |
| $ne | Not equal to | {"status": {"$ne": "archived"}} |
| $gt | Greater than (numbers) | {"version": {"$gt": 1.0}} |
| $gte | Greater than or equal | {"version": {"$gte": 2.0}} |
| $lt | Less than (numbers) | {"priority": {"$lt": 5}} |
| $lte | Less than or equal | {"priority": {"$lte": 3}} |
| $in | Value in array | {"status": {"$in": ["active", "pending"]}} |
| $nin | Value not in array | {"status": {"$nin": ["deleted", "archived"]}} |
| $or | Any condition matches | {"$or": [{"dept": {"$eq": "sales"}}, {"dept": {"$eq": "marketing"}}]} |
| $and | All conditions match | {"$and": [{"category": {"$eq": "docs"}}, {"version": {"$gte": 2.0}}]} |Example Filters:
`json
// Simple equality
{"department": {"$eq": "engineering"}}// Numeric comparison
{"version": {"$gte": 2.0}}
// Multiple conditions (implicit AND)
{"department": {"$eq": "sales"}, "product": {"$eq": "enterprise"}}
// OR condition
{"$or": [{"department": {"$eq": "sales"}}, {"department": {"$eq": "marketing"}}]}
// IN operator
{"department": {"$in": ["sales", "marketing", "support"]}}
`Important Notes:
- String comparisons are case-sensitive
- Numeric operators require numeric values in metadata (not strings)
- Documents must have metadata fields set during upsert to be filterable
$3
- create_assistant - Create AI assistants
- get_assistant - Get assistant details
- update_assistant - Update assistants
- delete_assistant - Remove assistants
- list_assistants - List all assistants$3
- create_tool - Create custom tools
- get_tool - Get tool details
- update_tool - Update tools
- delete_tool - Remove tools
- list_tools - List all tools$3
- get_loader_chunks - Get document chunks
- update_loader_chunk - Update chunks
- delete_loader_chunk - Remove chunks
- delete_loader - Remove loadersIntelligent Prompts
The server provides AI-powered prompts for advanced analysis and management:
$3
Analyzes chatflow configuration and provides optimization recommendations.Arguments:
-
chatflowId (required): The chatflow ID to analyze
- focusAreas (optional): Array of specific areas to focus on$3
Analyzes document store configuration, loaders, and usage patterns.Arguments:
-
documentStoreId (required): The document store ID to analyze
- focusAreas (optional): Array of specific areas to focus on$3
Provides step-by-step guidance for document store operations.Arguments:
-
action (required): One of "setup", "optimize", "troubleshoot", "migrate"
- documentStoreId (optional): Target document store ID
- context (optional): Additional context for the operationUsage Examples
$3
After configuring in Cursor, you can use natural language commands:
1. List your chatflows:
> "Show me all my Answer AI chatflows"
2. Analyze a specific chatflow:
> "Analyze the 'RDS Call Analysis' chatflow and suggest optimizations"
3. Create a document store:
> "Create a new document store called 'Customer Support KB' for storing help articles"
4. Query documents:
> "Search my 'Contracts' document store for information about payment terms"
5. Query with metadata filter:
> "Search my document store for pricing information, but only from the sales department"
The agent will use
query_vector_store_with_filter with:
`json
{
"storeId": "your-store-id",
"query": "pricing information",
"metadataFilter": {"department": {"$eq": "sales"}}
}
`$3
After adding to your Claude Desktop configuration:
1. Analyze a chatflow:
> "Please analyze my chatflow with ID 'df23d39c-a25b-4842-8997-dce3afed88f4' and focus on performance optimization"
2. Document store management:
> "Help me troubleshoot my document store that's not syncing properly"
3. Assistant management:
> "Show me details about my 'Document Reader' assistant and suggest improvements"
$3
Test and explore the server capabilities:
`bash
npx @modelcontextprotocol/inspector @answerai/answeragent-mcp
`Troubleshooting
$3
1. 401 Unauthorized Error:
- Check that your JWT token is valid and not expired
- Ensure you're using a JWT token, not an API key
- Verify the token has the necessary permissions
2. Connection Issues:
- Confirm your base URL is correct (without
/api/v1`)3. Tool Not Found:
- Restart your MCP client after configuration changes
- Check the server logs for any startup errors
- Verify the package is properly installed
- Node.js 18+
- Valid Answer AI JWT token with appropriate permissions
- MCP-compatible client (Claude Desktop, Cursor, Cline, etc.)
For issues and feature requests, visit our GitHub repository.
ISC