Skip to main content

Complete entity graph MCP server with smart relationships

Project description

Directory MCP

A comprehensive Model Context Protocol (MCP) server for managing people, companies, channels, and projects with rich relationships and intelligent entity resolution powered by Google Gemini embeddings.

PyPI Version Python Versions License: MIT

๐ŸŒŸ Features

  • ๐Ÿง  Intelligent Entity Resolution: Gemini embeddings understand natural queries like "John from TechCorp" or "backend team Discord"
  • ๐Ÿ”— Rich Relationship Management: Track who works where, project assignments, channel memberships with roles
  • ๐ŸŽฏ Powerful Search: Multi-criteria filtering, fuzzy matching, and semantic search
  • ๐Ÿ“Š Network Analysis: Visualize connections, find colleagues, discover team relationships
  • ๐Ÿš€ Zero Setup: SQLite database with automatic initialization
  • ๐Ÿ”„ Auto Updates: Always get the latest version with automated configuration updates
  • โšก Fast Performance: <200ms response times, efficient caching, optimized queries

๐Ÿ“ฆ Installation

Quick Start with Claude Code

# Install and configure in one command
claude mcp add directory \
  --type stdio \
  --command uvx \
  --args directory-mcp \
  --env GEMINI_API_KEY=your-key-here

# Get your free Gemini API key at:
# https://makersuite.google.com/app/apikey

Manual Installation

# Install via pip
pip install directory-mcp

# Or run directly with uvx (recommended)
uvx directory-mcp

# Configure environment
export GEMINI_API_KEY="your-api-key-here"

๐Ÿš€ Quick Start Examples

Creating Entities

"Create Alice Johnson as Senior Engineer at TechCorp, email alice@techcorp.com"
"Add a new company called StartupAI in San Francisco, 50-100 employees"
"Create a project called 'AI Research Initiative' starting January 2025"
"Add a Slack channel #ai-research for the AI team"

Finding People

"Find all Python developers in San Francisco"
"Who works at TechCorp?"
"Search for data scientists with machine learning skills"
"Find people named Sarah"

Managing Relationships

"Add Alice to the AI Research Initiative project as lead"
"Link John Doe to TechCorp as Software Engineer"
"Add Sarah to the #ai-research channel as moderator"
"Show Alice's network connections"

Network Analysis

"Show me John's complete professional network"
"How are Alice and Bob connected?"
"Who are all the people working on AI projects?"
"Get company overview for TechCorp"

๐Ÿ› ๏ธ MCP Tools Reference

System Tools

  • get_directory_status - Check server health and statistics

Entity Creation

  • create_person - Add new person with details (name, email, skills, location, etc.)
  • create_company - Add new company (name, domain, industry, size, etc.)
  • create_project - Add new project (name, description, status, dates)
  • create_channel - Add communication channel (Slack, Discord, Teams, etc.)

Entity Retrieval

  • get_person_details - Get comprehensive person information
  • get_company_overview - Get company details with people, projects, and channels

Search & Discovery

  • search_people - Full-text search across all person data
  • find_people_by_criteria - Filter by company, skills, location, title

Relationship Management

  • link_person_to_company - Employment relationships with roles
  • assign_person_to_project - Project assignments with allocation
  • add_person_to_channel - Channel membership with roles

Network Analysis

  • get_person_network - Visualize all connections for a person

๐Ÿ—๏ธ Architecture

Directory MCP uses a modular architecture optimized for maintainability:

src/directory_mcp/
โ”œโ”€โ”€ server.py           # Main MCP server (88 lines)
โ”œโ”€โ”€ database/           # Database layer
โ”‚   โ”œโ”€โ”€ manager.py      # Core database operations
โ”‚   โ””โ”€โ”€ schema.sql      # SQLite schema with FTS5
โ”œโ”€โ”€ tools/              # MCP tool implementations
โ”‚   โ”œโ”€โ”€ system.py       # System status tools
โ”‚   โ”œโ”€โ”€ entities/       # CRUD operations per entity
โ”‚   โ”œโ”€โ”€ search.py       # Search and discovery
โ”‚   โ”œโ”€โ”€ relationships.py # Entity linking
โ”‚   โ””โ”€โ”€ analysis.py     # Network analysis
โ””โ”€โ”€ utils/              # Shared utilities
    โ”œโ”€โ”€ embedder.py     # Gemini embedding generation
    โ”œโ”€โ”€ resolver.py     # Entity resolution logic
    โ””โ”€โ”€ serialization.py # JSON serialization helpers

๐Ÿ”ง Configuration

Environment Variables

  • GEMINI_API_KEY - Required. Your Google Gemini API key
  • GEMINI_MODEL - Optional. Default: gemini-1.5-flash-latest
  • GEMINI_EMBEDDING_MODEL - Optional. Default: text-embedding-004
  • DATABASE_PATH - Optional. Default: ~/.config/directory-mcp/directory.db

Database Location

The SQLite database is automatically created at:

  • macOS/Linux: ~/.config/directory-mcp/directory.db
  • Windows: %APPDATA%/directory-mcp/directory.db

๐Ÿ“Š Performance

  • Response Times: All operations complete in <200ms
  • Embedding Generation: ~100ms per entity
  • Search Operations: <50ms average
  • Concurrent Support: Thread-safe SQLite operations
  • Caching: Intelligent embedding cache for repeated queries

๐Ÿ› Known Limitations

  1. FTS5 Special Characters: Search doesn't handle @, ', #, - well

    • Workaround: Search by name instead of email
  2. Duplicate Detection: No automatic duplicate person prevention

    • Workaround: Search before creating
  3. Channel Names: Hyphens in channel names cause SQL errors

    • Workaround: Use underscores or spaces

๐Ÿ”„ Version History

  • v0.4.28 - Current stable release with comprehensive testing
  • v0.4.0 - Major refactoring to modular architecture
  • v0.3.0 - Added Gemini embeddings for intelligent search
  • v0.2.0 - Relationship management features
  • v0.1.0 - Initial release with basic CRUD

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

# Clone the repository
git clone https://github.com/markov-ai/directory-mcp.git
cd directory-mcp

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest tests/

# Run with debug logging
LOG_LEVEL=DEBUG uvx directory-mcp

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with FastMCP framework
  • Powered by Google Gemini for embeddings
  • Inspired by the need for better professional network management

๐Ÿ“ž Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

directory_mcp-0.5.0.tar.gz (42.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

directory_mcp-0.5.0-py3-none-any.whl (47.1 kB view details)

Uploaded Python 3

File details

Details for the file directory_mcp-0.5.0.tar.gz.

File metadata

  • Download URL: directory_mcp-0.5.0.tar.gz
  • Upload date:
  • Size: 42.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for directory_mcp-0.5.0.tar.gz
Algorithm Hash digest
SHA256 02a5d46c698c392a7ce2900920fc2305474e6f7632b62843dad753fe822b1d31
MD5 93f1f95dee9afbf84f75b6a7cdf8d8ce
BLAKE2b-256 8c7f50db14d00964bca7f76e051af167d234779f3466c325b4df570fa4604353

See more details on using hashes here.

File details

Details for the file directory_mcp-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: directory_mcp-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 47.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for directory_mcp-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 258986f7f95fbbca236a67ca5e4d8825c2a712306b81d810fa2c18940ec46841
MD5 da70d6953ffb3e77638530d6d931a95a
BLAKE2b-256 7389f598a90ec75552077320418106ac65129a69bdeb321a7f90ef89d61d3276

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page