APLCart MCP Server
An MCP server providing access to the APLCart idiom collection with semantic search and syntax matching capabilities. It enables users to find APL expressions and idioms through natural language queries, keyword searches, and exact syntax lookups.
README
APLCart MCP Server
A Model Context Protocol (MCP) server that exposes the APLCart idiom collection with semantic search capabilities. APLCart is a searchable collection of APL expressions with descriptions.
Features
- Find APL expressions by exact syntax match
- Search across syntax, descriptions, and keywords
- Get keywords for specific APL expressions
- Natural language queries using OpenAI embeddings
Installation
Prerequisites
- Python 3.11 or higher
- OpenAI API key (for semantic search functionality)
Using uv
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone the repository
git clone <repository-url>
cd ac-mcp
# Install dependencies
uv sync
Setup
Convert APLCart Data
First, fetch and convert the APLCart TSV data to JSONL format:
# Using uv
uv run python aplcart2json.py
# Or with activated venv
python aplcart2json.py
# Optional: Generate SQLite database for faster searches
python aplcart2json.py --db
Generate Embeddings (Optional; for Semantic Search)
To enable semantic search functionality:
# Set your OpenAI API key
export OPENAI_API_KEY='your-api-key-here'
# Generate embeddings
uv run python generate_embeddings.py
# Or with activated venv
python generate_embeddings.py
This creates:
aplcart.index- FAISS index file containing embeddingsaplcart_metadata.pkl- Metadata for semantic search results
Usage
Running the MCP Server
# Basic usage
uv run python aplcart_mcp_semantic.py
# With SQLite database backend
APLCART_USE_DB=1 uv run python aplcart_mcp_semantic.py
Using with Claude Code
The project includes a .mcp.json.template file that automatically configures the MCP server. Save that as .mcp.json, update it with your details, and run /mcp in Claude Code to see available servers.
You can also manually add the server:
claude mcp add aplcart "uv run python aplcart_mcp_semantic.py"
Using with Claude Desktop
Add this to your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
{
"mcpServers": {
"aplcart": {
"command": "uv",
"args": [
"run",
"--directory",
"YOUR/PATH/HERE/ac-mcp",
"python",
"aplcart_mcp_semantic.py"
],
"env": {
"APLCART_USE_DB": "1",
"OPENAI_API_KEY": "${OPENAI_API_KEY}"
}
}
}
}
Then restart Claude Desktop to load the MCP server.
Available MCP Tools
-
lookup-syntax- Exact match on APL syntaxExample: lookup-syntax "⍳10" -
search- Substring search across syntax, description, and keywordsExample: search "matrix" limit=10 -
keywords-for- Get keywords for a specific syntaxExample: keywords-for "∘.≤⍨∘⍳" -
semantic-search- Natural language search using embeddingsExample: semantic-search "how to split a string on a separator"
Standalone Search Tool
You can also use the semantic search functionality directly:
# Interactive mode
uv run python search_embeddings.py
# Single query
uv run python search_embeddings.py "find the largest number"
# JSON output
uv run python search_embeddings.py "reverse an array" --json
# More results
uv run python search_embeddings.py "matrix operations" -k 10
Interactive mode commands:
- Type your query and press Enter to search
- Type
quit,exit, orqto exit (or Ctrl+D or Ctrl+C)
Configuration
Environment Variables
OPENAI_API_KEY- Required for semantic search functionalityAPLCART_USE_DB- Set to1,true, oryesto use SQLite database backend
File Structure
ac-mcp/
├── aplcart.jsonl # Converted APLCart data (run aplcart2json.py to generate)
├── aplcart.db # SQLite database (optional)
├── aplcart.index # FAISS embeddings index (run generate_embeddings.py to generate)
├── aplcart_metadata.pkl # Metadata for semantic search (run generate_embeddings.py to generate)
├── aplcart2json.py # Converter script
├── generate_embeddings.py # Embedding generator
├── aplcart_mcp_semantic.py # MCP server with semantic search
├── search_embeddings.py # Standalone search tool
└── pyproject.toml # Project dependencies
About APLCart
APLCart is a searchable collection of APL idioms and expressions maintained at https://aplcart.info/
License
This project is licensed under the MIT License - see the LICENSE file for details.
Note: The APLCart data itself is subject to its own licensing terms.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。