Skip to content

Mishra-Manit/MorphMind

Repository files navigation

MorphMind – Multimodal Memory Layer

This project helps you create and manage a local MCP (Model Context Protocol) server using Composio's 500+ integrations.

Prerequisites

  1. Composio API Key: Get yours from Composio Platform
  2. Auth Configurations: Create auth configs for your toolkits in the Composio Dashboard
  3. Python 3.8+: Make sure Python is installed

Quick Start

1. Install Dependencies

pip install -r requirements.txt

2. Configure Environment

Copy the example environment file and fill in your credentials:

cp .env.example .env

Edit .env and add:

  • Your COMPOSIO_API_KEY
  • Your auth config IDs (replace the placeholder IDs in mcp_server.py)
  • Optional: API keys for OpenAI/Anthropic if using examples

3. Create Auth Configurations

Before running the server, you need to create auth configurations for your toolkits:

  1. Go to Composio Dashboard → Auth Configs
  2. Create auth configs for each toolkit you want to use (e.g., Gmail, Google Calendar)
  3. Copy the auth config IDs (format: ac_xyz123)
  4. Update mcp_server.py with your actual auth config IDs

4. Create MCP Server

Run the main script to create your MCP server:

python mcp_server.py

This will:

  • Create an MCP server with your configured toolkits
  • Generate a unique URL for your user
  • Display the MCP server URL to use with AI providers

5. Authenticate Users

Important: Users must authenticate with the toolkits before the MCP server can use them.

See Hosted Authentication for how to connect user accounts.

6. Use with AI Providers

OpenAI Example

# Set your MCP server URL in .env as MCP_SERVER_URL
python openai_example.py

Anthropic Example

# Set your MCP server URL in .env as MCP_SERVER_URL
python anthropic_example.py

Project Structure

.
├── mcp_server.py          # Main script to create and manage MCP server
├── openai_example.py      # Example usage with OpenAI
├── anthropic_example.py   # Example usage with Anthropic
├── requirements.txt       # Python dependencies
├── .env.example          # Environment variables template
└── README.md             # This file

Configuration

Updating Toolkits

Edit mcp_server.py to add or modify toolkits:

toolkits=[
    {
        "toolkit": "gmail",
        "auth_config": "ac_xyz123"  # Your auth config ID
    },
    {
        "toolkit": "googlecalendar",
        "auth_config": "ac_abc456"  # Your auth config ID
    }
]

Updating Allowed Tools

Modify the allowed_tools list in mcp_server.py:

allowed_tools=[
    "GMAIL_FETCH_EMAILS", 
    "GMAIL_SEND_EMAIL", 
    "GOOGLECALENDAR_EVENTS_LIST"
]

Available Toolkits

Composio supports 500+ integrations. Check the Composio Docs for the full list of available toolkits and their tools.

Troubleshooting

"COMPOSIO_API_KEY not found"

  • Make sure you've created a .env file with your API key

"Auth config not found"

  • Verify your auth config IDs are correct
  • Make sure auth configs are created in the Composio dashboard

"Tools not working"

  • Ensure users have authenticated with the toolkits
  • Check that the user_id matches the authenticated user

Resources

Architecture

┌──────────────┐      WebSocket        ┌──────────────────────┐
│   Frontend   │  <------------------> │     FastAPI          │
│ React + D3   │                      │  Memory + Graph API  │
└──────────────┘                       └─────────┬────────────┘
                              Faiss/Sbert  │   Neo4j Bolt
                                            │
                                     ┌──────┴─────┐
                                     │  Storage   │
                                     └────────────┘
  • backend/ – FastAPI, Sentence-Transformers + FAISS for semantic memory, Whisper for audio, Neo4j for entity graph, ComposioClient wrapper.
  • frontend/ – React + Tailwind + D3, real-time graph via /ws.
  • docker-compose orchestrates Neo4j, backend, frontend.

Running with Docker

# build & start everything
docker compose up --build

# dashboard
http://localhost:5173      # React UI
http://localhost:7474      # Neo4j Browser
http://localhost:8000/docs # FastAPI docs

Environment variables can be placed in .env (loaded by backend):

COMPOSIO_API_KEY=...
NEO4J_URI=bolt://neo4j:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=password

Backend API

Route Method Body Description
/ingest/text POST {text, metadata?} Embed text & update graph
/ingest/audio POST (multipart) file Transcribe & ingest audio
/recall POST {query, top_k} Semantic search over memories
/graph GET Current memory→entity mapping
/ws WS Pushes graph JSON every 5 s

Interactive OpenAPI docs served at /docs.

Frontend Usage

The React app auto-connects to ws://localhost:8000/ws and renders the graph. It expects memories and entities; circles are colour-coded.

Development outside Docker:

cd frontend
npm i
npm run dev

Development

  • Tests – add pytest modules under tests/.
  • Lint – frontend uses TypeScript strict mode; backend should follow ruff / black (not enforced here).

Notes

  • Composio MCP servers only support Streamable HTTP transport
  • MCP server URLs are unique per user
  • Tools requiring authentication won't work until users connect their accounts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published