Skip to content

Remember an approved community preference

This recipe composes two independent MCP servers in the agent host. discord-mcp continues to own Discord reads, permissions, dry-run behavior, approvals, and Activity Evidence. Memcode stores one compact preference only after a guild owner or authorized operator approves it.

First create and verify the non-secret Discord profile. Keep DISCORD_TOKEN in the MCP host’s launch environment:

Terminal window
npm install -g @discord-mcp/cli@0.28.0
discord-mcp setup --profile community --client generic
discord-mcp doctor --profile community --online

The exact file varies by host. For clients that accept the common mcpServers shape, configure discord-mcp over stdio and Memcode as a remote MCP server:

{
"mcpServers": {
"discord": {
"command": "npx",
"args": ["--yes", "--loglevel=error", "@discord-mcp/cli@0.28.0", "serve", "--profile", "community"]
},
"memcode": {
"url": "https://mcp.memcode.in/i/discord-mcp/mcp"
}
}
}

The Memcode endpoint uses browser OAuth. Do not paste a Memcode API key or add an Authorization header. Keep the existing discord-mcp environment, guild allowlist, profile, MCP_DRY_RUN, and approval configuration unchanged. See Memcode’s official hosted endpoint and OAuth setup and tool reference. The schemas returned by tools/list from the configured endpoint are authoritative for the deployed server.

Example: carry a posting preference across runs

Section titled “Example: carry a posting preference across runs”

Suppose guild 111122223333444455 wants release announcements drafted with a short changelog and no @everyone mention.

  1. Get explicit owner opt-in.

    Show the exact proposed record and retention/deletion limitations before storing it. Memcode documents its general memory lifecycle, but, as verified on 2026-09-21, the hosted personal tools publish neither a fixed retention duration nor a self-service deletion procedure. Setting forget: true only applies the account’s configured expiration policy; it is not a deletion guarantee. Removing the MCP configuration also does not delete stored data. If a guaranteed expiry or deletion path is required, do not write the record. Contact the provider and obtain a confirmed procedure before storing it:

    Guild 111122223333444455 preference: draft release announcements with a
    short changelog and never add @everyone automatically. Approved by the
    guild owner on 2026-09-21. Re-check current Discord permissions before use.

    Do not store DMs, message bodies, credentials, bot tokens, member profiles, or unreviewed Discord content.

  2. Save only the approved text.

    {
    "name": "save_memory",
    "arguments": {
    "text": "Guild 111122223333444455 preference: draft release announcements with a short changelog and never add @everyone automatically. Approved by the guild owner on 2026-09-21. Re-check current Discord permissions before use.",
    "idempotency_key": "discord-111122223333444455-release-preference-v1"
    }
    }

    Poll get_memory_ingest_status with the returned job id. Use the record only after the provider reports a documented successful terminal state. Do not treat queued, partial, or any undocumented state as usable. On failed or cancelled, do not search for or use the record; surface the returned error to the operator. If polling times out, retain the job id and resume polling later. Do not issue a replacement write unless it reuses the same idempotency_key.

  3. Retrieve narrowly on a later run.

    {
    "name": "search_memories",
    "arguments": {
    "query": "approved release announcement preference for guild 111122223333444455",
    "mode": "memories",
    "top_k": 3,
    "include_original_chunks": false
    }
    }

    Discard results for any other guild or workflow. Keep the source id and approval date in the agent’s draft notes so the operator can inspect where the preference came from.

  4. Re-read current Discord state.

    Use discord-mcp to inspect the target guild/channel, current permissions, and any relevant Activity Evidence. If the memory is stale or conflicts with Discord, follow Discord and ask the operator.

  5. Draft, review, and publish through the normal controls.

    Memory may influence the draft. It must not set __confirm, bypass MCP_DRY_RUN, expand the allowlist, or authorize a send. Preserve the recipe-specific preview and human confirmation flow before publishing.

The configuration shape above was checked with Claude Code 2.1.236 on macOS: it accepted the discord-mcp stdio entry alongside the remote Memcode entry, completed Memcode’s browser OAuth flow, and reported the remote server as connected. The Discord server was not invoked during the memory sequence because no Discord bot token was supplied. The MCP sequence itself was replayed with the MCP Python SDK 1.29.0 using synthetic data only. The first run created the record through the canonical hosted resource. On 2026-09-21, the exact attributed endpoint in this recipe initialized successfully and replayed the same sequence with the same idempotency key; save_memory returned status=succeeded and created=false, and search returned the same record.

Redacted output from save_memory → get_memory_ingest_status → search_memories:

save_memory:
job_id=memory_free_ingest:...70971
status=queued
created=true
get_memory_ingest_status:
job_id=memory_free_ingest:...70971
status=succeeded
progress.step=weaving
parent_job_id=memory_free_batch:...1d11
search_memories:
summary="User prefers cobalt tea; this was identified as synthetic test data only."
summary_score=0.58
original_chunk="Synthetic Discord MCP documentation verification 2026-09-21: the example user prefers cobalt tea. This is synthetic test data only."
original_score=0.69

Scores are run-dependent; verify the returned text, job id, and terminal status rather than expecting those exact numbers. The test used idempotency key discord-mcp-docs-verification-20260921-cobalt-tea; replaying the same write returned created=false and did not create a duplicate record.

  • If Memcode is unavailable, continue with current Discord state and ask the operator for the preference. Do not silently reuse an unverified local copy.
  • Keep a visible provenance note for every preference used. Periodically use list_memories or a scoped search so the owner can inspect stored records.
  • Remove the memcode MCP entry to disable future reads and writes. This does not delete existing records.
  • The hosted personal Memcode tools in this example do not currently expose an in-client delete call. No fixed hosted retention guarantee or verified self-service deletion procedure was published as of 2026-09-21. If the guild requires guaranteed expiry or deletion, do not store the preference; contact the provider first and obtain a confirmed procedure for that account or deployment.
  • Neither server should receive data it does not need: Memcode receives only the approved preference, while discord-mcp keeps its existing Discord API and telemetry boundaries.

discord-mcp connects to Discord using the caller-owned bot token and the existing profile/allowlist. Memcode connects to https://mcp.memcode.in/i/discord-mcp/mcp and opens the Memcode OAuth consent flow. The agent host can see both tools’ outputs, but the servers do not exchange credentials or call each other. The first npx launch may contact the npm registry for the pinned package. This recipe does not change discord-mcp’s own telemetry settings or behavior. It makes no claim about Memcode’s provider-side logging or telemetry; review the provider’s current documentation and terms before any write.