Skip to content

mrankitvish/gnome-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Gnome Agent

A local-first AI assistant embedded directly into your GNOME desktop β€” powered by LangGraph and MCP tool integration.

Python FastAPI LangGraph GNOME Shell License


✨ Features

Feature Description
🧠 Multi-provider LLM Ollama, OpenAI, Anthropic, Gemini, Mistral, or any OpenAI-compatible server
πŸ”§ MCP Tool Integration Model Context Protocol for extensible desktop tools (filesystem, system, custom)
πŸ’¬ Persistent Chat History SQLite-backed LangGraph checkpointer β€” conversations survive server restarts
⌨️ Global Hotkey Press Super+Space anywhere to summon the AI panel
πŸͺŸ Resizable Panel Drag the corner handle to resize. Size is persisted across sessions
πŸ• Chat History Browser Browse and resume previous conversations from the history overlay
βš™οΈ In-UI LLM Config Configure your provider, model, and API key directly in preferences
πŸ“‘ SSE Streaming Real-time token-by-token streaming in the chat panel
πŸ”’ Optional Auth Bearer token auth and per-IP rate limiting middleware
πŸ–₯️ Context Injection Active app, window title, and clipboard injected into the AI context

πŸŽ₯ Demo

Watch the assistant in action:

https://github.com/mrankitvish/gnome-agent/raw/main/docs/gnome-agent-demo.webm


πŸ—οΈ Architecture

System Overview

graph TB
    subgraph GNOME["GNOME Shell Extension"]
        EXT["extension.js\nMain entry point"]
        PANEL["panel.js\nChat UI Panel"]
        PREFS["prefs.js\nPreferences"]
        API_JS["api.js\nHTTP + SSE Client"]
        MSG["messages.js\nMessage Bubbles"]
    end

    subgraph BACKEND["FastAPI Backend"]
        MAIN["main.py\nApp + Lifespan"]
        CHAT_API["/chat\nSSE Stream"]
        CONFIG_API["/config/llm\nLLM Settings"]
        SESSION_API["/sessions\nHistory"]
        HEALTH["/health"]
    end

    subgraph CORE["Core Services"]
        AGENT["AgentBuilder\nLangGraph graph"]
        SM["SessionManager\nMessage persistence"]
        CHKPT["SQLiteCheckpointer\nThread state"]
        LLM_FAC["LLM Factory\nProvider abstraction"]
    end

    subgraph MCP_LAYER["MCP Tool Layer"]
        MCP_ROUTER["MCPRouter\nMultiServerMCPClient"]
        SYS_MCP["System MCP\nProcesses, Disk, Logs"]
        FS_MCP["Filesystem MCP\nRead, Search"]
        DESK_MCP["Desktop MCP\nApps, Screenshots"]
        CUSTOM["Custom MCP Servers"]
    end

    subgraph DB["SQLite Database"]
        SESSIONS[("sessions")]
        MESSAGES[("messages")]
        CHECKPOINTS[("checkpoints")]
        APP_CONFIG[("app_config")]
        MCP_SERVERS[("mcp_servers")]
    end

    EXT --> PANEL
    EXT --> PREFS
    PANEL --> API_JS
    PANEL --> MSG
    API_JS -->|HTTP/SSE| CHAT_API
    API_JS -->|HTTP| CONFIG_API
    API_JS -->|HTTP| SESSION_API

    MAIN --> CHAT_API
    MAIN --> CONFIG_API
    MAIN --> SESSION_API
    MAIN --> HEALTH

    CHAT_API --> AGENT
    CHAT_API --> SM
    AGENT --> LLM_FAC
    AGENT --> CHKPT
    AGENT --> MCP_ROUTER

    MCP_ROUTER --> SYS_MCP
    MCP_ROUTER --> FS_MCP
    MCP_ROUTER --> DESK_MCP
    MCP_ROUTER --> CUSTOM

    SM --> SESSIONS
    SM --> MESSAGES
    CHKPT --> CHECKPOINTS
    CONFIG_API --> APP_CONFIG
    MCP_ROUTER --> MCP_SERVERS
Loading

Chat Message Flow

sequenceDiagram
    participant User
    participant Extension as GNOME Extension
    participant FastAPI as FastAPI /chat
    participant LangGraph as LangGraph Agent
    participant MCP as MCP Tools
    participant LLM

    User->>Extension: Types message + Enter
    Extension->>FastAPI: POST /chat (SSE)
    FastAPI->>FastAPI: Load global LLM config
    FastAPI->>FastAPI: Resolve/create session
    FastAPI->>LangGraph: astream({messages}, thread_id)
    LangGraph->>LLM: Invoke with full thread history
    LLM-->>LangGraph: Tool call request
    LangGraph->>MCP: Execute tool
    MCP-->>LangGraph: Tool result
    LangGraph->>LLM: Resume with tool result
    LLM-->>LangGraph: Final text response
    LangGraph-->>FastAPI: Stream chunks
    FastAPI-->>Extension: SSE events (tool_call, message, final_answer)
    Extension-->>User: Renders real-time chat bubbles
Loading

LLM Provider Support

graph LR
    FAC[LLM Factory]

    FAC --> OLL[Ollama\nLocal, no key needed]
    FAC --> OAI[OpenAI\ngpt-4o, gpt-4o-mini]
    FAC --> ANT[Anthropic\nclaude-3.5-sonnet]
    FAC --> GEM[Google Gemini\ngemini-2.0-flash]
    FAC --> MIS[Mistral AI\nmistral-large]
    FAC --> COMP[OpenAI-Compatible\nLM Studio Β· vLLM Β· Jan]
Loading

πŸ“ Project Structure

gnome-agent/
β”œβ”€β”€ app/                        # FastAPI backend
β”‚   β”œβ”€β”€ main.py                 # App factory + lifespan
β”‚   β”œβ”€β”€ config.py               # Pydantic settings
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ chat.py             # POST /chat (SSE streaming)
β”‚   β”‚   β”œβ”€β”€ config.py           # GET/PUT /config/llm
β”‚   β”‚   β”œβ”€β”€ sessions.py         # GET /sessions, /sessions/{id}/messages
β”‚   β”‚   β”œβ”€β”€ mcp.py              # MCP server management
β”‚   β”‚   └── health.py           # GET /health
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ agent_builder.py    # LangGraph agent factory + cache
β”‚   β”‚   β”œβ”€β”€ llm_factory.py      # Multi-provider LLM initialization
β”‚   β”‚   β”œβ”€β”€ checkpointer.py     # SQLite-backed LangGraph checkpointer
β”‚   β”‚   β”œβ”€β”€ session_manager.py  # Chat session + message persistence
β”‚   β”‚   └── permissions.py      # Tool permission system
β”‚   β”œβ”€β”€ db/
β”‚   β”‚   β”œβ”€β”€ database.py         # Async SQLite connection manager
β”‚   β”‚   └── models.py           # Schema DDL + seed data
β”‚   └── mcp/
β”‚       β”œβ”€β”€ client.py           # MultiServerMCPClient wrapper
β”‚       β”œβ”€β”€ registry.py         # Tool registry
β”‚       └── builtins/           # Built-in MCP servers
β”‚           β”œβ”€β”€ system.py       # Processes, disk, journal
β”‚           β”œβ”€β”€ filesystem.py   # File read/search
β”‚           └── desktop.py      # App launcher, screenshot
β”‚
β”œβ”€β”€ extension/                  # GNOME Shell Extension
β”‚   β”œβ”€β”€ extension.js            # Entry point, hotkey binding
β”‚   β”œβ”€β”€ panel.js                # Chat popup UI
β”‚   β”œβ”€β”€ prefs.js                # Preferences window
β”‚   β”œβ”€β”€ api.js                  # HTTP/SSE API client (Soup3)
β”‚   β”œβ”€β”€ messages.js             # Message bubble widgets
β”‚   β”œβ”€β”€ metadata.json           # Extension manifest
β”‚   β”œβ”€β”€ stylesheet.css          # Custom styles
β”‚   β”œβ”€β”€ icon.png                # Panel icon
β”‚   β”œβ”€β”€ install.sh              # One-command installer
β”‚   └── schemas/                # GSettings schema
β”‚
β”œβ”€β”€ docs/                       # Documentation
β”‚   β”œβ”€β”€ setup.md                # Installation & configuration
β”‚   └── how-to-guide.md         # Feature usage guide
β”‚
β”œβ”€β”€ gnome-agent.service         # Systemd user service
β”œβ”€β”€ pyproject.toml              # Python project manifest
└── .env.example                # Environment variable template

πŸš€ Quick Start

# 1. Clone
git clone https://github.com/mrankitvish/gnome-agent
cd gnome-agent

# 2. Install backend
python -m venv venv && source venv/bin/activate
pip install -e .

# 3. Configure
cp .env.example .env
# Edit .env with your LLM settings

# 4. Start server
uvicorn app.main:app

# 5. Install GNOME extension
bash extension/install.sh
# Restart GNOME Shell (Alt+F2, r, Enter on X11)

πŸ‘‰ Full setup instructions: docs/setup.md πŸ‘‰ Feature usage guide: docs/how-to-guide.md


πŸ”Œ API Overview

Method Endpoint Description
POST /chat Stream AI response as SSE
GET /config/llm Get current LLM config + capabilities
PUT /config/llm Update global LLM config
GET /config/providers List all supported providers
GET /sessions List all conversation sessions
GET /sessions/{id}/messages Get messages for a session
GET /health Runtime health check
GET/POST /mcp/servers Manage MCP servers
GET /tools List loaded MCP tools

πŸ›‘οΈ Requirements

  • OS: Linux with GNOME Shell 45+
  • Python: 3.11+
  • LLM: Any supported provider (Ollama recommended for local use)

πŸ“„ License

MIT Β© 2026 β€” see LICENSE

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors