Skip to content

feat: add sub-agent MCP server with background processing support#3

Closed
localai-bot wants to merge 1 commit into
masterfrom
sub-agent
Closed

feat: add sub-agent MCP server with background processing support#3
localai-bot wants to merge 1 commit into
masterfrom
sub-agent

Conversation

@localai-bot

Copy link
Copy Markdown
Owner

This PR adds a new MCP server called 'sub-agent' that provides chat completion capabilities with background processing support.

Features

  • sub_agent_chat: Send chat completion messages synchronously or asynchronously
  • sub_agent_list: List all active background tasks
  • sub_agent_get_result: Retrieve results from completed background tasks
  • TTL-based cleanup for expired tasks

Environment Variables

  • : Base URL for OpenAI API (default: https://api.openai.com/v1)
  • : Model to use (default: gpt-4o-mini)
  • : API key for authentication (required)
  • : TTL in hours for task results (default: 4)

Implementation Details

  • Written in Go following the existing MCP server patterns in the repository
  • Uses the github.com/modelcontextprotocol/go-sdk/mcp package
  • Implements concurrent task management with thread-safe storage
  • Automatic cleanup of expired tasks every hour

- Implements sub_agent_chat tool for synchronous and asynchronous chat completions
- Adds sub_agent_list tool to list active background tasks
- Adds sub_agent_get_result tool to retrieve task results
- Supports TTL-based cleanup for background tasks
- Configurable via environment variables:
  - OPENAI_BASE_URL: Base URL for OpenAI API
  - OPENAI_MODEL: Model to use (default: gpt-4o-mini)
  - OPENAI_API_KEY: API key for authentication
  - SUB_AGENT_TTL: TTL in hours for task results (default: 4)
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.

1 participant