peppa/apps/web/app/(app)/settings/page.tsx
Асель 39367b1d82 PEP-8: remote MCP for ChatGPT with Peppa as OAuth 2.1 server
- OAuth: RFC 8414/9728 metadata, RFC 7591 dynamic registration,
  authorization code + PKCE S256 with a consent screen after Gitea login,
  refresh token rotation; tokens and codes stored hashed; revoke in web
- /mcp: stateless Streamable HTTP, Bearer → user; PM tools from
  @peppa/mcp/manager: projects, goals, tasks, create, move (board
  semantics, starts agents), inbox, answer/accept — owner-scoped
- login keeps ?next= through Gitea OAuth; Settings page with MCP URL and
  connected apps
- 5 new tests (53 e2e total, green); verified on prod as a client:
  DCR → consent → token → MCP over HTTPS → revoke → 401
- OpenSpec: pep-8 archived into spec remote-mcp

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 21:38:09 +05:00

43 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { connectedApps } from "@peppa/core";
import { ago, Flash } from "@/components/ui";
import { publicOrigin, requireUser } from "@/lib/auth";
import { db } from "@/lib/db";
import { revokeConnectedApp } from "../actions";
export default async function Settings({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
const user = await requireUser();
const { error } = await searchParams;
const apps = await connectedApps(db, user.id);
const origin = await publicOrigin();
return (
<section className="narrow">
<Flash error={error} />
<h1>Настройки</h1>
<h2>MCP для ChatGPT и других клиентов</h2>
<p>
Адрес сервера — подключите его как MCP-коннектор с авторизацией OAuth. Клиент
зарегистрируется сам, вы подтвердите доступ на экране Пеппы.
</p>
<code className="mcp-url">{origin}/mcp</code>
<h2>Подключённые приложения</h2>
{apps.length === 0 ? (
<p className="empty">Нет подключённых приложений.</p>
) : (
apps.map((a) => (
<article key={a.clientId} className="card row">
<div className="grow">
<b>{a.name}</b>
<div className="muted">с {a.since.toLocaleDateString("ru-RU")} · последний запрос {ago(a.lastUsedAt)}</div>
</div>
<form action={revokeConnectedApp}>
<input type="hidden" name="clientId" value={a.clientId} />
<input type="hidden" name="back" value="/settings" />
<button className="danger">Отозвать</button>
</form>
</article>
))
)}
</section>
);
}