gpkg-mcp

gpkg-mcp

A knowledge graph MCP server for Moleculer and Go microservice projects that scans codebases, extracts service metadata, seeds Neo4j, and exposes tools for LLM clients to query and understand service architecture.

Category
Visit Server

README

gpkg-mcp

Standalone knowledge graph MCP server for Moleculer/Go microservice projects. Scans a project directory, extracts service metadata (actions, commands, queries, routes, events, dependencies), seeds Neo4j, and exposes everything via a Python MCP server that any LLM client (Claude Desktop, Cursor, the gp-langchain bot) can call.


What it does

  • Scans TypeScript/JavaScript Moleculer services (layered, CQRS, gateway) and Go services
  • Extracts per-action metadata: handler type, params validator, ctx.call dependencies (regex + variable resolution)
  • Seeds Neo4j knowledge graph and writes per-service markdown docs
  • Serves a FastMCP server over Streamable HTTP or stdio
  • Caches scan fingerprints with a schema_version so improved extractors always trigger a re-scan

Quick start (with sample data)

# One-shot bootstrap: checks prereqs, seeds sample services, starts MCP
./start.sh

The script: checks uv + Neo4j, runs uv sync, seeds sample/ data into Neo4j, then starts the server on http://localhost:8000/mcp.


Manual setup

cp .env.sample .env
# edit .env — set GPKG_NEO4J_URI / GPKG_NEO4J_PASSWORD at minimum

uv sync

# Scan a project
uv run gpkg scan ../my-project

# Query the knowledge graph
uv run gpkg query "payment transfer"

# Start the MCP server
uv run gpkg serve

Commands

Command Description
gpkg scan <dir> Scan all services under <dir>, seed Neo4j, write markdown KB
gpkg scan <dir> --use-llm Enable LLM validation for low-confidence architecture detections
gpkg scan <dir> --force Bypass fingerprint cache, rescan everything
gpkg scan <dir> --concurrency N Set parallel scan concurrency (default: 5)
gpkg query "<text>" Full-text query against the seeded KG
gpkg query "<text>" --service NAME Filter results to one service
gpkg serve Start MCP server (streamable-http on port 8000)
gpkg serve --transport stdio Start for Claude Desktop / Cursor local use

MCP tools

Tool Description
scan_project(project_dir, use_llm, force) Scan all services; returns {scanned, seeded, skipped, failed, services}
scan_service(project_dir, service_path, use_llm) Scan a single service; returns EnhancedServiceScanResult
query_knowledge_graph(query, service_name?) Full-text search; returns {services, actions, relationships}
get_service(service_name) Full stored knowledge for one service
list_services() All known services with arch type + confidence

Resource: kb://{service_name} — the generated markdown doc for a service.


Configuration

Copy .env.sample to .env:

Variable Default Description
GPKG_NEO4J_URI bolt://localhost:7687 Neo4j bolt URI
GPKG_NEO4J_USER neo4j Neo4j username
GPKG_NEO4J_PASSWORD (empty) Neo4j password
GPKG_KB_DIR ./knowledge_base Markdown KB output directory
GPKG_SCAN_CONCURRENCY 5 Parallel scan workers
GPKG_LLM_ENABLED false Enable LLM validation pass
GPKG_LLM_MODEL claude-haiku-4-5-20251001 Model for architecture validation
GPKG_LLM_CONFIDENCE_THRESHOLD 0.7 Only run LLM when confidence is below this
GPKG_API_KEY (empty) Bearer token for MCP server (empty = unauthenticated)
ANTHROPIC_API_KEY (empty) Required when GPKG_LLM_ENABLED=true

Docker

# Build
docker build -t gpkg-mcp .

# Run with a local .env and data volume
docker run --env-file .env -p 8000:8000 -v $(pwd)/knowledge_base:/data/knowledge_base gpkg-mcp

# Scan a project (mount it read-only)
docker run --env-file .env \
  -v $(pwd)/knowledge_base:/data/knowledge_base \
  -v /path/to/my-project:/project:ro \
  gpkg-mcp uv run gpkg scan /project

Architecture detection

Type Detection signal
layered-moleculer actions: block with inline handlers in start.ts or *.service.ts
cqrs-moleculer CQRSContainer, CommandBus, QueryBus keywords
gateway-moleculer integrate-services/ directory with RestRoute() definitions
golang-moleculer go-moleculer in go.mod + Publisher pattern
discrete-golang-moleculer go-moleculer in go.mod, no Publisher
external-api-service No Moleculer; Express / Gin / Echo / Fiber

Confidence levels: highmediumlow. LLM validation runs when confidence is below GPKG_LLM_CONFIDENCE_THRESHOLD.


Cache schema version

knowledge/cache.py has a CACHE_SCHEMA_VERSION constant (currently 4). Bump it whenever an extractor changes — the next scan will ignore all cached fingerprints and re-scan everything.


Running tests

uv run pytest

Tests cover: LayeredMoleculerExtractor action/handler/call extraction, cache schema version invalidation, and MCP tool shapes (mocked store, no Neo4j needed).

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured