mirror of
https://github.com/f/awesome-chatgpt-prompts.git
synced 2026-02-12 15:52:47 +00:00
feat(cli): add 'mcp' command to start MCP server for AI tools
This commit is contained in:
23
README.md
23
README.md
@@ -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)
|
||||
|
||||
---
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user