Epic: Misty MCP server for coding agents

Open
#436 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@michelle-yl is already working on this.

Since Nov 28, 2026.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
18/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
fastapi, python

Research direction

This is an epic, not a single change: start with docs/MISTY-MCP.md (the approved design) before touching code. The build order is in the decomposition; the first unblocked pieces are the MCP foundation (mount /mcp in the gateway's FastAPI app behind an off switch, add DOC_BASE_URL/DOC_API_KEY to settings) and the session-store migration 003 next to 002_email_login. Done means those sub-issues exist and are individually specified; the SDK choice, issuer alignment and local-callback rules are open questions that must be settled first.

Written by the indexing model from the issue text.

Description

area/deployment area/docs-system area/integration area/service epic
Summary

Members want to ask their coding agent (Claude Code, Codex) about Misty documents without leaving the editor or sharing keys. The design is in docs/MISTY-MCP.md. The pieces it reuses already exist: #331's email login, documentation-system's authorized search and read, and the gateway. What doesn't exist is the part that joins them: an MCP endpoint, OAuth sign-in for agents, a session store, and the tools themselves.

Model

MCP is a module inside the existing gateway, not a new service. The agent only talks to the gateway at /mcp; the gateway talks to private services with its own keys.

  1. Sign-in. The agent calls /mcp with no token and gets a 401. It finds the gateway's OAuth endpoints through discovery and opens the login page in the browser. The member signs in with #331's email code. The gateway creates a session and issues an access token (about 1 hour) and a refresh token (about 30 days), exchanged with PKCE.
  2. Tool calls. Each call maps the access token to a session, then to a person_id, and checks that the person is still an active member. The gateway calls documentation-system as that person with an internal doc_ key (docs:read + act-as-user only).
  3. Refresh and revoke. Refresh tokens rotate, and reusing an old one ends the session. Deleting the session row revokes every token that belongs to it.

Governing constraint: identity comes from the session, never from the agent. No tool accepts a person or identity. Tokens are stored only as hashes. The doc_ key never leaves the gateway and never has docs:read:all. Login codes and grants never reach the agent.

Implementation tasks
  • #437 — Mount MCP in the gateway
  • #440 — Sign members in to MCP and manage sessions
  • #442 — Serve member-authorized MCP tools
  • #444 — Roll out MCP to members

Gateway setup and the storage and email-login parts of #440 can start together. Tool request binding consumes the session interface. Real-client acceptance and release sign-off belong to #444.

Area

service, integration, docs-system, deployment

What we can build on
  • docs/MISTY-MCP.md (#399): the approved design. It covers the flows, the credential table, tool schemas, error cases, limits and audit fields.
  • #331 (merged to staging): email login, membership checks, one-time codes and per-app/IP/mailbox limits. Its migration 002_email_login comes right before the new 003.
  • The gateway's existing FastAPI app, settings and startup checks, and the storage Protocol with in-memory and Postgres adapters.
  • documentation-system's authorized retrieval (POST /search, GET /docs/{id}). It already enforces person-scoped access.
  • The bot's helperTools.js: prior art for bounded search and read outputs.
  • UTMIST/Mist#125: prior art for separating identity from sessions and handling environments on top of #331.
Not in this epic
  • documentation-system gaps: an outage can return 404 from GET /docs/{id}; search results have no fetch date and documents have no content hash, so stale citations can't be detected; meeting notes may not be searchable. These belong in separate documentation-system issues.
  • New sources: Discord and repository ingestion stay in #332 and #333. MCP exposes those sources once they exist.
  • Write tools, and team or project context tools: for a later version. The first version is read-only.
  • A local stdio adapter, a separate MCP service, and VS Code support: rejected or deferred in the design.
  • Changes to #331's login contract or to the /v1 routes: both stay as they are.
Open questions
  • MCP SDK and version: which SDK and version fit the gateway's FastAPI app, and does its OAuth authorization-server support fit our login page? Decided in #437.
  • Cursor: support it, and if so through the client allowlist or Dynamic Client Registration? Decided during #444.
  • Shared-gateway risk: MCP shares one gateway replica, and a 120-requests-a-minute per-IP limit, with the Discord resolver and compute login. Measured in staging in #444 before production.
  • Maintainer: who maintains the MCP module alongside the gateway owner?
  • URLs and updates: what are the staging and production URLs members use, and how do members learn about updates?
Dominant language
Python
Stars
0
Forks
2
Avg merge
3d 3h
Merged PRs (30d)
31

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from UTMIST/Misty

All issues in UTMIST/Misty

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.