Stardog-MCP-Server

vAirpower/Stardog-MCP-Server

3.2

If you are the rightful owner of Stardog-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Stardog MCP Server bridges AI models and knowledge graphs, providing a seamless interface for AI systems to access semantic data.

Tools
5
Resources
0
Prompts
0

Stardog MCP Server & AWS Strands Integration

๐Ÿค– Claude 3.7 Sonnet + AWS Strands Agent + Stardog Knowledge Graphs = Intelligent GEOINT Analysis

License: MIT Python 3.8+ Docker

๐Ÿ—๏ธ Architecture Overview

This repository contains two interconnected components that work together to provide an intelligent, conversational interface to Stardog knowledge graphs:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    HTTP/MCP     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    SPARQL/GraphQL    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Streamlit App  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚   MCP Server    โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚   Stardog DB    โ”‚
โ”‚                 โ”‚                โ”‚                 โ”‚                      โ”‚                 โ”‚
โ”‚ โ€ข Claude 3.7    โ”‚                โ”‚ โ€ข SPARQL Tools  โ”‚                      โ”‚ โ€ข Knowledge     โ”‚
โ”‚ โ€ข AWS Strands   โ”‚                โ”‚ โ€ข GraphQL API   โ”‚                      โ”‚   Graph         โ”‚
โ”‚ โ€ข Chat UI       โ”‚                โ”‚ โ€ข Schema Tools  โ”‚                      โ”‚ โ€ข GEOINT Data   โ”‚
โ”‚ โ€ข Port 8501     โ”‚                โ”‚ โ€ข Port 8000     โ”‚                      โ”‚ โ€ข Semantic Web  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ง MCP Server (mcp-server/)

  • Purpose: Custom Model Context Protocol server for Stardog knowledge graphs
  • Capabilities:
    • SPARQL query execution and optimization
    • GraphQL API for modern applications
    • Schema discovery and ontology exploration
    • Natural language to SPARQL conversion
  • Deployment: Local development, Docker, or AWS ECS
  • Port: 8000
  • Technology: Python, FastAPI, MCP Protocol

๐Ÿ–ฅ๏ธ Streamlit App (streamlit-app/)

  • Purpose: Interactive chatbot with autonomous reasoning capabilities
  • AI Model: Claude 3.7 Sonnet via AWS Bedrock Converse API
  • Agent Framework: AWS Strands for intelligent tool orchestration
  • Features:
    • Natural language GEOINT queries
    • Real-time knowledge graph exploration
    • Multi-turn conversations with context
    • Visual query suggestions and examples
  • Port: 8501
  • Technology: Streamlit, AWS Bedrock, Strands Agent

๐Ÿš€ Quick Start

Option 1: Docker Compose (Recommended)

# Clone the repository
git clone https://github.com/vAirpower/Stardog-MCP-Server.git
cd Stardog-MCP-Server

# Copy and configure environment files
cp mcp-server/.env.example .env
cp streamlit-app/.env.example .env.local

# Edit .env files with your Stardog and AWS configuration
nano .env      # Configure Stardog connection
nano .env.local # Configure AWS Bedrock and Claude

# Start both services
docker-compose up --build

Access the application:

Option 2: Manual Setup

# Terminal 1: Start MCP Server
cd mcp-server
pip install -r requirements.txt
python -m stardog_mcp_server.server

# Terminal 2: Start Streamlit App  
cd streamlit-app
pip install -r requirements.txt
streamlit run app.py

Option 3: Demo Mode (No Stardog Required)

For testing without a Stardog instance, use the built-in demo server with synthetic GEOINT data:

# Start demo with synthetic data
docker-compose --profile demo up

# Or manually
cd streamlit-app
python standalone_server.py &
streamlit run app.py

๐Ÿ”— How Components Connect

  1. MCP Server exposes Stardog capabilities through standardized MCP tools over HTTP
  2. Streamlit App connects using the HTTP MCP Client for seamless integration
  3. AWS Strands Agent orchestrates Claude 3.7 Sonnet + MCP tools for autonomous reasoning
  4. Real-time queries enable conversational knowledge graph exploration

Example Interaction Flow:

User: "What military facilities are near Washington DC?"
  โ†“
Strands Agent: Analyzes query โ†’ Calls MCP tools โ†’ Executes SPARQL
  โ†“
MCP Server: Queries Stardog โ†’ Returns structured results
  โ†“
Claude 3.7: Processes results โ†’ Generates natural language response
  โ†“
User: Receives comprehensive answer with facility details

๐Ÿ› ๏ธ Configuration

MCP Server Configuration

# mcp-server/.env
STARDOG_ENDPOINT=http://localhost:5820
STARDOG_USERNAME=admin
STARDOG_PASSWORD=admin
STARDOG_DATABASE=stardog
MCP_SERVER_HOST=0.0.0.0
MCP_SERVER_PORT=8000

Streamlit App Configuration

# streamlit-app/.env
AWS_REGION=us-east-1
BEDROCK_MODEL_ID=us.anthropic.claude-3-7-sonnet-20250219-v1:0
FUSEKI_MCP_SERVER_URL=http://localhost:8000
STREAMLIT_SERVER_PORT=8501

๐Ÿ“š Documentation

  • - Setup, API reference, and deployment
  • - Configuration, features, and usage
  • - Technical deep-dive
  • - AWS ECS and production setup
  • - Getting started tutorial
  • - Security best practices

๐Ÿงช Example Queries

Once running, try these sample queries in the Streamlit interface:

  • "What facilities are in Virginia?" - Geographic filtering
  • "Find all military bases with coordinates" - Type-based search
  • "Show me the database schema" - Ontology exploration
  • "What's connected to the Pentagon?" - Relationship queries
  • "Convert this to SPARQL: Find airports" - Natural language processing

๐Ÿ—๏ธ Development

Project Structure

Stardog-MCP-Server/
โ”œโ”€โ”€ mcp-server/                 # MCP Server component
โ”‚   โ”œโ”€โ”€ src/stardog_mcp_server/ # Core server implementation
โ”‚   โ”œโ”€โ”€ infrastructure/         # CDK deployment code
โ”‚   โ””โ”€โ”€ README.md               # Server-specific documentation
โ”œโ”€โ”€ streamlit-app/              # Streamlit Application
โ”‚   โ”œโ”€โ”€ app.py                  # Main Streamlit application
โ”‚   โ”œโ”€โ”€ strands_agent.py        # AWS Strands integration
โ”‚   โ”œโ”€โ”€ mcp_http_client.py      # MCP client implementation
โ”‚   โ””โ”€โ”€ README.md               # App-specific documentation
โ”œโ”€โ”€ deployment/                 # CloudFormation templates
โ”œโ”€โ”€ docs/                       # Comprehensive documentation
โ””โ”€โ”€ docker-compose.yml          # Multi-service orchestration

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

๐Ÿ”ง Deployment

Local Development

  • Use docker-compose for full stack development
  • Individual components can be run separately for focused development

Production (AWS ECS)

  • CloudFormation templates in deployment/
  • CDK infrastructure code in mcp-server/infrastructure/
  • See for detailed instructions

๐Ÿ“Š Monitoring

  • MCP Server Health: GET /health
  • Metrics Endpoint: GET /metrics
  • Streamlit Status: Built-in Streamlit monitoring
  • AWS CloudWatch: Production monitoring and alerting

๐Ÿค Support

๐Ÿ“„ License

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

๐ŸŒŸ Acknowledgments

  • Anthropic for Claude 3.7 Sonnet
  • AWS for Bedrock and Strands Agent framework
  • Stardog for the knowledge graph platform
  • Model Context Protocol for standardized AI tool integration

Ready to explore your knowledge graphs with AI? ๐Ÿš€

Get started with: docker-compose up --build