Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm run lint
npm run lint:fix && npm run lint
194 changes: 0 additions & 194 deletions examples/README.md

This file was deleted.

6 changes: 4 additions & 2 deletions examples/http_example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { MCPAgent, MCPClient } from '../index.js'
config()

async function main() {
const config = { mcpServers: { http: { url: 'https://hf.com/mcp' } } }
const config = { mcpServers: { http: { url: 'https://gitmcp.io/docs' } } }

// Create MCPClient from config
const client = MCPClient.fromDict(config)
Expand All @@ -36,10 +36,12 @@ async function main() {

// Run the query
const result = await agent.run(
'Find the best restaurant in San Francisco USING GOOGLE SEARCH',
'Which tools are available and what can they do?',
30,
)
console.log(`\nResult: ${result}`)

await agent.close()
}

if (import.meta.url === `file://${process.argv[1]}`) {
Expand Down
7 changes: 6 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ export function createConnectorFromConfig(
}

if ('url' in serverConfig) {
// HttpConnector automatically handles streamable HTTP with SSE fallback
const transport = serverConfig.transport || 'http'

return new HttpConnector(serverConfig.url, {
headers: serverConfig.headers,
authToken: serverConfig.auth_token,
authToken: serverConfig.auth_token || serverConfig.authToken,
// Only force SSE if explicitly requested
preferSse: serverConfig.preferSse || transport === 'sse',
})
}

Expand Down
Loading