Skip to main content
Glama
xpqz
by xpqz

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

Related MCP server: Axon.MCP.Server

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

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 embeddings

  • aplcart_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 syntax

    Example: lookup-syntax "⍳10"
  • search - Substring search across syntax, description, and keywords

    Example: search "matrix" limit=10
  • keywords-for - Get keywords for a specific syntax

    Example: keywords-for "∘.≤⍨∘⍳"
  • semantic-search - Natural language search using embeddings

    Example: 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, or q to exit (or Ctrl+D or Ctrl+C)

Configuration

Environment Variables

  • OPENAI_API_KEY - Required for semantic search functionality

  • APLCART_USE_DB - Set to 1, true, or yes to 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.

Available Tools

4 tools
keywords-forC

Return the keyword list for the given syntax.

ParametersJSON Schema
NameRequiredDescriptionDefault
syntaxYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool returns a list but doesn't describe format, size limits, error handling, or performance traits (e.g., rate limits, caching). The description is minimal and lacks essential behavioral context for effective use.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without redundancy. It's appropriately sized for a simple tool and front-loaded with the core action. There's no wasted verbiage, making it highly concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter) and the presence of an output schema (which handles return values), the description is minimally adequate. However, it lacks details on behavioral traits and parameter meaning, which are needed for full contextual understanding despite the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, so the schema provides no semantic details. The description adds that the parameter is a 'syntax' but doesn't explain what constitutes valid syntax (e.g., programming language names, file formats, query types). This partial compensation is insufficient given the low schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'returns the keyword list for the given syntax', which provides a basic verb+resource relationship. However, it's vague about what 'keyword list' means (e.g., programming keywords, search terms, metadata tags) and doesn't distinguish from siblings like 'lookup-syntax' or 'search'. The purpose is understandable but lacks specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'lookup-syntax' or 'search'. The description implies usage when a syntax is known and keywords are needed, but it doesn't specify contexts, prerequisites, or exclusions. This leaves the agent with minimal direction for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

lookup-syntaxB

Return the record whose syntax exactly matches the input.

ParametersJSON Schema
NameRequiredDescriptionDefault
syntaxYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool returns a record based on exact syntax matching, but doesn't describe what happens if no match is found (e.g., returns null, error), whether it's case-sensitive, performance characteristics, or authentication requirements. For a lookup tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's front-loaded with the core purpose and uses backticks to highlight the parameter name. Every element earns its place by conveying essential information about the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which handles return values), one simple parameter, and no annotations, the description is minimally complete. It explains what the tool does but lacks behavioral details and usage guidance. For a lookup tool with output schema support, this is adequate but leaves the agent to infer important operational aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains that the 'syntax' parameter is used for exact matching, which adds meaning beyond the schema's basic type definition. However, it doesn't provide examples of valid syntax values, format requirements, or constraints. With one undocumented parameter, the description adds some but incomplete semantic context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Return') and resource ('record') with a specific matching condition ('whose `syntax` exactly matches the input'). It distinguishes from sibling tools like 'search' and 'semantic-search' by emphasizing exact matching rather than broader searching. However, it doesn't explicitly contrast with 'keywords-for', leaving some sibling differentiation incomplete.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'search' or 'semantic-search'. It mentions the exact matching condition, but doesn't explain scenarios where this is preferred over other tools or any prerequisites for usage. The agent must infer usage context from the tool name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.1.0
    • First observedkeywords-for
    • First observedlookup-syntax
    • First observedsearch
    • First observedsemantic-search

TDQS

B3.3/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: keywords-for retrieves keyword lists for a syntax, lookup-syntax finds exact matches, search performs substring matching, and semantic-search handles natural language queries. There is no overlap in functionality, making tool selection straightforward for an agent.

Naming Consistency3/5

The naming is mixed with hyphenated patterns (keywords-for, lookup-syntax) and single words (search, semantic-search). While readable, it lacks a consistent verb_noun convention, as keywords-for and lookup-syntax use hyphens and different verb styles, whereas search and semantic-search are more descriptive but not uniformly structured.

Tool Count5/5

With 4 tools, the server is well-scoped for its apparent purpose of syntax and keyword lookup. Each tool serves a specific function in the domain, and the count is neither too sparse nor excessive, fitting typical expectations for a focused utility server.

Completeness4/5

The toolset covers core search and lookup operations effectively, including exact matching, substring search, and semantic search. A minor gap might be the lack of update or management tools if the domain includes mutable data, but for a query-focused server, the coverage is nearly complete.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that provides semantic search capabilities by integrating with an OpenSearch-based search service. It enables users to perform complex document searches across multiple indices with support for advanced filtering and robust error handling.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    An MCP server that transforms codebases into intelligent, queryable knowledge bases, enabling AI assistants to perform semantic search, explore architecture, and analyze code relationships.
    167
    -
  • A
    license
    A
    quality
    F
    maintenance
    MCP server for semantic code search that indexes your codebase and allows AI editors to search using natural language queries.
    9
    7 npm
    53
    MIT