Model Context Protocol (MCP) servers are how Almanac connects to external data sources. Whether you're using built-in integrations (Slack, GitHub, Notion) or building your own, this section explains how to create and configure data sources.
An MCP server is a standardized interface that exposes data from any API or service. Think of it as a translator that speaks your API's language and converts it to a format Almanac understands.
Your API → MCP Server → Almanac
Examples:
- Slack MCP Server: Exposes Slack's API (channels, messages, users)
- GitHub MCP Server: Exposes GitHub's API (repos, issues, PRs)
- Custom MCP Server: Your proprietary system, database, or API
Standardization: Write once, works everywhere
- Same protocol for all data sources
- No custom integration code per source
- Works with any MCP-compatible tool (Claude Desktop, Cline, Zed, etc.)
Flexibility: Any data source
- REST APIs
- GraphQL endpoints
- Databases
- File systems
- Custom protocols
Security: Built-in OAuth support
- Standard OAuth 2.0 and 2.1 flows
- Secure credential storage
- Token refresh handling
OAuth 2.0:
- Requires both client ID and client secret to be manually entered
- Client secret must be kept confidential
- Suitable for server-to-server authentication
OAuth 2.1:
- Streamlined authentication flow
- Uses PKCE (Proof Key for Code Exchange) by default
- Does not require client secret for public clients
- Enhanced security for mobile and single-page applications
- Recommended for new implementations
Almanac supports both OAuth 2.0 and 2.1, allowing you to choose the appropriate flow based on your security requirements and application type.
Almanac offers two methods to create indexing configurations:
Let Almanac automatically analyze your MCP server and generate the configuration:
- ✅ Zero Code: Point and click interface
- ✅ Automatic: Discovers tools, classifies them, generates config
- ✅ Validated: Tests config before saving
- ✅ Iterative: Auto-fixes common errors
Best for: Most use cases, especially when starting
Write the configuration file yourself:
- ✅ Full Control: Specify exact behavior
- ✅ Advanced Features: Custom transformations, grouping, relationships
- ✅ Version Control: Track changes in Git
- ✅ Reusable: Share configs across teams
Best for: Complex requirements, advanced users
1. Go to Data Sources page
2. Click "Add Source"
3. Select your MCP server (or add custom)
4. Click "Generate Config"
5. Review and approve
6. Start syncing!
Total time: ~2 minutes
{
"version": "1.0",
"source": "my-api",
"displayName": "My Custom API",
"fetchers": {
"list_items": {
"tool": "list_items",
"outputs": "items",
"recordType": "item"
}
},
"recordTypes": {
"item": {
"fields": {
"title": "$.name",
"content": "$.description",
"sourceId": "$.id",
"primaryDate": "$.created_at"
}
}
}
}Total time: ~10-30 minutes (depending on complexity)
Almanac includes several pre-built MCP servers:
What it indexes:
- Channels
- Messages
- Threads
- Users
OAuth: ✅ Supported
Config: Auto-generated
What it indexes:
- Repositories
- Issues
- Pull Requests
- Commits
- Discussions
OAuth: ✅ Supported
Config: Auto-generated
What it indexes:
- Databases
- Pages
- Blocks
OAuth: ✅ Supported
Config: Auto-generated
What it indexes:
- Website analytics
- Page views
- Events
OAuth: ✅ Supported
Config: Auto-generated
Building a custom MCP server is straightforward:
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
const server = new Server({
name: 'my-api',
version: '1.0.0',
});
// Define a tool
server.tool(
'list_items',
'Get all items',
{
limit: { type: 'number', description: 'Max items to return' },
},
async (args) => {
const items = await fetchFromYourAPI(args.limit);
return { items };
},
);Expose tools via HTTP endpoints:
app.post('/mcp/tools/list_items', async (req, res) => {
const { limit } = req.body;
const items = await fetchFromYourAPI(limit);
res.json({ items });
});Here's the complete flow from MCP server to searchable data:
1. MCP Server Created/Connected
↓
2. Almanac Discovers Tools
- list_channels
- get_messages
- search_users
↓
3. Almanac Classifies Tools
- Read: list_channels, get_messages
- Write: send_message
- Search: search_users
↓
4. Almanac Generates Config
- Creates fetchers
- Maps fields
- Defines record types
↓
5. Almanac Tests Config
- Dry run with sample data
- Auto-fixes errors
- Validates output
↓
6. Config Saved
↓
7. Data Synced
- Fetches records
- Transforms data
- Stores in MongoDB
↓
8. Data Indexed
- Vector embeddings (Qdrant)
- Knowledge graph (Memgraph)
↓
9. Ready to Query! 🎉
Scenario: Index your company's internal tools
// Customer support tickets
server.tool("list_tickets", ...);
server.tool("get_ticket_details", ...);
// Product analytics
server.tool("list_features", ...);
server.tool("get_usage_stats", ...);Scenario: Index PostgreSQL tables
server.tool("query_users", ...);
server.tool("query_orders", ...);
server.tool("query_products", ...);Scenario: Index local documentation
server.tool("list_markdown_files", ...);
server.tool("read_file", ...);Scenario: Index external services
// Zendesk
server.tool("list_zendesk_tickets", ...);
// Jira
server.tool("list_jira_issues", ...);
// Salesforce
server.tool("list_opportunities", ...);✅ DO: Make tools focused and specific
// Good
server.tool("list_open_issues", ...);
server.tool("list_closed_issues", ...);
// Bad
server.tool("list_all_issues_with_filters", ...);✅ DO: Use pagination for large datasets
server.tool("list_items", {
limit: { type: "number" },
offset: { type: "number" },
}, ...);✅ DO: Return structured data
// Good
return {
items: [
{ id: 1, title: 'Item 1', description: '...' },
{ id: 2, title: 'Item 2', description: '...' },
],
};
// Bad
return 'Item 1: description\nItem 2: description';✅ DO: Use OAuth for authentication
✅ DO: Validate all inputs
✅ DO: Rate limit your endpoints
✅ DO: Encrypt sensitive data
❌ DON'T: Store plaintext credentials
❌ DON'T: Expose internal endpoints publicly
❌ DON'T: Return sensitive data in tool responses
Before connecting to Almanac, test your MCP server:
# Call a tool directly
curl http://localhost:3000/mcp/tools/list_items \
-H "Content-Type: application/json" \
-d '{"limit": 10}'Use the official MCP inspector tool:
npx @modelcontextprotocol/inspector my-serverConnect to Almanac in development mode:
# Almanac will show detailed logs
LOG_LEVEL=debug pnpm startIssue: Tools not appearing in Almanac
Solution: Check your server is exposing the tools correctly
- Verify tool definitions
- Check server is running
- Review logs for errors
Issue: Config generation fails
Solution: Ensure tools return sample data
- Add test data to your API
- Verify tool schemas match actual output
- Check for missing required fields
Issue: OAuth connection fails
Solution: Verify OAuth configuration
- Check redirect URI matches
- Ensure client ID/secret are correct
- Verify scopes are requested
- Auto-Configuration Guide - Let Almanac generate configs
- Config Structure - Understand the JSON format
- Creating Servers - Build your own MCP server
- Testing & Validation - Ensure your config works
- MCP Specification - Official protocol docs
- MCP SDK - TypeScript/Python SDKs
- Example Servers - Reference implementations