Skip to content

feat: add MCP client configuration picker and copy-to-clipboard funct…#695

Merged
ashwin31 merged 1 commit into
masterfrom
dev
Jun 2, 2026
Merged

feat: add MCP client configuration picker and copy-to-clipboard funct…#695
ashwin31 merged 1 commit into
masterfrom
dev

Conversation

@ashwin31

@ashwin31 ashwin31 commented Jun 2, 2026

Copy link
Copy Markdown
Member

…ionality to API tokens settings

Summary by CodeRabbit

  • New Features

    • Added AI agent configuration generator for multiple clients (Claude Desktop, Cursor, Gemini, Codex CLI)
    • Added one-click configuration copy functionality with toast notifications
  • Documentation

    • Added MCP server setup guide with token creation steps
    • Added client-specific configuration instructions and security requirements
    • Updated API tokens page with dynamic configuration snippet generation

Copilot AI review requested due to automatic review settings June 2, 2026 01:27
} catch (err) {
console.error('Failed to load API tokens:', err);
return { tokens: [], loadError: err?.message || 'Failed to load tokens' };
return { tokens: [], baseUrl: apiBaseUrl, loadError: err?.message || 'Failed to load tokens' };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected ':' and instead saw 'message'.
Expected '}' to match '{' from line 18 and instead saw 'Failed to load tokens'.
Expected an identifier and instead saw '.'.
Expected an identifier and instead saw '||'.
Missing semicolon.
Unnecessary semicolon.

// PUBLIC API host (e.g. https://api.bottlecrm.io) — the same base the browser
// talks to. PUBLIC_DJANGO_API_URL is that host with no /api suffix, which is
// exactly what the MCP client expects (it appends /api/... itself).
const apiBaseUrl = env.PUBLIC_DJANGO_API_URL || 'https://api.bottlecrm.io';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

@@ -1,14 +1,21 @@
import { fail } from '@sveltejs/kit';
import { env } from '$env/dynamic/public';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 240ca577-7767-4fda-93a0-20127e645873

📥 Commits

Reviewing files that changed from the base of the PR and between e320dfc and 20a890f.

📒 Files selected for processing (4)
  • README.md
  • frontend/src/routes/(app)/settings/api-tokens/+page.server.js
  • frontend/src/routes/(app)/settings/api-tokens/+page.svelte
  • mcp_server/README.md

📝 Walkthrough

Walkthrough

This PR introduces built-in MCP server support for AI agent integration. The main README documents the new feature and setup flow, the backend API now exposes a base URL to the frontend, the frontend provides a client-specific configuration UI with copy functionality, and the MCP server documentation clarifies security requirements and client setup.

Changes

MCP AI Agent Integration

Layer / File(s) Summary
Main README MCP documentation
README.md
Adds MCP feature entry to the features list, introduces a "Connect your AI agent (MCP)" setup section with token generation and server registration steps, and updates project structure to include mcp_server/ directory.
Backend API base URL infrastructure
frontend/src/routes/(app)/settings/api-tokens/+page.server.js
Server loader reads public Django API host from environment with fallback default and returns baseUrl alongside API tokens for frontend configuration generation.
Frontend AI client configuration UI
frontend/src/routes/(app)/settings/api-tokens/+page.svelte
Implements client picker and dynamic configuration snippet generation for JSON (Claude Desktop, Cursor, Gemini) and TOML (Codex CLI) formats, includes copy-to-clipboard support, and opens configuration panel after token creation.
MCP server documentation and security model
mcp_server/README.md
Updates client configuration instructions with cross-client requirements, adds Codex CLI TOML setup with local-run guidance, and expands security documentation to explicitly require confirm=true for destructive and outward-facing operations.

🎯 2 (Simple) | ⏱️ ~12 minutes

A rabbit hops with glee,
As agents join the CRM spree!
MCP keys and tokens bright,
Claude, Cursor—all configured just right. 🐰✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ashwin31 ashwin31 merged commit 3ab79d7 into master Jun 2, 2026
5 of 7 checks passed
@ashwin31 ashwin31 deleted the dev branch June 2, 2026 01:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds end-user guidance and UI affordances to connect MCP-compatible AI clients to BottleCRM using Personal Access Tokens, and documents MCP setup in the repo docs.

Changes:

  • Document MCP server capability and add “Connect your AI agent (MCP)” setup steps in the main README.
  • Expand mcp_server/README.md with multi-client configuration examples (JSON + TOML) and clarify confirm-gating for outward-facing actions.
  • Enhance the API Tokens settings page with a client picker, ready-to-paste configs, and copy-to-clipboard support (including passing the API base URL from the server load).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
README.md Adds MCP feature mention and user-facing connection instructions; updates repo tree to include mcp_server/.
mcp_server/README.md Adds a unified “Client configuration” section with per-client file locations/formats and clarifies confirm requirements for send.
frontend/src/routes/(app)/settings/api-tokens/+page.svelte Adds MCP client selector, generates per-client config snippets, and adds copy-to-clipboard UI for configs.
frontend/src/routes/(app)/settings/api-tokens/+page.server.js Supplies baseUrl to the page from PUBLIC_DJANGO_API_URL for config generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +10
// The MCP server runs on the user's own machine, so BCRM_BASE_URL must be the
// PUBLIC API host (e.g. https://api.bottlecrm.io) — the same base the browser
// talks to. PUBLIC_DJANGO_API_URL is that host with no /api suffix, which is
// exactly what the MCP client expects (it appends /api/... itself).
const apiBaseUrl = env.PUBLIC_DJANGO_API_URL || 'https://api.bottlecrm.io';

// Reset the create form after a successful creation.
formName = '';
formExpiresAt = '';
copied = false;
Comment on lines +423 to +424
(provides <code class="font-mono">uvx</code>) on your machine. The agent acts as you and
inherits your role — it can't see or do anything you can't.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants