Skip to content

Implement MCP API endpoint for prompt exposure to AI clients#6

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-mcp-api-issues
Draft

Implement MCP API endpoint for prompt exposure to AI clients#6
Copilot wants to merge 4 commits intomainfrom
copilot/fix-mcp-api-issues

Conversation

Copy link
Contributor

Copilot AI commented Oct 25, 2025

The /api/mcp endpoint referenced in MCPServerDialog was not implemented, breaking Claude Desktop integration and other MCP clients.

Changes

MCP endpoint implementation (api/vite-mcp-plugin.ts)

  • Vite middleware serving JSON-RPC 2.0 at /api/mcp
  • Methods: initialize, prompts/list, prompts/get
  • Dev mode serves 3 demo prompts; production fetches from Spark KV
  • CORS headers and proper error handling

Prompt conversion utilities (api/mcp.ts)

  • Extracts {{placeholders}} from prompt content as MCP arguments
  • Substitutes argument values in prompt content
  • Converts Prompt objects to MCP-compliant format

Configuration (vite.config.ts)

  • Added MCP plugin to middleware chain

Documentation

  • MCP_TESTING.md: curl examples and expected responses
  • MCP_SETUP.md: API reference, Claude Desktop setup
  • README.md: integration quick start

Usage

# List exposed prompts
curl -X POST http://localhost:5000/api/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"prompts/list"}'

# Get prompt with placeholder substitution
curl -X POST http://localhost:5000/api/mcp \
  -d '{"jsonrpc":"2.0","id":2,"method":"prompts/get",
       "params":{"name":"prompt-demo-1",
                 "arguments":{"language":"Python","code":"print(123)"}}}'

Claude Desktop config:

{
  "mcpServers": {
    "promptarq-prompts": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-fetch", 
               "http://localhost:5000/api/mcp"]
    }
  }
}

Screenshot

MCP Server Dialog

The dialog now displays a working endpoint that successfully responds to MCP clients.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/categories
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/model-configs
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/projects
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/prompt-comments
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/prompt-versions
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/prompts
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/selected-team-id
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/shared-prompts
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/sidebar-collapsed
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/system-prompts
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/tags
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/team-members
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/teams
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/kv/users
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/loaded
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)
  • https://api.github.com/runtime/2bab7d016aa6208e5f2d/user
    • Triggering command: node /home/REDACTED/work/promptArq/promptArq/node_modules/.bin/vite (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

the mcp api doesnt seem to work, fix that, test yourself that prompts are made available throgh mcp and can be used, then update explanations as well


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits October 25, 2025 17:24
Co-authored-by: tamaygz <92460164+tamaygz@users.noreply.github.com>
Co-authored-by: tamaygz <92460164+tamaygz@users.noreply.github.com>
Co-authored-by: tamaygz <92460164+tamaygz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix MCP API functionality and update explanations Implement MCP API endpoint for prompt exposure to AI clients Oct 25, 2025
Copilot AI requested a review from tamaygz October 25, 2025 17:36
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