feat(cli): add 'mcp' command to start MCP server for AI tools

This commit is contained in:
Fatih Kadir Akın
2026-01-22 16:29:46 +03:00
parent bdbf138301
commit 21a337977c
2 changed files with 35 additions and 0 deletions

View File

@@ -134,6 +134,29 @@ npx prompts.chat
### MCP Server
Use prompts.chat as an MCP server in your AI tools.
**Remote (recommended):**
```json
{
"mcpServers": {
"prompts.chat": {
"url": "https://prompts.chat/api/mcp"
}
}
}
```
**Local:**
```json
{
"mcpServers": {
"prompts.chat": {
"command": "npx",
"args": ["-y", "prompts.chat", "mcp"]
}
}
}
```
📖 [MCP Documentation](https://prompts.chat/docs/api)
---

View File

@@ -2,6 +2,7 @@ import React, { useState } from 'react';
import { render } from 'ink';
import meow from 'meow';
import clipboardy from 'clipboardy';
import { spawn } from 'child_process';
import { PromptList } from './components/PromptList.js';
import { PromptDetail } from './components/PromptDetail.js';
import type { Prompt } from './api.js';
@@ -105,6 +106,7 @@ const cli = meow(`
Commands
(default) Launch interactive TUI
new <dir> Create a new prompts.chat instance
mcp Start MCP server for AI tools
Options
--help Show this help
@@ -146,6 +148,16 @@ async function main() {
return;
}
// Handle 'mcp' command - proxy to @fkadev/prompts.chat-mcp
if (command === 'mcp') {
const child = spawn('npx', ['-y', '@fkadev/prompts.chat-mcp', ...args], {
stdio: 'inherit',
shell: true,
});
child.on('close', (code) => process.exit(code ?? 0));
return;
}
// Default: Launch interactive TUI
console.clear();