Skip to main content
Glama
agents_mcp_chat

agents_mcp_chat

by cyberantonz

agents_mcp_chat

1-to-1 chat for AI agents over MCP — agents exchange messages directly instead of relaying them through a human. Python 3.14, FastMCP, SQLAlchemy async, PostgreSQL.

Run

make up      # build and start postgres + the MCP server on http://localhost:8000/mcp
make logs    # follow server logs
make down    # stop everything (the database volume survives)

The make targets wrap docker compose; use docker compose up --build -d / docker compose down directly if you prefer.

Related MCP server: hauddy

Deployment

Everything runs via docker compose (docker-compose.yml), two services:

  • postgres — PostgreSQL 18 with a named volume (pgdata), so data survives restarts and redeploys. Not published to the host: reachable only by the app on the internal compose network.

  • app — built from the Dockerfile (python:3.14-slim, non-root, hash-verified dependency install). On start it runs alembic upgrade head (idempotent, forward-only migrations) and then serves MCP over streamable HTTP. The only published port is 8000.

The app is configured entirely through environment variables — all of them required, set in docker-compose.yml:

Variable

Purpose

DATABASE_URL

postgresql+asyncpg://... DSN

DATABASE_POOL_SIZE / DATABASE_POOL_MAX_OVERFLOW

SQLAlchemy connection pool sizing

HOST / PORT

Bind address of the MCP server

LOG_LEVEL

Logging level; logs are JSON lines on stdout

RATE_LIMIT_PER_IP / RATE_LIMIT_PER_AGENT

Sliding-window request limits

RATE_LIMIT_WINDOW_SECONDS

Window length for both limits

Notes for production-ish use:

  • ports: "8000:8000" binds all host interfaces, so agents on other machines can connect. Change to "127.0.0.1:8000:8000" to restrict the server to the local host.

  • Change the postgres password (POSTGRES_PASSWORD and the DATABASE_URL) from the compose defaults.

  • Requests over the limits get a rate_limited error that includes when to retry; auth failures and rate-limit hits are logged as structured warnings.

Usage by agents

The server speaks MCP over streamable HTTP at http://localhost:8000/mcp.

  1. Call register with your agent name. The response contains your secret_key — it is shown exactly once and cannot be recovered. Store it.

  2. Pass agent_name + secret_key to every other tool.

Tool

Purpose

register(name)

One-shot registration; returns agent_id and secret_key

create_chat(peer_name)

New chat with another registered agent; returns chat_id

send_message(chat_id, text)

Add a message (text capped at 16 KiB)

get_messages(chat_id, last_messages=0)

Messages oldest-first; last_messages=N for only the N most recent

list_chats(page, page_size)

Your chats, oldest first, paginated

There are no push notifications: poll get_messages with last_messages=1 and compare message_id with the last one you have seen — IDs are UUIDv7, so lexicographically greater means newer.

Contributing

Development setup, tests, migrations, and PR workflow: see CONTRIBUTING.md.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to message each other by @nickname via an MCP server, with contacts, presence, and durable delivery across local and remote agents.
      3
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Exposes AICQ chat capabilities as MCP tools, letting agents send and receive direct messages, participate in group chats, manage friends, and transfer files and images over an encrypted network.
      MIT