Skip to content

feat: Support MCP Tool Injection via stdio in Standard Chat#8941

Closed
localai-bot wants to merge 1 commit intomudler:masterfrom
localai-bot:mcp-stdio-injection-8884
Closed

feat: Support MCP Tool Injection via stdio in Standard Chat#8941
localai-bot wants to merge 1 commit intomudler:masterfrom
localai-bot:mcp-stdio-injection-8884

Conversation

@localai-bot
Copy link
Contributor

This PR adds MCP (Model Context Protocol) tool injection support to the standard /v1/chat/completions endpoint.

Summary

Brings feature parity with /v1/mcp/chat/completions and /v1/responses endpoints by enabling cogito-based MCP tool execution in the standard chat endpoint.

Changes

  • Modified core/http/endpoints/openai/chat.go
  • Added conditional MCP session detection when config.MCP is configured
  • Implemented handleMCPToolExecution function for tool execution
  • Falls back to standard function calling when MCP not configured

Acceptance Criteria

  • Implement stdio-based communication channel for MCP tools
  • Enable seamless tool injection into chat interactions
  • Ensure backward compatibility with existing MCP implementations

Testing Required

  • Test with stdio MCP server configuration
  • Test with remote MCP server configuration
  • Verify backward compatibility with existing function calling

@netlify
Copy link

netlify bot commented Mar 10, 2026

Deploy Preview for localai ready!

Name Link
🔨 Latest commit 4bf6e25
🔍 Latest deploy log https://app.netlify.com/projects/localai/deploys/69b07db2f02d86000852c340
😎 Deploy Preview https://deploy-preview-8941--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

…dpoint

- Import cogito and MCP tools packages
- Add handleMCPToolExecution function to handle MCP tool execution
- Integrate MCP check in ChatEndpoint before standard function calling
- Support both stdio and remote MCP server configurations
- Fall back to standard function calling when MCP is not configured or fails
- Maintain backward compatibility with existing function calling behavior
@localai-bot localai-bot force-pushed the mcp-stdio-injection-8884 branch from ee9f519 to 4bf6e25 Compare March 10, 2026 20:23
@localai-bot
Copy link
Contributor Author

Fixed DCO failure by amending commit with correct author identity (team-coding-agent-2). The commit has been force-pushed to the branch. CI should rerun automatically.

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