-
Notifications
You must be signed in to change notification settings - Fork 0
Mukul/mcp #4
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
Open
mukul7661
wants to merge
12
commits into
main
Choose a base branch
from
mukul/mcp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Mukul/mcp #4
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f41ebe4
init mcp
mukul7661 a7a35ea
feat: add MCP server integration and new test scripts for OpenAI and …
mukul7661 c1e0fa8
feat: add cron and webhook test scripts, enhance workflow management …
mukul7661 4485b13
feat: enhance workflow execution and update environment configuration…
mukul7661 4a97c8a
feat: update OpenAI model to gpt-4.1 and add description to MCP server
mukul7661 7ff9956
feat: mcp package
mukul7661 c11a069
feat: integrate corsair permissions handling in MCP server
mukul7661 c8bfbeb
refactor: simplify plugin key access and clean up status type handlin…
mukul7661 07864b1
feat: add new test scripts for Claude API and enhance OpenAI agent in…
mukul7661 06318be
refactor: streamline test scripts for Claude and OpenAI APIs by remov…
mukul7661 a346ea0
fix: remove extra tests
mukul7661 1be8ab9
feat: add test scripts for Claude and OpenAI APIs, enabling interacti…
mukul7661 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,4 +206,6 @@ state.txt | |
| **/orginal-sdk/ | ||
| **/fixtures | ||
|
|
||
| /store | ||
| /store | ||
|
|
||
| .claude/settings.local.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import 'dotenv/config'; | ||
| import Anthropic from '@anthropic-ai/sdk'; | ||
| import { AnthropicProvider } from '@corsair-dev/mcp'; | ||
| import { corsair } from '../server/corsair'; | ||
|
|
||
| // Initialize Corsair tools | ||
| const provider = new AnthropicProvider(); | ||
| const tools = provider.build({ corsair }); | ||
|
|
||
| const client = new Anthropic(); | ||
|
|
||
| // Run with automatic tool loop | ||
| const message = await client.beta.messages.toolRunner({ | ||
| model: 'claude-opus-4-6', | ||
| max_tokens: 4096, | ||
| tools, | ||
| messages: [ | ||
| { role: 'user', content: 'list all slack channels, send test message to sdk-test channel' }, | ||
| ], | ||
| }); | ||
|
|
||
| for (const block of message.content) { | ||
| if (block.type === 'text') process.stdout.write(block.text); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import 'dotenv/config'; | ||
| import { createSdkMcpServer, query } from '@anthropic-ai/claude-agent-sdk'; | ||
| import { ClaudeProvider } from '@corsair-dev/mcp'; | ||
| import { corsair } from '../server/corsair'; | ||
|
|
||
| // Initialize Corsair MCP tools | ||
| const provider = new ClaudeProvider(); | ||
| const tools = await provider.build({ corsair }); | ||
|
|
||
| // Create in-process MCP server | ||
| const server = createSdkMcpServer({ name: 'corsair', tools }); | ||
|
|
||
| // Query Claude with MCP tools | ||
| const stream = query({ | ||
| prompt: 'list all slack channels, send test message to sdk-test channel', | ||
| options: { | ||
| model: 'claude-opus-4-6', | ||
| permissionMode: 'bypassPermissions', | ||
| allowDangerouslySkipPermissions: true, | ||
| mcpServers: { | ||
| corsair: server, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| // Stream the response | ||
| for await (const event of stream) { | ||
| if ('result' in event) { | ||
| process.stdout.write(event.result); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import 'dotenv/config'; | ||
| import { corsair } from '../server/corsair'; // imported for type safety — injected at runtime | ||
| import { workflow } from '../server/sdk'; | ||
|
|
||
| await workflow.cron({ | ||
| id: 'morningSlackReport', | ||
| description: 'Posts a morning message to #sdk-test every weekday at 9am', | ||
| schedule: '0 9 * * 1-5', | ||
| handler: async () => { | ||
| await corsair.slack.api.messages.post({ | ||
| channel: 'C0A3ZTB9X7X', | ||
| text: 'Good morning! Your daily report is ready.', | ||
| }); | ||
| }, | ||
| }); | ||
|
|
||
| const workflows = await workflow.list('cron'); | ||
| console.table(workflows.map((w) => ({ name: w.name, schedule: (w.triggerConfig as any)?.cron, status: w.status }))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import 'dotenv/config'; | ||
| import Anthropic from '@anthropic-ai/sdk'; | ||
| import { getCorsairMcp } from '../server/sdk'; | ||
|
|
||
| const anthropic = new Anthropic(); | ||
| const mcp = getCorsairMcp(); | ||
|
|
||
| const response = await anthropic.beta.messages.create({ | ||
| model: 'claude-sonnet-4-6', | ||
| max_tokens: 4096, | ||
| mcp_servers: [{ type: 'url', name: 'corsair', url: mcp.url }], | ||
| messages: [{ role: 'user', content: 'List all available operations' }], | ||
| betas: ['mcp-client-2025-04-04'], | ||
| }); | ||
|
|
||
| console.log(response.content); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import 'dotenv/config'; | ||
| import { Agent, run, tool } from '@openai/agents'; | ||
| import { OpenAIAgentsProvider } from '@corsair-dev/mcp'; | ||
| import { corsair } from '../server/corsair'; | ||
|
|
||
| // Initialize Corsair tools for OpenAI Agents SDK | ||
| const provider = new OpenAIAgentsProvider(); | ||
| const tools = provider.build({ corsair, tool }); | ||
|
|
||
| // Create an agent with Corsair tools | ||
| const agent = new Agent({ | ||
| name: 'corsair-agent', | ||
| model: 'gpt-4.1', | ||
| instructions: 'You are a helpful assistant with access to Corsair tools. Use list_operations to discover available APIs, get_schema to understand required arguments, and corsair_run to execute them. When referencing resources (like channels), always use their ID, not their name. If a tool call fails, use get_schema to check the expected arguments and retry.', | ||
| tools, | ||
| }); | ||
|
|
||
| // Run the agent | ||
| const result = await run(agent, 'list all slack channels and send test message to sdk-test channel'); | ||
| console.log(result.finalOutput); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import 'dotenv/config'; | ||
| import { corsair } from '../server/corsair'; // imported for type safety — injected at runtime | ||
| import { workflow } from '../server/sdk'; | ||
|
|
||
| await workflow.webhook({ | ||
| id: 'forwardSlackMessageToSdkTest', | ||
| description: 'Forwards every Slack message to #sdk-test', | ||
| trigger: { plugin: 'slack', action: 'messages.message' }, | ||
| handler: async (event: any) => { | ||
| if (!event?.text || event?.channel === 'C0A3ZTB9X7X') return; | ||
| await corsair.slack.api.messages.post({ | ||
| channel: 'C0A3ZTB9X7X', | ||
| text: `[forwarded] <@${event.user}>: ${event.text}`, | ||
| }); | ||
| }, | ||
| }); | ||
|
|
||
| const workflows = await workflow.list('webhook'); | ||
| console.table(workflows.map((w) => ({ name: w.name, trigger: JSON.stringify(w.triggerConfig), status: w.status }))); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any way to strongly type this event? seems unsafe to assert it to any