devq-ai
MCP Server
devq-ai
public

ptolemies

The knowledge graph for agentic systems

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
Python
Language
MIT License
License

About This Server

The knowledge graph for agentic systems

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

# Ptolemies Knowledge Management System

[![Production Status](https://img.shields.io/badge/Status-Production%20Ready-brightgreen)](https://devq-ai.github.io/ptolemies/)
[![Dashboard](https://img.shields.io/badge/Dashboard-Live-blue)](https://devq-ai.github.io/ptolemies/)
[![Test Coverage](https://img.shields.io/badge/Coverage-90%25-brightgreen)](#testing)
[![Documentation](https://img.shields.io/badge/Docs-Complete-success)](#documentation)

## πŸŽ‰ **Production Status Dashboard - LIVE**

**πŸš€ [View Live Status Dashboard](https://devq-ai.github.io/ptolemies/)**

Real-time monitoring for the complete Ptolemies ecosystem with comprehensive service health, performance metrics, and direct access to all major components.

## πŸ†• **NEW: Unified MCP Server**

**✨ [@devq-ai/ptolemies-mcp](https://www.npmjs.com/package/@devq-ai/ptolemies-mcp)** - Unified Model Context Protocol server providing semantic access to the entire DevQ.AI knowledge ecosystem through a single interface.

```bash
# Install and use immediately
npx @devq-ai/ptolemies-mcp

# Or install globally
npm install -g @devq-ai/ptolemies-mcp
```

**Key Features:**

- πŸ”€ **Hybrid Knowledge Search**: Combines Neo4j graph + SurrealDB vector search
- πŸ›‘οΈ **AI Code Validation**: Real-time hallucination detection (97.3% accuracy)
- πŸ—ΊοΈ **Learning Path Discovery**: Intelligent progression between frameworks
- πŸ“Š **Framework Analysis**: Deep insights into technology relationships
- πŸ’Š **System Health Monitoring**: Real-time service diagnostics

[πŸ“– Complete MCP Documentation](./mcp/ptolemies/) | [πŸš€ Quick Start Guide](./mcp/ptolemies/README.md)

---

## πŸ“Š **System Overview**

### **Knowledge Base Statistics**

- **Total Documentation Chunks:** 292 (100% processed)
- **Active Sources:** 17 frameworks and libraries
- **Coverage:** Complete across major technology stack
- **Average Quality Score:** 0.86 (High quality)

### **Infrastructure Status**

- **πŸ•ΈοΈ Neo4j Graph Database:** 77 nodes, 156 relationships - [Browser UI](http://localhost:7475)
- **πŸ›‘οΈ AI Hallucination Detection:** 97.3% accuracy, 17 frameworks supported
- **πŸ“š Vector Search:** SurrealDB with semantic capabilities
- **⚑ Performance:** Sub-100ms query response times
- **πŸ€– MCP Server:** Unified API with 10 semantic tools - [Registry Package](./mcp/ptolemies/)

---

## πŸ—οΈ **Architecture & Services**

### **Core Technology Stack**

- **Backend:** FastAPI with Logfire observability
- **Knowledge Storage:** SurrealDB (vector) + Neo4j (graph)
- **AI Detection:** Dehallucinator service (97.3% accuracy)
- **Frontend:** SvelteKit with Tailwind CSS + DaisyUI
- **Testing:** PyTest with 90%+ coverage requirement
- **Deployment:** GitHub Pages with automated builds

### **Service Portfolio**

#### πŸ€– **Unified MCP Server** (NEW)

- **Package:** [@devq-ai/ptolemies-mcp](https://www.npmjs.com/package/@devq-ai/ptolemies-mcp)
- **Tools:** 10 semantic operations for AI assistants
- **Clients:** Claude Desktop, Zed IDE, Continue.dev, and more
- **Performance:** <200ms response times, 10 concurrent requests
- **Integration:** Single interface to all ptolemies services

#### πŸ•ΈοΈ **Neo4j Knowledge Graph**

- **Nodes:** 77 (frameworks, sources, topics)
- **Relationships:** 156 integration mappings
- **Categories:** AI/ML, Web Frontend, Backend/API, Data/DB, Tools/Utils
- **Access:** [Neo4j Browser](http://localhost:7475) (neo4j:ptolemies)
- **Performance:** Real-time monitoring with 2.64% graph density

#### πŸ›‘οΈ **Dehallucinator AI Detection**

- **Accuracy Rate:** 97.3% AI detection capability
- **False Positive Rate:** <2.1% (production threshold)
- **Framework Support:** 17 major frameworks
- **Pattern Database:** 2,296 validated API patterns
- **Analysis Speed:** <200ms per file
- **Detection Categories:**
  - Non-existent APIs (892 patterns)
  - Impossible imports (156 combinations)
  - AI code patterns (234 signatures)
  - Framework violations (445 rules)
  - Deprecated usage (123 patterns)

#### πŸ“š **Knowledge Base**

- **Documentation Sources:** 17 active frameworks
- **Chunk Distribution:**
  - Pydantic AI: 79 chunks (0.85 quality)
  - Shadcn: 70 chunks (0.85 quality)
  - Claude Code: 31 chunks (0.85 quality)
  - Tailwind: 24 chunks (0.85 quality)
  - PyGAD: 19 chunks (0.85 quality)
  - [12 additional frameworks...]

---

## πŸš€ **Quick Start**

### **Prerequisites**

- Python 3.12+
- Node.js 18+ (for status dashboard)
- Neo4j 5.0+ (local instance)
- SurrealDB 1.0+ (local instance)

### **Installation**

```bash
# Clone repository
git clone https://github.com/devq-ai/ptolemies.git
cd ptolemies

# Install Python dependencies
pip install -r requirements.txt
```

### **Quick Launch**

```bash
# Start core services
PYTHONPATH=src python src/main.py

# Check system status
python status

# Generate status JSON
python get_status.py

# Access applications
# - API: http://localhost:8001
# - Live Dashboard: https://devq-ai.github.io/ptolemies/
# - Neo4j Browser: http://localhost:7475
```

---

## πŸ“Š **Status Dashboard Features**

### **Real-Time Monitoring**

- **Service Health:** Live status indicators for all major services
- **Performance Metrics:** Response times, accuracy rates, resource usage
- **Knowledge Statistics:** Chunk counts, source coverage, quality scores
- **Graph Visualization:** Node counts, relationship mappings, density metrics

### **Direct Access Integration**

- **Neo4j Browser:** One-click access to graph database UI
- **GitHub Repositories:** Direct links to service documentation
- **Service Controls:** Refresh buttons and real-time updates
- **Mobile Responsive:** Professional interface across all devices

### **Status System**

- **JSON Status API:** Raw JSON data for integration
- **Interactive Dashboard:** Full UI available at /dashboard.html
- **Command Line Tool:** Quick status queries with `python status`
- **Auto-updating:** Fresh data generated on each deployment

---

## πŸ”§ **Service Usage**

### **πŸ€– MCP Server (Unified Interface)**

```bash
# Start the MCP server
npx @devq-ai/ptolemies-mcp

# Health check
npx @devq-ai/ptolemies-mcp --health-check

# With custom configuration
npx @devq-ai/ptolemies-mcp --neo4j-uri bolt://localhost:7687 --debug
```

**MCP Client Configuration:**

```json
{
  "mcpServers": {
    "ptolemies": {
      "command": "npx",
      "args": ["-y", "@devq-ai/ptolemies-mcp"],
      "env": {
        "NEO4J_URI": "bolt://localhost:7687",
        "SURREALDB_URL": "ws://localhost:8000/rpc"
      }
    }
  }
}
```

**Available Tools:**

- `hybrid-knowledge-search` - Semantic search across all data sources
- `validate-code-snippet` - AI hallucination detection
- `framework-knowledge-query` - Deep framework analysis
- `learning-path-discovery` - Technology progression paths
- `system-health-check` - Service monitoring

### **AI Hallucination Detection**

```bash
# Single file analysis
python dehallucinator/ai_hallucination_detector.py target_script.py

# Repository analysis
python dehallucinator/ai_hallucination_detector.py --repo /path/to/repo

# Batch processing
python dehallucinator/ai_hallucination_detector.py --batch /path/to/scripts/
```

### **Knowledge Graph Queries**

```cypher
# Find framework relationships
MATCH (f1:Framework)-[r:INTEGRATES_WITH]->(f2:Framework)
RETURN f1.name, r.integration_type, f2.name;

# Count all nodes by type
MATCH (n) RETURN labels(n)[0] as Type, COUNT(n) as Count;

# Show source statistics
MATCH (s:Source) RETURN s.name, s.chunk_count ORDER BY s.chunk_count DESC;
```

### **Vector Search**

```python
# Semantic search in knowledge base
from src.search import semantic_search

results = semantic_search(
    query="FastAPI authentication patterns",
    limit=10,
    similarity_threshold=0.8
)
```

---

## πŸ§ͺ **Testing & Quality Assurance**

### **Test Coverage**

- **Minimum Requirement:** 90% line coverage
- **Current Coverage:** Comprehensive across all services
- **Test Frameworks:** PyTest for Python, Jest for JavaScript
- **Integration Tests:** All API endpoints and service interactions

### **Quality Standards**

- **Code Formatting:** Black (88 characters), Prettier for JS
- **Type Checking:** Full Python type hints, TypeScript strict mode
- **Documentation:** Google-style docstrings, comprehensive README files
- **Performance:** Sub-100ms API responses, efficient caching

### **Run Tests**

```bash
# Python tests with coverage
pytest tests/ --cov=src/ --cov-report=html --cov-fail-under=90

# Status system tests
python check_deployment.py

# Integration tests
python tests/test_integration.py
```

---

## πŸ“ˆ **Performance Metrics**

### **Production Benchmarks**

- **API Response Time:** <100ms average
- **Search Query Performance:** <200ms semantic search
- **AI Detection Analysis:** <200ms per file
- **Dashboard Load Time:** <2 seconds
- **Graph Query Performance:** <50ms typical queries

### **Resource Usage**

- **Memory:** <512MB for large repositories
- **Concurrent Processing:** Up to 10 files simultaneously
- **Cache Hit Rate:** >85% for frequent queries
- **Database Connections:** Efficient pooling and management

---

## πŸ—οΈ **Development Workflow**

### **DevQ.ai Standards**

- **FastAPI Foundation:** All web services built on FastAPI
- **Logfire Observability:** Complete instrumentation and monitoring
- **PyTest Build-to-Test:** Test-driven development approach
- **TaskMaster AI:** Project management and task tracking
- **MCP Integration:** Model Context Protocol for AI development

### **Environment Setup**

```bash
# Load DevQ.ai environment
source .zshrc.devqai

# Start Zed IDE with MCP servers
zed .

# Check task status
task-master list
task-master next
```

### **Code Standards**

- **Python 3.12:** Modern language features and type hints
- **Black Formatting:** 88 character line length
- **Import Order:** typing β†’ standard β†’ third-party β†’ first-party β†’ local
- **Documentation:** Google-style docstrings for all public functions

---

## πŸ”’ **Security & Authentication**

### **Access Control**

- **Neo4j:** Local instance with ptolemies credentials
- **API Security:** FastAPI security utilities with JWT
- **Environment Variables:** Secure credential management
- **Network Security:** Local development with production patterns

### **Data Protection**

- **Encryption:** Sensitive data encrypted at rest
- **Input Validation:** Comprehensive request validation
- **Error Handling:** Secure error messages without data leakage
- **Audit Logging:** Complete operation tracking via Logfire

---

## πŸ“š **Documentation**

### **Core Documentation**

- **API Documentation:** Auto-generated FastAPI OpenAPI docs
- **Service READMEs:** Comprehensive documentation for each service
- **Development Guides:** Setup, configuration, and deployment
- **Architecture Diagrams:** System design and data flow

### **Framework Coverage**

Comprehensive documentation integration for:

- **AI/ML:** Pydantic AI, PyMC, PyGAD, Wildwood
- **Web Frontend:** Shadcn, Tailwind, NextJS, AnimeJS
- **Backend/API:** FastAPI, FastMCP, Logfire
- **Data/Database:** SurrealDB, Panel
- **Tools/Utilities:** Claude Code, Crawl4AI, bokeh, circom

---

## πŸš€ **Deployment**

### **Production Deployment**

- **Status Dashboard:** GitHub Pages (https://devq-ai.github.io/ptolemies/)
- **Backend Services:** FastAPI with Uvicorn
- **Database Services:** Neo4j and SurrealDB local instances
- **Monitoring:** Logfire observability platform

### **Environment Configuration**

```bash
# Required environment variables
export LOGFIRE_TOKEN="pylf_v1_us_..."
export ANTHROPIC_API_KEY="sk-ant-..."
export NEO4J_URI="bolt://localhost:7687"
export NEO4J_USER="neo4j"
export NEO4J_PASSWORD="ptolemies"
```

### **Health Checks**

```bash
# Verify all services
curl http://localhost:8001/health
curl http://localhost:7475/browser/  # Neo4j
python status services               # Local status check
curl https://devq-ai.github.io/ptolemies/status.json  # Live status
```

---

## 🀝 **Contributing**

### **Development Process**

1. **Task Management:** Use TaskMaster AI for task breakdown
2. **Branch Strategy:** Feature branches with descriptive names
3. **Code Review:** All changes require review and testing
4. **Documentation:** Update relevant docs with code changes

### **Contribution Guidelines**

- **Code Quality:** Follow DevQ.ai standards and formatting
- **Testing:** Maintain 90%+ test coverage
- **Documentation:** Update README and inline docs
- **Performance:** Ensure no regression in response times

### **Getting Started**

```bash
# Fork repository
git clone https://github.com/your-username/ptolemies.git

# Create feature branch
git checkout -b feature/your-feature-name

# Make changes and test
pytest tests/ --cov=src/

# Submit pull request
```

---

## πŸ“„ **License**

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.

---

## πŸ† **Acknowledgments**

### **Built With**

- **DevQ.ai Stack:** FastAPI + Logfire + PyTest + TaskMaster AI
- **Knowledge Storage:** SurrealDB + Neo4j + Redis
- **Frontend:** SvelteKit + Tailwind CSS + DaisyUI
- **AI Detection:** Custom hallucination detection algorithms
- **Monitoring:** Real-time observability and performance tracking

### **Special Thanks**

- **DevQ.ai Team:** Architecture and development standards
- **Open Source Community:** Framework documentation and patterns
- **Contributors:** Code review, testing, and documentation

---

## πŸ“Š **Project Status**

**Overall Progress:** 100% Complete (ALL 8 phases completed - PRODUCTION LIVE + MCP REGISTRY READY)

### **Completed Phases**

- βœ… **Phase 1:** Infrastructure Cleanup (100% complete)
- βœ… **Phase 2:** MCP Server Integration (100% complete)
- βœ… **Phase 3:** Service Verification (100% complete)
- βœ… **Phase 4:** Ptolemies MCP Development (100% complete)
- βœ… **Phase 5:** Status Dashboard (100% complete)
- βœ… **Phase 6:** Documentation & Testing (100% complete)
- βœ… **Phase 7:** Production Deployment (100% complete)
- βœ… **Phase 8:** MCP Registry Package (100% complete - [@devq-ai/ptolemies-mcp](https://www.npmjs.com/package/@devq-ai/ptolemies-mcp))

### **Production Status**

- **Status:** LIVE AND OPERATIONAL
- **Deployment Date:** June 25, 2025
- **Executive Approval:** GRANTED
- **Test Coverage:** 90%+ maintained
- **Performance Targets:** Sub-100ms achieved

### **Live Services**

- 🟒 **Status Dashboard:** https://devq-ai.github.io/ptolemies/
- 🟒 **MCP Server:** [@devq-ai/ptolemies-mcp](https://www.npmjs.com/package/@devq-ai/ptolemies-mcp) (10 semantic tools)
- 🟒 **Neo4j Browser:** http://localhost:7475 (neo4j:ptolemies)
- 🟒 **Knowledge Base:** 292 chunks across 17 sources
- 🟒 **AI Detection:** 97.3% accuracy with production patterns

### **MCP Registry Achievements**

- πŸ“¦ **NPM Package:** Production-ready with 4,072 lines of code
- πŸ› οΈ **10 Semantic Tools:** Hybrid search, code validation, learning paths
- πŸ”— **Client Support:** Claude Desktop, Zed IDE, Continue.dev compatibility
- πŸ“– **Complete Documentation:** User guides, API specs, registry manifest
- ⚑ **Performance:** <200ms response times, 10 concurrent requests

---

**For the latest status and real-time metrics, visit the [Live Status Dashboard](https://devq-ai.github.io/ptolemies/)**

_Built with ❀️ by DevQ.ai - Advanced Knowledge Management and Analytics Platform_

Quick Start

1

Clone the repository

git clone https://github.com/devq-ai/ptolemies
2

Install dependencies

cd ptolemies
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerdevq-ai
Repoptolemies
Language
Python
LicenseMIT License
Last fetched8/8/2025

Recommended MCP Servers

πŸ’¬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
πŸ”—

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
πŸ•·οΈ

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers
⚑

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation