bytebool/n8n-ai-agent-mcp-server
3.2
If you are the rightful owner of n8n-ai-agent-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The N8N AI Agent MCP Server is a secure and scalable server designed for integrating N8N AI Agent with MongoDB and Context7 tools, leveraging Cloudflare Workers for global deployment.
Tools
mongodb-find
Query collections with filters and options.
mongodb-aggregate
Run aggregation pipelines.
mongodb-list-databases
List available databases.
context7-search
Search technical documentation.
get-request-stats
Get server request statistics.
N8N AI Agent MCP Server
A secure Cloudflare Workers MCP server for N8N AI Agent integration with MongoDB and Context7 tools.
Features
- MongoDB Tools: Query databases, run aggregations, and list collections
- Context7 Integration: Search technical documentation and knowledge bases
- Secure Authentication: API key validation with MongoDB credential storage
- Cloudflare Workers: Deployed on Cloudflare's global edge network
- Durable Objects: Stateful session management
- Rate Limiting: Built-in request throttling and security features
Quick Start
1. Prerequisites
- Node.js 18+
- Cloudflare account with Workers enabled
- MongoDB Data API credentials
- Context7 API key (optional)
2. Installation
git clone <repository-url>
cd MCPServerCode
npm install
3. Configuration
Set up your environment variables using Wrangler:
# Required MongoDB credentials
npx wrangler secret put MONGODB_DATA_API_KEY
npx wrangler secret put MONGODB_APP_ID
# Optional configurations
npx wrangler secret put MONGODB_DATA_SOURCE # default: bytebool-server-cluster
npx wrangler secret put MONGODB_DATABASE # default: claude_learning
# Optional Context7 integration
npx wrangler secret put CONTEXT7_API_KEY
# Optional authentication
npx wrangler secret put VALID_API_KEYS # comma-separated API keys
4. Create KV Namespace
npx wrangler kv:namespace create "MCP_SECURITY"
# Update wrangler.toml with the returned namespace ID
5. Deploy
npx wrangler deploy
Available Tools
MongoDB Tools
mongodb-find
- Query collections with filters and optionsmongodb-aggregate
- Run aggregation pipelinesmongodb-list-databases
- List available databases
Context7 Tools
context7-search
- Search technical documentationcontext7-get-docs
- Get comprehensive library documentation
Utility Tools
get-request-stats
- Get server request statistics
N8N Integration
Configure your N8N MCP Client Tool node:
{
"serverUrl": "https://your-worker.your-subdomain.workers.dev/sse",
"apiKey": "your-api-key-here",
"tools": [
"mongodb-find",
"mongodb-aggregate",
"mongodb-list-databases",
"context7-search",
"get-request-stats"
]
}
Local Development
- Create a
.dev.vars
file:
MONGODB_DATA_API_KEY=your-mongodb-data-api-key
MONGODB_APP_ID=your-mongodb-app-id
CONTEXT7_API_KEY=your-context7-api-key
VALID_API_KEYS=dev-key-1,dev-key-2
- Start the development server:
npx wrangler dev
- Test with MCP Inspector:
npx @modelcontextprotocol/inspector@latest
Security Features
- API Key Authentication: Validates requests against configured API keys
- MongoDB Credential Storage: Encrypted credential validation
- Rate Limiting: Configurable request throttling
- IP Whitelisting: Optional IP address filtering
- Request Logging: Security event tracking
Environment Variables
Variable | Required | Description |
---|---|---|
MONGODB_DATA_API_KEY | Yes | MongoDB Data API key |
MONGODB_APP_ID | Yes | MongoDB App ID for Data API |
MONGODB_DATA_SOURCE | No | Data source name (default: bytebool-server-cluster) |
MONGODB_DATABASE | No | Database name (default: claude_learning) |
CONTEXT7_API_KEY | No | Context7 API key for documentation search |
VALID_API_KEYS | No | Comma-separated list of valid API keys |
IP_WHITELIST | No | Comma-separated list of allowed IPs |
RATE_LIMIT_PER_MINUTE | No | Max requests per minute per IP |
Architecture
- Cloudflare Workers: Serverless edge computing platform
- Durable Objects: Stateful session management with SQLite
- KV Storage: Distributed key-value store for caching
- MongoDB Data API: Database operations
- Context7: Knowledge base integration
Testing
# Run all tests
npm test
# Test specific functionality
npm test -- --grep "authentication"
# Watch mode
npm test -- --watch
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
MIT