Skip to content

feat: 🌱 create memex mcp server#14

Merged
Jonasb8 merged 1 commit intomasterfrom
feat/create-memex-mcp-server
Apr 10, 2026
Merged

feat: 🌱 create memex mcp server#14
Jonasb8 merged 1 commit intomasterfrom
feat/create-memex-mcp-server

Conversation

@Jonasb8
Copy link
Copy Markdown
Owner

@Jonasb8 Jonasb8 commented Apr 10, 2026

feat: MCP server for AI agent integration

What

Adds an MCP server (memex serve) that exposes the local knowledge index as three callable tools for AI coding agents (Claude Code, Cursor, Copilot, Windsurf).

Why

The CLI already works for humans. MCP makes memex work for agents β€” tools are auto-discovered and called without any prompting. Agents that can't run arbitrary bash (Cursor, Copilot) are supported. Being listed in MCP registries early matters more than being listed complete.

Tools exposed

Tool Description
memex_query(question, top, min_score) Semantic search over indexed decisions. Default min_score is 0.5 (vs 0.7 in the CLI) β€” agents see borderline matches with confidence score surfaced so they can hedge
memex_get_decision(id) Fetch full markdown for a specific record by file path or title slug
memex_list_recent(domain, limit) Browse recent decisions, optionally filtered by domain keyword ("auth", "database", …)

Technical approach

  • Uses mcp.server.fastmcp.FastMCP from the official mcp SDK β€” no third-party dependency
  • stdio transport β€” no network port, no persistent process; launched as a subprocess by the editor
  • All three tools reuse existing functions from cli.py (load_index, embed, cosine_similarity) with zero duplication
  • Server is launchable via memex serve CLI command or directly as python -m memex.mcp_server

Changes

  • memex/mcp_server.py β€” new, 160 lines
  • memex/cli.py β€” memex serve command added
  • pyproject.toml β€” mcp>=1.0.0 dependency added
  • .gitignore β€” .mcp.json added (machine-specific, not committed)
  • README.md β€” MCP server section with setup instructions
  • CLAUDE.md β€” doc sync (file structure, tech stack, CLI reference, doc sync rules)
  • tests/test_mcp_server.py β€” 15 tests, all passing; all 239 suite tests green

Setup (for reviewers)

Create .mcp.json in the repo root (git-ignored):
```json
{
"mcpServers": {
"memex": {
"command": "/path/to/python3.12+",
"args": ["-m", "memex.mcp_server"],
"cwd": "/path/to/repo"
}
}
}
```

Run memex index first, then reload your editor.

@Jonasb8 Jonasb8 merged commit d23f1b0 into master Apr 10, 2026
1 check passed
github-actions Bot pushed a commit that referenced this pull request Apr 10, 2026
Jonasb8 pushed a commit that referenced this pull request Apr 17, 2026
Jonasb8 added a commit that referenced this pull request Apr 17, 2026
memex: capture decision from PR #14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant