
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
[](https://devq-ai.github.io/ptolemies/)
[](https://devq-ai.github.io/ptolemies/)
[](#testing)
[](#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/ptolemies2
Install dependencies
cd ptolemies
npm install3
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