Skip to content

Support Model Context Protocol (MCP) Plugins #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kardolus opened this issue Apr 23, 2025 · 3 comments
Closed

Support Model Context Protocol (MCP) Plugins #127

kardolus opened this issue Apr 23, 2025 · 3 comments

Comments

@kardolus
Copy link
Owner

kardolus commented Apr 23, 2025

Summary

As a CLI user, I want to use MCP (Model Context Protocol) plugins like apify or smithery to pull external data and inject it into my conversation context — either as pre-query context or as part of a query — so that I can seamlessly enrich GPT responses with live, structured data.

Examples of Supported Usage

With multiple --param flags

chatgpt --mcp apify/username~google-maps-scraper@latest \
  --param query="Whole Foods NYC" \
  --param max_results=50

With a single --param

chatgpt --mcp apify/epctex~weather-scraper@latest --param location=Brooklyn

With raw JSON via --params

chatgpt --mcp smithery/username~pdf-summarizer@v1 --params '{"url": "..."}'

Default version behavior (@latest is assumed if omitted)

chatgpt --mcp apify/user~weather --param location=Brooklyn

This is equivalent to:

chatgpt --mcp apify/user~weather@latest --param location=Brooklyn

Handling MCP Replies

By default, responses from MCP plugins are injected into the current thread as user context.

Example

chatgpt --mcp apify/user~weather --param location=Brooklyn

This performs the following:
1. Calls apify/weather@latest with the provided parameters
2. Receives a response such as:
"Current weather in Brooklyn is 65°F and cloudy."
3. Adds the following to thread history:

[MCP: apify/weather]
Current weather in Brooklyn is 65°F and cloudy.

Dual Behavior

  1. MCP-only (context injection mode)
chatgpt --mcp apify/weather@latest --param location=Brooklyn
  • Fetches data from the MCP plugin
  • Injects the response into the thread as user context
  • Does not send a GPT query
  • CLI prints: Context added from apify/weather@latest with parameters: location=Brooklyn
  1. MCP + prompt (context + completion mode)
chatgpt --mcp apify/weather@latest --param location=Brooklyn "What should I wear today?"
  • Injects the MCP response into the thread
  • Immediately sends the user’s query
  • Returns the assistant’s response

Configuration

Create a SMITHERY_API_KEY and APIFY_API_KEY configuration item.

Feedback

Open to feedback on syntax, behavior, or other integrations you’d like to see.

@kardolus kardolus moved this to Todo in LLM Kanban Apr 23, 2025
@kardolus kardolus changed the title Add MCP Support (ideas welcome!) Add Model Context Protocol (MCP) Support (ideas welcome!) Apr 23, 2025
@kardolus kardolus mentioned this issue Apr 23, 2025
@kardolus kardolus changed the title Add Model Context Protocol (MCP) Support (ideas welcome!) Add Model Context Protocol (MCP) Support [ideas welcome!] Apr 23, 2025
@kardolus kardolus moved this from Todo to In Progress in LLM Kanban Apr 24, 2025
@kardolus kardolus changed the title Add Model Context Protocol (MCP) Support [ideas welcome!] Support Model Context Protocol (MCP) Plugins Apr 24, 2025
@kardolus
Copy link
Owner Author

History could perhaps be updated like this:

[
  {
    "role": "system",
    "content": "You are a helpful assistant.",
    "timestamp": "2025-04-28T11:33:15.170826-04:00"
  },
  {
    "role": "user",
    "content": "hi there",
    "timestamp": "2025-04-28T11:33:15.170826-04:00"
  },
  {
    "role": "assistant",
    "content": "Hello! How can I assist you today?\n",
    "timestamp": "2025-04-28T11:33:17.807343-04:00"
  },
  {
    "role": "user",
    "content": "[MCP: apify/weather]\nCity: New York City\nState: New York\nCountry: United States\nZip Code: 11226\nTime: 2025-04-28T09:11:30-0400\nTemperature: 62°F\nForecast: Sunny\nHumidity: 33%\nWind Direction: NNW\nWind Speed: 5 mph",
    "timestamp": "2025-04-28T11:34:00-04:00"
  },
  {
    "role": "user",
    "content": "what should i wear today",
    "timestamp": "2025-04-28T11:37:29.381447-04:00"
  },
  {
    "role": "assistant",
    "content": "Given that the weather forecast for New York City on April 28, 2025, is sunny with a temperature of 62°F, here are a few clothing suggestions:\n\n1. **Layers**: Mornings can be cool, so consider wearing layers. You can start with a light sweater or a long-sleeve shirt and remove it as the day warms up.\n\n2. **Pants or Jeans**: Comfortable jeans or pants would be suitable for this weather.\n\n3. **Footwear**: Sneakers or casual shoes should work well.\n\n4. **Accessories**: Sunglasses and a light scarf or a hat could be useful accessories, given the sunny weather and light breeze.\n\n5. **Outerwear**: A light jacket could be handy in case the breeze makes it feel cooler.\n\nAdjust these suggestions based on your personal comfort and style preferences!\n",
    "timestamp": "2025-04-28T11:37:35.061474-04:00"
  }
]

And the show history could look like this (with the new MCP persona):

SYSTEM 💻:
You are a helpful assistant.

⸻

USER 👤 [2025-04-28 11:33:17]:
hi there

ASSISTANT 🤖:
Hello! How can I assist you today?

⸻

MCP 🔌 [apify/weather | location=Brooklyn]:
City: New York City
State: New York
Country: United States
Zip Code: 11226
Time: 2025-04-28T09:11:30-0400
Temperature: 62°F
Forecast: Sunny
Humidity: 33%
Wind Direction: NNW
Wind Speed: 5 mph

⸻

USER 👤 [2025-04-28 11:37:36]:
what should i wear today

ASSISTANT 🤖:
Given that the weather forecast for New York City…

@kardolus
Copy link
Owner Author

kardolus commented May 1, 2025

Added Apify support here: ea8a9b3

@kardolus
Copy link
Owner Author

kardolus commented May 1, 2025

Released 1.8.3 with support for Apify: https://github.com/kardolus/chatgpt-cli/releases/tag/v1.8.3

@kardolus kardolus closed this as completed May 1, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in LLM Kanban May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant